This is as simple as I can get it. I'll assume we're talking about complex functions; if real, tensor with $\mathbb{C}$. Now pass to the units. With the topology given by spectral radius (this is an algebraic description of the C-* topology), the group of connected components of the group of units is $H^1(X, \mathbb{Z})$ which of course knows the genus. 

If you really like idempotents then you should try learning about K-theory. There's a very concrete and elementary way to define $K^0$ in terms of idempotents in the matrix algebras $M_n(A)$. You don't need the C*-structure of $A$. But on the other hand $K^0$ doesn't know the genus of a surface. $K^1$ does but it's a bit trickier to define, I think.