aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-01-20 16:05:56 -0800
committerAnders Broman <a.broman58@gmail.com>2017-01-21 06:50:30 +0000
commit05fbb4826bcb182cc3895874a15585a96703ce1f (patch)
tree448763b393a9ba79c49df7d98c94a77a9e05849d /file.c
parent317649f94984cf3d17f2a57badebb78d7703cdb5 (diff)
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 <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'file.c')
-rw-r--r--file.c17
1 files changed, 12 insertions, 5 deletions
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