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

Adam R. darkelyte.mono at mailnull.com
Wed May 19 15:45:02 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.
>
> -pete

That worked perfectly, just what I was looking for. Thanks Pete!
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Any-way-to-trigger-a-method-call-when-Gtk-Application-Run-is-called-tp2223200p2223465.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list