Update the packets bar periodically when loading a (large) file.

Update the packet bar each time we update the progress bar:
  1) in the Qt UI
  2) (and) in the Gtk UI if auto_scroll_live wasn't set
  3) (and) even if we don't HAVE_LIBPCAP

This allows the user to watch the number of packets increasing.

(Extracted from I02c46b086f34a026b7980458f2a93d0d70cac23b.)

Change-Id: I47a7a2b0dc6da50035098ab0b0eb0d55f7484960
Reviewed-on: https://code.wireshark.org/review/12459
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jeff Morriss 2015-12-06 21:52:29 -05:00 committed by Anders Broman
parent 7e06334a87
commit 3ba0e88bb8
1 changed files with 2 additions and 22 deletions

24
file.c
View File

@ -567,9 +567,6 @@ cf_read(capture_file *cf, gboolean reloading)
epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
TRY {
#ifdef HAVE_LIBPCAP
int displayed_once = 0;
#endif
int count = 0;
gint64 size;
@ -626,15 +623,8 @@ cf_read(capture_file *cf, gboolean reloading)
if (progbar != NULL) {
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
/* update the packet bar content on the first run or frequently on very large files */
#ifdef HAVE_LIBPCAP
if (progbar_quantum > 500000 || displayed_once == 0) {
if ((auto_scroll_live || displayed_once == 0 || cf->displayed_count < 1000) && cf->count != 0) {
displayed_once = 1;
packets_bar_update();
}
}
#endif /* HAVE_LIBPCAP */
update_progress_dlg(progbar, progbar_val, status_str);
packets_bar_update();
}
progbar_nextstep += progbar_quantum;
}
@ -4138,9 +4128,6 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
guint32 framenum;
frame_data *fdata;
int count = 0;
#ifdef HAVE_LIBPCAP
int displayed_once = 0;
#endif
/* Close the old handle. */
wtap_close(cf->wth);
@ -4236,15 +4223,8 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
if (progbar != NULL) {
progbar_val = calc_progbar_val(cf, size, cf->f_datalen, status_str, sizeof(status_str));
/* update the packet bar content on the first run or frequently on very large files */
#ifdef HAVE_LIBPCAP
if (progbar_quantum > 500000 || displayed_once == 0) {
if ((auto_scroll_live || displayed_once == 0 || cf->displayed_count < 1000) && cf->count != 0) {
displayed_once = 1;
packets_bar_update();
}
}
#endif /* HAVE_LIBPCAP */
update_progress_dlg(progbar, progbar_val, status_str);
packets_bar_update();
}
progbar_nextstep += progbar_quantum;
}