Change button label to "Quit without Saving" from "Continue without Saving"

when exiting Wireshark and having an open, not yet saved capture file.
This fixes bug 1427.

svn path=/trunk/; revision=28502
This commit is contained in:
Balint Reczey 2009-05-27 02:42:43 +00:00
parent 8983d6813b
commit 422b347862
6 changed files with 22 additions and 4 deletions

View File

@ -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) {

View File

@ -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());

View File

@ -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));

View File

@ -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);

View File

@ -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"

View File

@ -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.