From 05fbb4826bcb182cc3895874a15585a96703ce1f Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Fri, 20 Jan 2017 16:05:56 -0800 Subject: Qt: Show merge progress. Add "file merge" callback plumbing. Use it to display "Merging files" in the main statusbar. Make sure we have a usable window pointer when we merge files. Change-Id: I236b6edb30685f0b06703ab8304bc88ae592f83c Reviewed-on: https://code.wireshark.org/review/19716 Reviewed-by: Gerald Combs Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- file.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index b5920fd569..547f2bf48c 100644 --- a/file.c +++ b/file.c @@ -1217,6 +1217,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t *edt, typedef struct _callback_data_t { + gpointer pd_window; gint64 f_len; GTimeVal start_time; progdlg_t *progbar; @@ -1271,7 +1272,7 @@ merge_callback(merge_event event, int num _U_, large file, we might take considerably longer than that standard time in order to get to the next progress bar step). */ if (cb_data->progbar == NULL) { - cb_data->progbar = delayed_create_progress_dlg(NULL, "Merging", "files", + cb_data->progbar = delayed_create_progress_dlg(cb_data->pd_window, "Merging", "files", FALSE, &cb_data->stop_flag, &cb_data->start_time, 0.0f); } @@ -1323,19 +1324,23 @@ merge_callback(merge_event event, int num _U_, cf_status_t -cf_merge_files_to_tempfile(char **out_filenamep, int in_file_count, - char *const *in_filenames, int file_type, - gboolean do_append) +cf_merge_files_to_tempfile(gpointer pd_window, char **out_filenamep, + int in_file_count, char *const *in_filenames, + int file_type, gboolean do_append) { int err = 0; gchar *err_info = NULL; guint err_fileno; merge_result status; merge_progress_callback_t cb; + callback_data_t *cb_data = g_new0(callback_data_t, 1); /* prepare our callback routine */ + cb_data->pd_window = pd_window; cb.callback_func = merge_callback; - cb.data = g_malloc0(sizeof(callback_data_t)); + cb.data = cb_data; + + cf_callback_invoke(cf_cb_file_merge_started, NULL); /* merge the files */ status = merge_files_to_tempfile(out_filenamep, "wireshark", file_type, @@ -1376,6 +1381,8 @@ cf_merge_files_to_tempfile(char **out_filenamep, int in_file_count, g_free(err_info); + cf_callback_invoke(cf_cb_file_merge_finished, NULL); + if (status != MERGE_OK) { /* Callers aren't expected to treat an error or an explicit abort differently - we put up error dialogs ourselves, so they don't -- cgit v1.2.1