summaryrefslogtreecommitdiff
path: root/ui/gtk/main_toolbar.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-01 23:44:29 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-01 23:44:29 +0000
commitd94275940164f0b40d12d1caa709b113360491c2 (patch)
treec2db98b41c1d80160f286af62b5d94f6959359c7 /ui/gtk/main_toolbar.c
parentf8965b7b2cddad13ca785b283dc05d59c3af2438 (diff)
downloadwireshark-d94275940164f0b40d12d1caa709b113360491c2.tar.gz
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/main_toolbar.c')
-rw-r--r--ui/gtk/main_toolbar.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/ui/gtk/main_toolbar.c b/ui/gtk/main_toolbar.c
index 2abec2bea0..5d11fe9d86 100644
--- a/ui/gtk/main_toolbar.c
+++ b/ui/gtk/main_toolbar.c
@@ -105,26 +105,15 @@ void set_toolbar_for_capture_file(capture_file *cf) {
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*/
+ do with the file. */
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" if and 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).
-
- Enable "Close" and "Reload". */
- gtk_widget_set_sensitive(GTK_WIDGET(save_button),
- (cf->unsaved_changes && cf_can_write_with_wiretap(cf)) ||
- (cf->is_tempfile && !cf->unsaved_changes));
+ Enable "Save" if and only if we have something to save and
+ can do so. Enable "Close" and "Reload" unconditionally. */
+ gtk_widget_set_sensitive(GTK_WIDGET(save_button), cf_can_save(cf));
gtk_widget_set_sensitive(GTK_WIDGET(close_button), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(reload_button), TRUE);
}