summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-05-22 03:52:12 +0000
committerGuy Harris <guy@alum.mit.edu>2012-05-22 03:52:12 +0000
commit90c43120ca914ca400e682f9e32e38887cd83269 (patch)
treecea9bd1151a72bef785296474a0e7282eeab6598 /file.c
parentd231102428a43bef635801718838aa406719e5a0 (diff)
downloadwireshark-90c43120ca914ca400e682f9e32e38887cd83269.tar.gz
The GUI's state machine requires that, when reloading a capture after a
save, we post capture file callback events similar to the ones posted when reading a capture - otherwise, the reload will leave the welcome screen up. Rename cf_cb_file_save_reload_finished to cf_cb_file_reload_finished, add a cf_cb_file_reload_started callback, have them work similarly to read_finished and read_started except that the reload uses "Reloading" in the progress bar and status bar. Clean up some indentation while we're at it. svn path=/trunk/; revision=42764
Diffstat (limited to 'file.c')
-rw-r--r--file.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/file.c b/file.c
index 54dbc5f168..360879d376 100644
--- a/file.c
+++ b/file.c
@@ -482,7 +482,7 @@ calc_progbar_val(capture_file *cf, gint64 size, gint64 file_pos, gchar *status_s
}
cf_read_status_t
-cf_read(capture_file *cf, gboolean from_save)
+cf_read(capture_file *cf, gboolean reloading)
{
int err;
gchar *err_info;
@@ -525,10 +525,10 @@ cf_read(capture_file *cf, gboolean from_save)
name_ptr = get_basename(cf->filename);
- if (from_save == FALSE)
- cf_callback_invoke(cf_cb_file_read_started, cf);
+ if (reloading)
+ cf_callback_invoke(cf_cb_file_reload_started, cf);
else
- cf_callback_invoke(cf_cb_file_save_started, (gpointer)name_ptr);
+ cf_callback_invoke(cf_cb_file_read_started, cf);
/* Find the size of the file. */
size = wtap_file_size(cf->wth, NULL);
@@ -562,11 +562,11 @@ cf_read(capture_file *cf, gboolean from_save)
*/
if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)){
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
- if (from_save == FALSE)
- progbar = delayed_create_progress_dlg("Loading", name_ptr,
+ if (reloading)
+ progbar = delayed_create_progress_dlg("Reloading", name_ptr,
TRUE, &stop_flag, &start_time, progbar_val);
else
- progbar = delayed_create_progress_dlg("Saving", name_ptr,
+ progbar = delayed_create_progress_dlg("Loading", name_ptr,
TRUE, &stop_flag, &start_time, progbar_val);
}
@@ -660,10 +660,10 @@ cf_read(capture_file *cf, gboolean from_save)
cf->current_row = 0;
new_packet_list_thaw();
- if (from_save == FALSE)
- cf_callback_invoke(cf_cb_file_read_finished, cf);
+ if (reloading)
+ cf_callback_invoke(cf_cb_file_reload_finished, cf);
else
- cf_callback_invoke(cf_cb_file_save_finished, cf);
+ cf_callback_invoke(cf_cb_file_read_finished, cf);
/* If we have any displayed packets to select, select the first of those
packets by making the first row the selected row. */
@@ -3975,7 +3975,6 @@ cf_save(capture_file *cf, const char *fname, packet_range_t *range, guint save_f
correctly for the "no capture file open" state). */
break;
}
- cf_callback_invoke(cf_cb_file_save_reload_finished, cf);
}
}
return CF_OK;
@@ -4204,7 +4203,7 @@ cf_reload(capture_file *cf) {
is_tempfile = cf->is_tempfile;
cf->is_tempfile = FALSE;
if (cf_open(cf, filename, is_tempfile, &err) == CF_OK) {
- switch (cf_read(cf, FALSE)) {
+ switch (cf_read(cf, TRUE)) {
case CF_READ_OK:
case CF_READ_ERROR: