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

Re: Destroy signal: Quit Y/N?




On Thu, 21 Oct 1999, Matt M. wrote:
> and create a loop:
> 	 while (quitApp==0) { 
> 		/* loop here */ 
> 	}
> 
> 	if(quitApp==1)
> 	{
> 		gtk_main_quit();
> 	}
> 	else { return; }
> 	
> When the yes button is clicked, set quitApp to something besides 0. To make
> this work (since you'll need to use another calleback for the
> button_press_event on the yes and no buttons, make quitApp global, that way
> when set to 1 or whatever, the while loop will see it. In this example 1 will
> cause it to quit, any other value will cause it to return and not quit.
> 

There are a number of problems here. 

 - It's a busy loop. The standard way to do this is to use a recursive
   main loop, gnome-libs/libgnomeui/gnome-dialog.c has a good example; 
   this way you avoid polling your variable.
 - You are not allowing the GUI to update while you're in the loop
 - If you are hoping to keep the widget being destroyed active 
   when this callback returns, that won't work. The widget has 
   already been marked destroyed.

Havoc




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