aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-10-27 06:45:37 +0000
committerGuy Harris <guy@alum.mit.edu>2005-10-27 06:45:37 +0000
commit0203c65739ed0f814daa513731838e722e6b3cfa (patch)
tree6f6114bf89e82abb916114bf11f7cb53eeb20f3e /gtk
parent3e0e3011e28a28944a2ca452921f3162eadc1c5f (diff)
Check on every iteration of a loop whether to pop up a dialog box,
rather than checking only on every progress bar update quantum, so that if the update quantum is *very* large, we don't end up waiting longer than the standard time for a dialog box before checking. svn path=/trunk/; revision=16327
Diffstat (limited to 'gtk')
-rw-r--r--gtk/packet_list.c24
-rw-r--r--gtk/proto_draw.c18
2 files changed, 25 insertions, 17 deletions
diff --git a/gtk/packet_list.c b/gtk/packet_list.c
index a9865f3dbc..ee837faed6 100644
--- a/gtk/packet_list.c
+++ b/gtk/packet_list.c
@@ -633,6 +633,15 @@ packet_list_resize_columns(void) {
main_window_update();
for (i = 0; i < cfile.cinfo.num_cols; i++) {
+ /* Create the progress bar if necessary.
+ We check on every iteration of the loop, so that it takes no
+ longer than the standard time to create it (otherwise, for a
+ large file, we might take considerably longer than that standard
+ time in order to get to the next progress bar step). */
+ if (progbar == NULL)
+ progbar = delayed_create_progress_dlg("Resizing", "Resize Columns",
+ &stop_flag, &start_time, prog_val);
+
if (i >= progbar_nextstep) {
/* let's not divide by zero. I should never be started
* with count == 0, so let's assert that
@@ -641,11 +650,6 @@ packet_list_resize_columns(void) {
prog_val = (gfloat) i / cfile.cinfo.num_cols;
- /* Create the progress bar if necessary */
- if (progbar == NULL)
- progbar = delayed_create_progress_dlg("Resizing", "Resize Columns",
- &stop_flag, &start_time, prog_val);
-
if (progbar != NULL) {
g_snprintf(status_str, sizeof(status_str),
"%u of %u columns (%s)", i+1, cfile.cinfo.num_cols, cfile.cinfo.col_title[i]);
@@ -660,12 +664,12 @@ packet_list_resize_columns(void) {
break;
}
- /* auto resize the current column */
- eth_clist_set_column_auto_resize(ETH_CLIST(packet_list), i, TRUE);
+ /* auto resize the current column */
+ eth_clist_set_column_auto_resize(ETH_CLIST(packet_list), i, TRUE);
- /* the current column should be resizeable by the user again */
- /* (will turn off auto resize again) */
- eth_clist_set_column_resizeable(ETH_CLIST(packet_list), i, TRUE);
+ /* the current column should be resizeable by the user again */
+ /* (will turn off auto resize again) */
+ eth_clist_set_column_resizeable(ETH_CLIST(packet_list), i, TRUE);
}
/* We're done resizing the columns; destroy the progress bar if it
diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c
index f1ece58795..36a4468d92 100644
--- a/gtk/proto_draw.c
+++ b/gtk/proto_draw.c
@@ -1080,6 +1080,17 @@ packet_hex_print_common(GtkTextView *bv, const guint8 *pd, int len, int bstart,
g_get_current_time(&progbar_start_time);
while (i < len) {
+ /* Create the progress bar if necessary.
+ We check on every iteration of the loop, so that it takes no
+ 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)
+ progbar = delayed_create_progress_dlg("Processing", "Packet Details",
+ &progbar_stop_flag,
+ &progbar_start_time,
+ progbar_val);
+
/* Update the progress bar, but do it only N_PROGBAR_UPDATES times;
when we update it, we have to run the GTK+ main loop to get it
to repaint what's pending, and doing so may involve an "ioctl()"
@@ -1092,13 +1103,6 @@ packet_hex_print_common(GtkTextView *bv, const guint8 *pd, int len, int bstart,
g_assert(len > 0);
progbar_val = (gfloat) i / len;
- if (progbar == NULL)
- /* Create the progress bar if necessary */
- progbar = delayed_create_progress_dlg("Processing", "Packet Details",
- &progbar_stop_flag,
- &progbar_start_time,
- progbar_val);
-
if (progbar != NULL) {
g_snprintf(progbar_status_str, sizeof(progbar_status_str),
"%4u of %u bytes", i, len);