Re: Newbie from Hell
- From: Keith Sharp <kms passback co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: Newbie from Hell
- Date: Fri, 30 Jul 2004 08:57:45 +0100
On Fri, 2004-07-30 at 08:25 +0900, Peter Dennis wrote:
[ Snip source code ]
So I get my dialog but what I really don't understand is how to make it
kill my main window when I click on the quit button.
dialog = gtk_dialog_new_with_buttons ("Are you sure you want to quit?",
/*GTK_WINDOW (main_window),*/
NULL,
I know I need to be using the main_window argument above but I am really
not sure how to structure my code. Whenever I try to use it i get a
main_window not declared warning.
I think that all you need to do is to fix the switch/case statement in
the delete_event callback. If this callback returns FALSE then the
destroy_event callback will be called and your program will quit. So
you would do something like:
gtk_widget_show_all (dialog);
gint result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result) {
case GTK_RESPONSE_ACCEPT:
/* Return FALSE and have destroy_event called */
return FALSE;
break;
default:
/* Close the dialog and return to the main window */
gtk_widget_destroy (dialog);
}
return TRUE;
In your program, note the comments at the start and end of the
delete_event callback, and in the main function where you connect the
signal handlers.
Keith.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]