Only switch to GLib mainloop when GTK plugin is started

This makes it possible to run the same main binary on systems without
GLib.