Re: User dialog within a callback function



how can I call a user dialog  like  dialog_new  widget
with in a running callback routine. If I set up the dialog widget
it is shown and has controll only after I closed the callback and 
the system is back in the main gtk loop. But I want to wait in the
first callback of the answer user dialog to decide what to do in
in this callback. So the question ist how to force to show and manage
a window widget direct. Can I open in the callback a second gtk_main()
loop and when closing the dialog  cancel the second loop with
gtk_main_quit().
Who has any idee how to solve such sycron dialogs.


My opinion only... of course...

Every single independent action should be 
connected with a different callback. This
should run until the end and return control to
the main loop. Each callback should perform one
atomic action, not two or three. Don't add gtk_main loops
in callbacks, this is just loooking for trouble.

/* bad */
callback()
{
do_something1;

wait for user;

do_something2;
}

/* good */
callback1 ()
{
do_something1;
}

callback2 ()
{
do_something2;
}

Don't use more gtk_main loops, only the main loop,
and do everything else with callbacks, doing otherwise
is looking for trouble.

In short, write independent callbacks for each 
action you want, always waiting in the main loop,
do this consistently and you will be always safe.

I have myself dialogs that interact in complex ways with other dialogs
and everything is easy and safe because I use only callbacks, no
secondary gtk_main() loops and other nightmares.

Carlos




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