diff --git a/gtk/dlg_utils.c b/gtk/dlg_utils.c index 01c0ab39ab..0a552de9c7 100644 --- a/gtk/dlg_utils.c +++ b/gtk/dlg_utils.c @@ -151,7 +151,9 @@ dlg_button_row_new(const gchar *stock_id_first, ...) } else if (strcmp(stock_id, WIRESHARK_STOCK_SAVE_ALL) == 0) { save_all = stock_id; } else if (strcmp(stock_id, WIRESHARK_STOCK_DONT_SAVE) == 0) { - dont_save = stock_id; + dont_save = stock_id; + } else if (strcmp(stock_id, WIRESHARK_STOCK_QUIT_DONT_SAVE) == 0) { + dont_save = stock_id; } else if (strcmp(stock_id, GTK_STOCK_CANCEL) == 0) { cancel = stock_id; } else if (strcmp(stock_id, GTK_STOCK_CLOSE) == 0) { diff --git a/gtk/main.c b/gtk/main.c index 5a4e37de90..1b8617d9ae 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -865,7 +865,7 @@ main_window_delete_event_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { gtk_window_present(GTK_WINDOW(top_level)); /* user didn't saved his current file, ask him */ - dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, + dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL, "%sSave capture file before program quit?%s\n\n" "If you quit the program without saving, your capture data will be discarded.", simple_dialog_primary_start(), simple_dialog_primary_end()); @@ -954,7 +954,7 @@ static void file_quit_answered_cb(gpointer dialog _U_, gint btn, gpointer data _ /* save file first */ file_save_as_cmd(after_save_exit, NULL); break; - case(ESD_BTN_DONT_SAVE): + case(ESD_BTN_QUIT_DONT_SAVE): main_do_quit(); break; case(ESD_BTN_CANCEL): @@ -971,7 +971,7 @@ file_quit_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { /* user didn't saved his current file, ask him */ - dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, + dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL, "%sSave capture file before program quit?%s\n\n" "If you quit the program without saving, your capture data will be discarded.", simple_dialog_primary_start(), simple_dialog_primary_end()); diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c index 6b01b1e65a..6d822c0b4a 100644 --- a/gtk/simple_dialog.c +++ b/gtk/simple_dialog.c @@ -210,6 +210,9 @@ display_simple_dialog(gint type, gint btn_mask, char *message) case(ESD_BTNS_SAVE_DONTSAVE_CANCEL): bbox = dlg_button_row_new(GTK_STOCK_SAVE, WIRESHARK_STOCK_DONT_SAVE, GTK_STOCK_CANCEL, NULL); break; + case(ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL): + bbox = dlg_button_row_new(GTK_STOCK_SAVE, WIRESHARK_STOCK_QUIT_DONT_SAVE, GTK_STOCK_CANCEL, NULL); + break; case(ESD_BTNS_YES_NO): bbox = dlg_button_row_new(GTK_STOCK_YES, GTK_STOCK_NO, NULL); break; @@ -238,6 +241,12 @@ display_simple_dialog(gint type, gint btn_mask, char *message) g_object_set_data(G_OBJECT(dont_save_bt), CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_DONT_SAVE)); g_signal_connect(dont_save_bt, "clicked", G_CALLBACK(simple_dialog_cancel_cb), win); } + + dont_save_bt = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_QUIT_DONT_SAVE); + if (dont_save_bt) { + g_object_set_data(G_OBJECT(dont_save_bt), CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_QUIT_DONT_SAVE)); + g_signal_connect(dont_save_bt, "clicked", G_CALLBACK(simple_dialog_cancel_cb), win); + } bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CLEAR); if(bt) { g_object_set_data(G_OBJECT(bt), CALLBACK_BTN_KEY, GINT_TO_POINTER(ESD_BTN_CLEAR)); diff --git a/gtk/stock_icons.c b/gtk/stock_icons.c index 8850ee0b76..6720614e45 100644 --- a/gtk/stock_icons.c +++ b/gtk/stock_icons.c @@ -113,6 +113,7 @@ void stock_icons_init(void) { { WIRESHARK_STOCK_APPLY_EXPRESSION, "App_ly" , 0, 0, NULL }, { WIRESHARK_STOCK_SAVE_ALL, "Save A_ll", 0, 0, NULL }, { WIRESHARK_STOCK_DONT_SAVE, "Continue _without Saving", 0, 0, NULL }, + { WIRESHARK_STOCK_QUIT_DONT_SAVE, "Quit _without Saving", 0, 0, NULL }, { WIRESHARK_STOCK_ABOUT, "_About", 0, 0, NULL }, { WIRESHARK_STOCK_COLORIZE, "_Colorize", 0, 0, NULL }, { WIRESHARK_STOCK_AUTOSCROLL, "_Auto Scroll in Live Capture", 0, 0, NULL }, @@ -239,6 +240,7 @@ void stock_icons_init(void) { gtk_icon_factory_add(factory, WIRESHARK_STOCK_APPLY_EXPRESSION, icon_set); icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_CLEAR); gtk_icon_factory_add(factory, WIRESHARK_STOCK_DONT_SAVE, icon_set); + gtk_icon_factory_add(factory, WIRESHARK_STOCK_QUIT_DONT_SAVE, icon_set); icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_SAVE); gtk_icon_factory_add(factory, WIRESHARK_STOCK_SAVE_ALL, icon_set); /* XXX: needs a better icon */ icon_set = gtk_icon_factory_lookup_default(GTK_STOCK_CLOSE); diff --git a/gtk/stock_icons.h b/gtk/stock_icons.h index 0bd0eb900e..330a4354b9 100644 --- a/gtk/stock_icons.h +++ b/gtk/stock_icons.h @@ -51,6 +51,7 @@ #define WIRESHARK_STOCK_CLEAR_EXPRESSION "Wireshark_Stock_Clear_Expression" #define WIRESHARK_STOCK_APPLY_EXPRESSION "Wireshark_Stock_Apply_Expression" #define WIRESHARK_STOCK_DONT_SAVE "Wireshark_Stock_Continue_without_Saving" +#define WIRESHARK_STOCK_QUIT_DONT_SAVE "Wireshark_Stock_Quit_without_Saving" #define WIRESHARK_STOCK_SAVE_ALL "Wireshark_Stock_Save_All" #define WIRESHARK_STOCK_ABOUT "Wireshark_Stock_About" #define WIRESHARK_STOCK_COLORIZE "Wireshark_Stock_Colorize" diff --git a/simple_dialog.h b/simple_dialog.h index 5dc657e145..bf3a68f0de 100644 --- a/simple_dialog.h +++ b/simple_dialog.h @@ -63,6 +63,8 @@ typedef enum { #define ESD_BTN_SAVE 0x20 /** display a "Continue without Saving" button */ #define ESD_BTN_DONT_SAVE 0x40 +/** display a "Quit without Saving" button */ +#define ESD_BTN_QUIT_DONT_SAVE 0x80 /** Standard button combination "Ok" + "Cancel". */ #define ESD_BTNS_OK_CANCEL (ESD_BTN_OK|ESD_BTN_CANCEL) @@ -72,6 +74,8 @@ typedef enum { #define ESD_BTNS_YES_NO_CANCEL (ESD_BTN_YES|ESD_BTN_NO|ESD_BTN_CANCEL) /** Standard button combination "No" + "Cancel" + "Save". */ #define ESD_BTNS_SAVE_DONTSAVE_CANCEL (ESD_BTN_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE) +/** Standard button combination "Quit without saving" + "Cancel" + "Save". */ +#define ESD_BTNS_SAVE_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL|ESD_BTN_SAVE) #if __GNUC__ >= 2 /** Create and show a simple dialog.