Re: [gtk-list] Re: non-exiting gtk_exit()




Paul Barton-Davis <pbd@op.net> writes:
> >> Is there any way to do what gtk_exit() does, but not exit the program
> >> at the same time? 
> >
> >Yes, gtk_exit() doesn't do anything but exit, so doing nothing at all
> >will do what you want. ;-)
> 
> Not the right answer, Havoc :) But OTOH, the right answer is hard to
> find. I have tried several different attempts at this, and none of
> them really work.
>

Yes it is right - what else does gtk_exit () do? Nothing. So
there.:-P
 
> The obvious answer is gtk_quit(), but this only pops up one level of
> gtk_main_iteration(). If the program is running with nested levels,
> this doesn't work. I tried a test of the depth level, and kept calling
> gtk_quit till the level was appropriate, but this didn't work
> either. I may have just been stupid about how I was doing this. 
> 
> There really needs to be a simple way to say: I want this thread,
> assuming that its the one that first called gtk_main() (or whatever
> that entry point is called - i never do it directly anymore), to
> return from that function, regardless of the current nesting level. 
> 
> *AND* i don't want the answer to be "use setjmp" :)
> 

This is a different question you are asking - you're asking how to
make the outermost gtk_main() return. gtk_exit () has nothing to do
with that, in fact returning from the outermost gtk_main() only
conventionally quits the application, it hardly has to. 

I would expect this to work:
 while (gtk_main_level () != 0)
   gtk_main_quit ();

but maybe it won't. Still, I would call this code broken; I'm not sure
how it would behave if you had a modal dialog up, for example. A
better solution is to never call gtk_main() recursively, and instead
explicitly create a new GMainLoop and g_main_run()/g_main_quit() that
main loop.

Havoc



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