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 --- file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'file.c') 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? -- cgit v1.2.3