diff options
-rw-r--r-- | gtk/main.c | 16 | ||||
-rw-r--r-- | gtk/simple_dialog.c | 3 | ||||
-rw-r--r-- | simple_dialog.h | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/gtk/main.c b/gtk/main.c index a94dbbf6c8..d40bae7ba5 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1008,7 +1008,8 @@ 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_QUIT_DONTSAVE_CANCEL, + dialog = simple_dialog(ESD_TYPE_CONFIRMATION, + ((cfile.state == FILE_READ_IN_PROGRESS) ? ESD_BTNS_QUIT_DONTSAVE_CANCEL : 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()); @@ -1113,12 +1114,13 @@ file_quit_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) gpointer dialog; 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_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()); - simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL); + /* user didn't saved his current file, ask him */ + dialog = simple_dialog(ESD_TYPE_CONFIRMATION, + ((cfile.state == FILE_READ_IN_PROGRESS) ? ESD_BTNS_QUIT_DONTSAVE_CANCEL : 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()); + simple_dialog_set_cb(dialog, file_quit_answered_cb, NULL); } else { /* unchanged file, just exit */ main_do_quit(); diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c index a5e31da0ed..56c4d76e25 100644 --- a/gtk/simple_dialog.c +++ b/gtk/simple_dialog.c @@ -196,6 +196,9 @@ display_simple_dialog(gint type, gint btn_mask, char *message) 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_QUIT_DONTSAVE_CANCEL): + bbox = dlg_button_row_new(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; diff --git a/simple_dialog.h b/simple_dialog.h index 40258cadb7..7687b4e77b 100644 --- a/simple_dialog.h +++ b/simple_dialog.h @@ -76,6 +76,8 @@ typedef enum { #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) +/** Standard button combination "Quit without saving" + "Cancel". */ +#define ESD_BTNS_QUIT_DONTSAVE_CANCEL (ESD_BTN_QUIT_DONT_SAVE|ESD_BTN_CANCEL) /** Create and show a simple dialog. * |