gobject.py: Simplify and reduce code a bit