diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-04-01 23:44:29 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-04-01 23:44:29 +0000 |
commit | d94275940164f0b40d12d1caa709b113360491c2 (patch) | |
tree | c2db98b41c1d80160f286af62b5d94f6959359c7 /ui/gtk/capture_file_dlg.c | |
parent | f8965b7b2cddad13ca785b283dc05d59c3af2438 (diff) |
Add routines to file.c to indicate whether:
a save can be done ("can" in the sense of "there's something to
save" and in the sense of "we can write that something out");
a "save as" can be done (in the sense of "we can write what we
have out");
there's unsaved data to save (which might be unsaved changes or
might be a temporary file full of packets);
and use them as appropriate. This means that the "unsaved data"
indicator in the UI will be turned on for temporary files full of
packets as well as for files with unsaved changes; that's what we want.
svn path=/trunk/; revision=48693
Diffstat (limited to 'ui/gtk/capture_file_dlg.c')
-rw-r--r-- | ui/gtk/capture_file_dlg.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index cabbd712e3..2b460159c5 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -1027,9 +1027,9 @@ file_merge_cmd_cb(GtkWidget *widget, gpointer data _U_) { gint response; if (prefs.gui_ask_unsaved) { - if (cfile.is_tempfile || cfile.unsaved_changes) { - /* This is a temporary capture file or has unsaved changes; ask the - user whether to save the capture. */ + if (cf_not_saved(&cfile)) { + /* This file has unsaved data; ask the user whether to save the + capture. */ if (cfile.is_tempfile) { msg_dialog = gtk_message_dialog_new(GTK_WINDOW(top_level), (GtkDialogFlags)(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), @@ -1135,10 +1135,9 @@ test_file_close(capture_file *cf, gboolean from_quit, const char *before_what) capture_in_progress = FALSE; if (prefs.gui_ask_unsaved) { - if (cf->is_tempfile || capture_in_progress || cf->unsaved_changes) { - /* This is a temporary capture file, or there's a capture in - progress, or the file has unsaved changes; ask the user whether - to save the data. */ + if (cf_not_saved(cf) || capture_in_progress) { + /* This file has unsaved data or there's a capture in progress; + ask the user whether to save the data. */ if (cf->is_tempfile) { msg_dialog = gtk_message_dialog_new(GTK_WINDOW(top_level), (GtkDialogFlags)(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT), |