summaryrefslogtreecommitdiff
path: root/ui/gtk/main_toolbar.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-06-25 18:37:52 +0000
committerGuy Harris <guy@alum.mit.edu>2012-06-25 18:37:52 +0000
commitf272aaeb803e7c8e7dd9039cd680e114afbe0319 (patch)
treea120a6fa318d81394118fe232a658a70d045a551 /ui/gtk/main_toolbar.c
parentc96179ed1e6feafbed0f4fbbbc93628aa849692e (diff)
downloadwireshark-f272aaeb803e7c8e7dd9039cd680e114afbe0319.tar.gz
Only allow "Save" if
the file has unsaved changes, and we can save it in some format through Wiretap or the file is a temporary file and has no unsaved changes (so that "saving" it just means copying it). Only allow "Save As" if we can save it in some format through Wiretap or the file is a temporary file and has no unsaved changes (so that "saving" it just means copying it). This means that we don't support using "Save As" for just copying the file unless we can do that with Wiretap; copying the file byte-for-byte only works as "saving" if there are no unsaved changes *and* we're saving it in the same format that it's in *and* we're saving it with the same form of compression (if any) that it has. Rename cf_can_save_as() to cf_can_write_with_wiretap() to better reflect what it really does. svn path=/trunk/; revision=43477
Diffstat (limited to 'ui/gtk/main_toolbar.c')
-rw-r--r--ui/gtk/main_toolbar.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/ui/gtk/main_toolbar.c b/ui/gtk/main_toolbar.c
index 19c7c15d62..a33fd37e50 100644
--- a/ui/gtk/main_toolbar.c
+++ b/ui/gtk/main_toolbar.c
@@ -138,8 +138,21 @@ void set_toolbar_for_capture_file(capture_file *cf) {
g_object_set_data(G_OBJECT(save_button), "save", GINT_TO_POINTER(0));
}
}
+
+ /*
+ * "Save" should be available only if:
+ *
+ * the file has unsaved changes, and we can save it in some
+ * format through Wiretap
+ *
+ * or
+ *
+ * the file is a temporary file and has no unsaved changes (so
+ * that "saving" it just means copying it).
+ */
gtk_widget_set_sensitive(GTK_WIDGET(save_button),
- (cf->is_tempfile || cf->unsaved_changes) && cf_can_save_as(cf));
+ (cf->unsaved_changes && cf_can_write_with_wiretap(cf)) ||
+ (cf->is_tempfile && !cf->unsaved_changes));
gtk_widget_set_sensitive(GTK_WIDGET(close_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(reload_button), TRUE);
}