[Gtk-sharp-list] Any way to trigger a method call when Gtk.Application.Run() is called?

Peter Johanson peter at peterjohanson.com
Wed May 19 13:53:28 EDT 2010

On Wed, May 19, 2010 at 09:58:13AM -0700, Adam R. wrote:
> I am writing an application that needs to run some code when the app first
> starts up. I would prefer this code to run after Gtk.Application.Run() is
> called, but I have not found a way to detect when the main loop has started.
> The code should run after the main loop has started because it is capable of
> calling Application.Quit if there is a problem, and this doesn't seem to
> work if Application.Run has not been called first.

You should be able to queue up a callback using GLib.Idle.Add and that
callback shouldn't be run until the mainloop processes it. If not, you
could use a GLib.Timeout.Add(100, MyCallback) as another approach.


More information about the Gtk-sharp-list mailing list