From 4a9b825c49a228b6456fbf24731aadcdd47d2c4e Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 20 May 2012 08:56:06 +0000 Subject: Change the "user_saved" member of a capture_file structure to "unsaved_changes", and have it be TRUE iff changes have been made to the file since it was read - *not* if it's a temporary file from a live capture. Check the "is_tempfile" member, and the "unsaved_changes" member, when appropriate. Just have a set_toolbar_for_capture_file() routine that updates the "save", "close", and "reload" toolbar as appropriate, given a capture_file structure - absorb the function of set_toolbar_for_unsaved_capture_file() into it. svn path=/trunk/; revision=42721 --- cfile.c | 24 ++++++++++---------- cfile.h | 2 +- file.c | 14 ++++++------ rawshark.c | 4 ++-- tshark.c | 14 +++++++----- ui/gtk/capture_dlg.c | 6 +++-- ui/gtk/capture_file_dlg.c | 26 ++++++++++++++------- ui/gtk/drag_and_drop.c | 6 +++-- ui/gtk/file_import_dlg.c | 6 +++-- ui/gtk/main.c | 14 +++++++----- ui/gtk/main_menubar.c | 22 ++++++++++-------- ui/gtk/main_toolbar.c | 57 +++++++++++++++++++++++++++-------------------- ui/gtk/main_toolbar.h | 16 +++++-------- ui/gtk/new_packet_list.c | 4 ++-- ui/gtk/summary_dlg.c | 4 ++-- 15 files changed, 124 insertions(+), 95 deletions(-) diff --git a/cfile.c b/cfile.c index 3463c1d538..e3e5cb2c35 100644 --- a/cfile.c +++ b/cfile.c @@ -37,16 +37,16 @@ void cap_file_init(capture_file *cf) { /* Initialize the capture file struct */ - cf->filename = NULL; - cf->source = NULL; - cf->is_tempfile = FALSE; - cf->user_saved = FALSE; - cf->count = 0; - cf->has_snap = FALSE; - cf->snap = WTAP_MAX_PACKET_SIZE; - cf->wth = NULL; - cf->rfcode = NULL; - cf->dfilter = NULL; - cf->redissecting = FALSE; - cf->frames = NULL; + cf->filename = NULL; + cf->source = NULL; + cf->is_tempfile = FALSE; + cf->unsaved_changes = FALSE; + cf->count = 0; + cf->has_snap = FALSE; + cf->snap = WTAP_MAX_PACKET_SIZE; + cf->wth = NULL; + cf->rfcode = NULL; + cf->dfilter = NULL; + cf->redissecting = FALSE; + cf->frames = NULL; } diff --git a/cfile.h b/cfile.h index 9d0af14b6a..63bd0eee90 100644 --- a/cfile.h +++ b/cfile.h @@ -70,7 +70,7 @@ typedef struct _capture_file { gchar *filename; /* Name of capture file */ gchar *source; /* Temp file source, e.g. "Pipe from elsewhere" */ gboolean is_tempfile; /* Is capture file a temporary file? */ - gboolean user_saved; /* If capture file is temporary or modified, has it been saved by user yet? */ + gboolean unsaved_changes; /* Does the capture file have changes that have not been saved? */ gint64 f_datalen; /* Size of capture file data (uncompressed) */ guint16 cd_t; /* File type of capture file */ int lnk_t; /* Link-layer type with which to save capture */ diff --git a/file.c b/file.c index c9f628f579..92788adf03 100644 --- a/file.c +++ b/file.c @@ -306,8 +306,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* Indicate whether it's a permanent or temporary file. */ cf->is_tempfile = is_tempfile; - /* If it's a temporary capture buffer file, mark it as not saved. */ - cf->user_saved = !is_tempfile; + /* No user changes yet. */ + cf->unsaved_changes = FALSE; reset_elapsed(); @@ -386,8 +386,8 @@ cf_reset_state(capture_file *cf) g_free(cf->filename); cf->filename = NULL; } - /* ...which means we have nothing to save. */ - cf->user_saved = FALSE; + /* ...which means we have no changes to that file to save. */ + cf->unsaved_changes = FALSE; dfilter_free(cf->rfcode); cf->rfcode = NULL; @@ -3687,8 +3687,8 @@ cf_update_capture_comment(capture_file *cf, gchar *comment) /* The comment has changed, let's update it */ wtap_write_shb_comment(cf->wth, comment); - /* Mark the file as unsaved */ - cf->user_saved = FALSE; + /* Mark the file as having unsaved changes */ + cf->unsaved_changes = TRUE; } typedef struct { @@ -3944,7 +3944,7 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f the data, and it means we have to spend time opening and reading the file, which could be a significant amount of time if the file is large. */ - cf->user_saved = TRUE; + cf->unsaved_changes = FALSE; if ((cf_open(cf, fname, FALSE, &err)) == CF_OK) { /* XXX - report errors if this fails? diff --git a/rawshark.c b/rawshark.c index cad08a9afe..7604627a98 100644 --- a/rawshark.c +++ b/rawshark.c @@ -1584,8 +1584,8 @@ raw_cf_open(capture_file *cf, const char *fname) /* Indicate whether it's a permanent or temporary file. */ cf->is_tempfile = FALSE; - /* If it's a temporary capture buffer file, mark it as not saved. */ - cf->user_saved = FALSE; + /* No user changes yet. */ + cf->unsaved_changes = FALSE; cf->cd_t = WTAP_FILE_UNKNOWN; cf->count = 0; diff --git a/tshark.c b/tshark.c index cb64d6de34..46f9949761 100644 --- a/tshark.c +++ b/tshark.c @@ -2419,15 +2419,17 @@ capture_input_drops(capture_options *capture_opts _U_, guint32 dropped) void capture_input_closed(capture_options *capture_opts, gchar *msg) { + capture_file *cf = (capture_file *) capture_opts->cf; + if (msg != NULL) fprintf(stderr, "tshark: %s\n", msg); report_counts(); - if(capture_opts->cf != NULL && ((capture_file *) capture_opts->cf)->wth != NULL) { - wtap_close(((capture_file *) capture_opts->cf)->wth); - if(((capture_file *) capture_opts->cf)->user_saved == FALSE) { - ws_unlink(((capture_file *) capture_opts->cf)->filename); + if(cf != NULL && cf->wth != NULL) { + wtap_close(cf->wth); + if(cf->is_tempfile) { + ws_unlink(cf->filename); } } #ifdef USE_BROKEN_G_MAIN_LOOP @@ -3526,8 +3528,8 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err) /* Indicate whether it's a permanent or temporary file. */ cf->is_tempfile = is_tempfile; - /* If it's a temporary capture buffer file, mark it as not saved. */ - cf->user_saved = !is_tempfile; + /* No user changes yet. */ + cf->unsaved_changes = FALSE; cf->cd_t = wtap_file_type(cf->wth); cf->count = 0; diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c index c9b21748ba..86d5a8fcd3 100644 --- a/ui/gtk/capture_dlg.c +++ b/ui/gtk/capture_dlg.c @@ -4251,8 +4251,10 @@ capture_start_cb(GtkWidget *w _U_, gpointer d _U_) return; } - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { - /* user didn't saved his current file, ask him */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, "%sSave capture file before starting a new capture?%s\n\n" "If you start a new capture without saving, your current capture data will\nbe discarded.", diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index 05765f6813..cd22ebdf04 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -604,8 +604,10 @@ void file_open_cmd_cb(GtkWidget *widget, gpointer data _U_) { gpointer dialog; - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { - /* user didn't save his current file, ask him */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, "%sSave capture file before opening a new one?%s\n\n" "If you open a new capture file without saving, your capture data will be discarded.", @@ -908,8 +910,10 @@ void file_merge_cmd_cb(GtkWidget *widget, 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 */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_OK_CANCEL, "%sSave the capture file before merging to another one?%s\n\n" "A temporary capture file can't be merged.", @@ -1078,8 +1082,10 @@ void file_close_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 */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, "%sSave capture file before closing it?%s\n\n" "If you close without saving, your capture data will be discarded.", @@ -1094,10 +1100,14 @@ file_close_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { void file_save_cmd_cb(GtkWidget *w _U_, gpointer data _U_) { - /* If the file's already been saved, do nothing. */ - if (cfile.user_saved) + /* If the file has no unsaved changes, and is not a temporary file, + do nothing. */ + if (!cfile.unsaved_changes && !cfile.is_tempfile) return; + /* XXX TODO - if it's not a temporary file, "save" should just save + on top of the existing file. */ + /* Do a "Save As". */ file_save_as_cmd(after_save_no_action, NULL, FALSE); } diff --git a/ui/gtk/drag_and_drop.c b/ui/gtk/drag_and_drop.c index 5db1be8a34..a11853d2b7 100644 --- a/ui/gtk/drag_and_drop.c +++ b/ui/gtk/drag_and_drop.c @@ -356,8 +356,10 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin cf_names_freeme[sel_data_len] = '\0'; /* ask the user to save it's current capture file first */ - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { - /* user didn't saved his current file, ask him */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, "%sSave capture file before opening a new one?%s\n\n" diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index 5390874c17..70174184a5 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -800,9 +800,11 @@ file_import_ok_cb(GtkWidget *widget _U_, gpointer data) { text_import_info_t *text_import_info; - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ gpointer dialog; - /* user didn't save his current file, ask him */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_SAVE_DONTSAVE_CANCEL, "%sSave capture file before opening a new one?%s\n\n" "If you open a new capture file without saving, your capture data will be discarded.", diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 547d586f6c..2b5605a6a8 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -1009,9 +1009,11 @@ main_window_delete_event_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer { gpointer dialog; - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ gtk_window_present(GTK_WINDOW(top_level)); - /* 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" @@ -1115,10 +1117,12 @@ static void file_quit_answered_cb(gpointer dialog _U_, gint btn, gpointer data _ void file_quit_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) { - gpointer dialog; + gpointer dialog; - if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { - /* user didn't saved his current file, ask him */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ 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" diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index 99b4dc9ab6..f24f4edcf3 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -4196,8 +4196,10 @@ menu_open_recent_file_cmd_cb(GtkAction *action, 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 */ + if((cfile.state != FILE_CLOSED) && (cfile.is_tempfile || cfile.unsaved_changes) && + prefs.gui_ask_unsaved) { + /* This is a temporary capture file or has unsaved changes; ask the + user whether to save the capture. */ dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO_CANCEL, "%sSave capture file before opening a new one?%s\n\n" "If you open a new capture file without saving, your current capture data will be discarded.", @@ -4638,25 +4640,27 @@ set_menus_for_capture_file(capture_file *cf) set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", FALSE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", FALSE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", FALSE); - set_toolbar_for_capture_file(FALSE, FALSE); - set_toolbar_for_unsaved_capture_file(FALSE); } else { set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Merge", cf_can_save_as(cf)); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Close", TRUE); - set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", !cf->user_saved); + /* + * "Save" should be available only if the file is a temporary file + * or has unsaved changes. + */ + set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Save", + (cf->is_tempfile || cf->unsaved_changes)); /* * "Save As..." works only if we can write the file out in at least * one format (so we can save the whole file or just a subset) or - * if we have an unsaved capture (so writing the whole file out + * if the file is a temporary file (so writing the whole file out * with a raw data copy makes sense). */ set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/SaveAs", - cf_can_save_as(cf) || !cf->user_saved); + cf_can_save_as(cf) || cf->is_tempfile); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Export", TRUE); set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/ViewMenu/Reload", TRUE); - set_toolbar_for_unsaved_capture_file(!cf->user_saved); - set_toolbar_for_capture_file(TRUE, cf_can_save_as(cf) || !cf->user_saved); } + set_toolbar_for_capture_file(cf); } /* Enable or disable menu items based on whether there's a capture in diff --git a/ui/gtk/main_toolbar.c b/ui/gtk/main_toolbar.c index 5fabfa74a8..488a6c2279 100644 --- a/ui/gtk/main_toolbar.c +++ b/ui/gtk/main_toolbar.c @@ -103,35 +103,45 @@ toolbar_redraw_all(void) } /* Enable or disable toolbar items based on whether you have a capture file - you've finished reading. */ -void set_toolbar_for_capture_file(gboolean have_capture_file, gboolean can_save_as) { + and, if so, whether you've finished reading it and whether there's stuff + in it that hasn't yet been saved to a permanent file. */ +void set_toolbar_for_capture_file(capture_file *cf) { if (toolbar_init) { - gtk_widget_set_sensitive(GTK_WIDGET(save_button), have_capture_file && can_save_as); - gtk_widget_set_sensitive(GTK_WIDGET(close_button), have_capture_file); - gtk_widget_set_sensitive(GTK_WIDGET(reload_button), have_capture_file); - } -} - -/* Enable or disable menu items based on whether you have an unsaved - capture file you've finished reading. */ -void set_toolbar_for_unsaved_capture_file(gboolean have_unsaved_capture_file) { - - if (toolbar_init) { - if(have_unsaved_capture_file) { - if (strcmp(gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(save_button)), GTK_STOCK_SAVE) != 0) { - gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(save_button), GTK_STOCK_SAVE); - gtk_widget_set_tooltip_text(GTK_WIDGET(save_button),SAVE_BUTTON_TOOLTIP_TEXT); - g_object_set_data(G_OBJECT(save_button), "save", GINT_TO_POINTER(1)); - } - } else { + if (cf == NULL || cf->state == FILE_READ_IN_PROGRESS) { + /* We have no open capture file, or we have one but we're in + the process of reading it. Disable everything having to + do with the file*/ if (strcmp(gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(save_button)), GTK_STOCK_SAVE_AS) != 0) { gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(save_button), GTK_STOCK_SAVE_AS); gtk_widget_set_tooltip_text(GTK_WIDGET(save_button), SAVE_AS_BUTTON_TOOLTIP_TEXT); g_object_set_data(G_OBJECT(save_button), "save", GINT_TO_POINTER(0)); } + gtk_widget_set_sensitive(GTK_WIDGET(save_button), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(close_button), FALSE); + gtk_widget_set_sensitive(GTK_WIDGET(reload_button), FALSE); + } else { + /* We have an open capture file and we're finished reading it. + Enable "Save As", "Close", and "Reload"; enable "Save" iff + it has stuff not saved to a permanent file (and we support + saving in its format). */ + if (cf->is_tempfile || cf->unsaved_changes) { + if (strcmp(gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(save_button)), GTK_STOCK_SAVE) != 0) { + gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(save_button), GTK_STOCK_SAVE); + gtk_widget_set_tooltip_text(GTK_WIDGET(save_button),SAVE_BUTTON_TOOLTIP_TEXT); + g_object_set_data(G_OBJECT(save_button), "save", GINT_TO_POINTER(1)); + } + } else { + if (strcmp(gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(save_button)), GTK_STOCK_SAVE_AS) != 0) { + gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(save_button), GTK_STOCK_SAVE_AS); + gtk_widget_set_tooltip_text(GTK_WIDGET(save_button), SAVE_AS_BUTTON_TOOLTIP_TEXT); + g_object_set_data(G_OBJECT(save_button), "save", GINT_TO_POINTER(0)); + } + } + gtk_widget_set_sensitive(GTK_WIDGET(save_button), + (cf->is_tempfile || cf->unsaved_changes) && cf_can_save_as(cf)); + gtk_widget_set_sensitive(GTK_WIDGET(close_button), TRUE); + gtk_widget_set_sensitive(GTK_WIDGET(reload_button), TRUE); } - /*gtk_widget_set_sensitive((GTK_WIDGET(save_button), have_unsaved_capture_file); - gtk_widget_set_sensitive(GTK_WIDGET(save_as_button), !have_unsaved_capture_file);*/ } } @@ -408,9 +418,8 @@ toolbar_new(void) /* disable all "sensitive" items by default */ toolbar_init = TRUE; - set_toolbar_for_unsaved_capture_file(FALSE); set_toolbar_for_captured_packets(FALSE); - set_toolbar_for_capture_file(FALSE, FALSE); + set_toolbar_for_capture_file(NULL); #ifdef HAVE_LIBPCAP set_toolbar_for_capture_in_progress(FALSE); #endif /* HAVE_LIBPCAP */ diff --git a/ui/gtk/main_toolbar.h b/ui/gtk/main_toolbar.h index 5d7743e458..701798340b 100644 --- a/ui/gtk/main_toolbar.h +++ b/ui/gtk/main_toolbar.h @@ -50,18 +50,12 @@ void toolbar_colorize_changed(gboolean packet_list_colorize); void toolbar_auto_scroll_live_changed(gboolean auto_scroll_live); #endif -/** We have (or don't have) a capture file now. - * - * @param have_capture_file TRUE, if we have a capture file - * @param can_save_as TRUE, if we can save this capture file - */ -void set_toolbar_for_capture_file(gboolean have_capture_file, gboolean can_save_as); - -/** We have (or don't have) an unsaved capture file now. - * - * @param have_unsaved_capture_file TRUE, if we have an unsaved capture file +/* Enable or disable toolbar items based on whether you have a capture file + * and, if so, whether you've finished reading it and whether there's stuff + * in it that hasn't yet been saved to a permanent file. + * @param cf cfile_t for the capture file in question */ -void set_toolbar_for_unsaved_capture_file(gboolean have_unsaved_capture_file); +void set_toolbar_for_capture_file(capture_file *cf); /** We have (or don't have) a capture in progress now. * diff --git a/ui/gtk/new_packet_list.c b/ui/gtk/new_packet_list.c index 394320e01d..e6e6fbf0d9 100644 --- a/ui/gtk/new_packet_list.c +++ b/ui/gtk/new_packet_list.c @@ -1752,8 +1752,8 @@ new_packet_list_update_packet_comment(gchar *new_packet_comment) g_free(record->fdata->opt_comment); record->fdata->opt_comment = new_packet_comment; - /* Mark the file as unsaved */ - cfile.user_saved = FALSE; + /* Mark the file as having unsaved changes */ + cfile.unsaved_changes = TRUE; set_menus_for_capture_file(&cfile); new_packet_list_queue_draw(); diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index 690eee669c..bf0ba04f96 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -144,8 +144,8 @@ summary_comment_text_buff_save_cb(GtkWidget *w _U_, GtkWidget *view) /*g_warning("The new comment is '%s'",new_packet_comment);*/ summary_update_comment(&cfile, new_comment); - /* Mark the file as unsaved, caues a popup asking to save the file if we quit the file */ - cfile.user_saved = FALSE; + /* Mark the file as having unsaved changes; this causes a popup asking to save the file if we quit the file */ + cfile.unsaved_changes = TRUE; set_menus_for_capture_file(&cfile); } -- cgit v1.2.1