Add option to skip gdk_init and gtk_init calls when importing Gdk and Gtk
Submitted by Simon Feltman
Auto initialization gives rise to some technical problems and confusion with the rest of the GNOME stack (bug 729643).
We really should not implicitly use or modify sys.argv as a side effect of an import statement anyhow. The reason this is bad is because it removes control of command line parsing from application developers. For example, if an app wanted to use the "--name" option, this conflicts with Gdk which parses "--name" in its init. So you'd have to hack around that with:
old_args = sys.argv sys.argv = [''] from gi.repository import Gdk sys.argv = old_args
The proposal is a add a switch to gi that the Gdk and Gtk overrides can look at when they are imported:
import gi gi.options['no_repo_auto_init'] = True from gi.repository import Gtk ... Gtk.init()
Eventually, the auto initialization should be removed if possible.