code migrated from PyGTK to PyGObject