Michael Mann:

Removed the Save button if live capture is going on when File->Quit is selected. Solves Assertion failed when doing File->Quit->Save during live capture
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1710

svn path=/trunk/; revision=39266
This commit is contained in:
Anders Broman 2011-10-05 05:53:53 +00:00
parent c22cc0a5bb
commit 33fc6f13ca
3 changed files with 14 additions and 7 deletions

View File

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

View File

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

View File

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