Re: Gtk::Main and GMainLoop



On Monday 01 January 2007 02:44, Matt Hoosier wrote:
> On 12/31/06, Andreas Volz <lists brachttal net> wrote:
> > Hello,
> >
> > is it possible to get access to the GMainLoop from a Gtk::Main? Or have
> > I to use a Glib::MainLoop instead if I need access to the GMainLoop?
> You may have trouble getting at the GMainLoop instance used to
> implement the UI thread of a Gtk+ program. Its instance is totally
> hidden inside static variables of gtkmain.c, and there's no accessor
> function to fetch it out of there.
>
> There's probably nothing GlibMM or GtkMM can do to give the GMainLoop
> instance (wrapped or otherwise).

http://developer.gnome.org/doc/API/2.0/gtk/gtk-General.html says "It's OK to 
use the GLib main loop directly instead of gtk_main(), though it involves 
slightly more typing."  So with GTK+, instead of calling gtk_main() you can 
instead call g_main_loop_new(), and then call g_main_loop_run() on the 
returned GMainLoop object (and store that object for future use if required).

Presumably (although I do not know as I haven't tried it) instead of calling 
Gtk::Main::run(), it would be possible to call Glib::MainLoop::create(), and 
then call Glib::MainLoop::run() on the returned MainLoop object, which you 
could store.  You would still, however, be required to have created the 
singleton Gtk::Main object prior to doing so.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]