Re: Two gtk_main() ?? What to know ?




Eric Hegstrom <ehegstrom@sonoranscanners.com> writes:

> You have to use gtk_grab_.... (it's too early for me to remember but i
> think it's) gtk_grab_event(dialog) and then release them right before
> you call the main quit in to exit the dialog.

gtk_window_set_modal() handles that.
 
> > On 7 Sep 1999, Owen Taylor wrote:
> > 
> > > Sven Anders <anderss@fmi.uni-passau.de> writes:
> > >
> > > > Hello !
> > > >
> > > > I want to use two gtk_main() in my program. I know it is possible.
> > > > What I want to know is, has anybody experience with it and what do
> > > > I have to pay attention to ?!
> > > > Are there any pitfalls ? Any "must not"'s ?
> > > > What do I have to know in addition ?
> > >
> > > I'm not quite sure what you mean by "two gtk_main()"
> > >
> > > One possibility is a recursive gtk_main(). That is, in
> > > some callback, calling gtk_main().
> > 
> > Yes, I mean a recursive gtk_main().
> > 
> > > This is a commonly used way to handle model dialogs - something
> > > like:
> > >
> > >  gtk_window_set_modal (GTK_WINDOW (dialog));
> > >  gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
> > >                      GTK_SIGNAL_FUNC (gtk_main_quit()), NULL);
> > >  gtk_widget_show (dialog);
> > >  gtk_main();
> > 
> > Is this all or can I get in trouble, if I (for instance) do not catch all
> > signals correctly?
> > I tried a slightly different version of the above and had some trouble,
> > because my dialog re-appears after clicking any button. Do I have to clean
> > up all my old events after quitting the second gtk_main() or did I forget
> > something ???

The above is substantially correct. (modulo typos, or whatever, 
I just typed it in without testing). Once the widget is destroyed,
it is gone so there is no way it is going to pop up again
unless you create it again. I'd suspect something is fishy
with the code that was being used.

Regards,
                                        owen



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