forked from osmocom/wireshark
Don't bother with a progress dialog for small Hex windows.
svn path=/trunk/; revision=29646
This commit is contained in:
parent
1925235323
commit
b787bbb334
|
@ -1010,7 +1010,8 @@ void savehex_cb(GtkWidget * w _U_, gpointer data _U_)
|
|||
|
||||
/* Update the progress bar this many times when reading a file. */
|
||||
#define N_PROGBAR_UPDATES 100
|
||||
|
||||
/* The minimum packet length required to check if a progres bar is needed or not */
|
||||
#define MIN_PACKET_LENGTH 1024
|
||||
|
||||
/*
|
||||
* XXX - at least in GTK+ 2.x, this is not fast - in one capture with a
|
||||
|
@ -1076,7 +1077,15 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
|
|||
g_object_set_data(G_OBJECT(bv), E_BYTE_VIEW_NDIGITS_KEY, GUINT_TO_POINTER(use_digits));
|
||||
|
||||
/* Update the progress bar when it gets to this value. */
|
||||
if (len > MIN_PACKET_LENGTH){
|
||||
progbar_nextstep = 0;
|
||||
}else{
|
||||
/* If length =< MIN_PACKET_LENGTH
|
||||
* there is no need to calculate the progress
|
||||
*/
|
||||
progbar_nextstep = len+1;
|
||||
}
|
||||
|
||||
/* When we reach the value that triggers a progress bar update,
|
||||
bump that value by this amount. */
|
||||
progbar_quantum = len/N_PROGBAR_UPDATES;
|
||||
|
@ -1093,7 +1102,7 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
|
|||
longer than the standard time to create it (otherwise, for a
|
||||
large packet, we might take considerably longer than that standard
|
||||
time in order to get to the next progress bar step). */
|
||||
if (progbar == NULL)
|
||||
if ((progbar == NULL) && (len < MIN_PACKET_LENGTH))
|
||||
progbar = delayed_create_progress_dlg("Processing", "Packet Details",
|
||||
TRUE,
|
||||
&progbar_stop_flag,
|
||||
|
@ -1106,13 +1115,13 @@ packet_hex_print_common(GtkWidget *bv, const guint8 *pd, int len, int bstart,
|
|||
to see if there's any pending input from an X server, and doing
|
||||
that for every packet can be costly, especially on a big file. */
|
||||
if (i >= progbar_nextstep) {
|
||||
|
||||
if (progbar != NULL) {
|
||||
/* let's not divide by zero. I should never be started
|
||||
* with count == 0, so let's assert that
|
||||
*/
|
||||
g_assert(len > 0);
|
||||
progbar_val = (gfloat) i / len;
|
||||
|
||||
if (progbar != NULL) {
|
||||
g_snprintf(progbar_status_str, sizeof(progbar_status_str),
|
||||
"%4u of %u bytes", i, len);
|
||||
update_progress_dlg(progbar, progbar_val, progbar_status_str);
|
||||
|
|
Loading…
Reference in New Issue