Gutzwiller approximation applied to inhomogeneous lattice models and solid-state systems