$f=0$ iff $\mathfrak{g}$ has no cenetr. This provide an answer to (1) and the answer to (2) is "yes".
For every finite dimensional representation $\rho:G\to \text{GL}(V)$, $f(v)=\int \rho(g)vdg$ gives a linear operator on $V$ which is the projection on the subspace of invariants $V^G$ (clearly the image of $f$ consists of invariant vectors and $f$ is the identity on invariant vectors). For $\rho=\text{Ad}$, $\mathfrak{g}^G$ is the center of $\mathfrak{g}$.