diff options
author | Gerald Combs <gerald@wireshark.org> | 2012-07-19 21:49:52 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2012-07-19 21:49:52 +0000 |
commit | 0da59a005829eb5daf49c6477219a35ac4e73ab3 (patch) | |
tree | 0890e6704f36a03fa1d444d4ad8e25411ec36f34 /ui/gtk | |
parent | bdb0898ff8fccc3a7fba48bd36c8a13899745177 (diff) | |
download | wireshark-0da59a005829eb5daf49c6477219a35ac4e73ab3.tar.gz |
Pass {delayed_}create_progress_dlg a pointer the top level window
so that we can properly associate a widget with create, update, and
destroy events. Only used by Qt so far but it should be easy enough to
add to GTK+.
Rename ui/qt/progress_dialog.{h,cpp} to progress_bar.{h,cpp}. Show a
progress bar in the status bar of the main window instead of creating
a separate dialog. Note that we still need to add a "cancel" mechanism
and display the task and item titles somewhere.
Thus began the War Against Gratuitous Dialogs.
svn path=/trunk/; revision=43833
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/funnel_stat.c | 2 | ||||
-rw-r--r-- | ui/gtk/iax2_analysis.c | 2 | ||||
-rw-r--r-- | ui/gtk/packet_list_store.c | 3 | ||||
-rw-r--r-- | ui/gtk/packet_list_store.h | 2 | ||||
-rw-r--r-- | ui/gtk/progress_dlg.c | 20 | ||||
-rw-r--r-- | ui/gtk/rtp_analysis.c | 2 |
6 files changed, 16 insertions, 15 deletions
diff --git a/ui/gtk/funnel_stat.c b/ui/gtk/funnel_stat.c index b8d4f97771..b4f63350b3 100644 --- a/ui/gtk/funnel_stat.c +++ b/ui/gtk/funnel_stat.c @@ -547,7 +547,7 @@ static gboolean funnel_open_file(const char* fname, const char* filter, const ch typedef struct progdlg _funnel_progress_window_t; static funnel_progress_window_t* funnel_new_progress_window(const gchar* label, const gchar* task, gboolean terminate_is_stop, gboolean *stop_flag) { - return (funnel_progress_window_t*)create_progress_dlg(label, task, terminate_is_stop, stop_flag); + return (funnel_progress_window_t*)create_progress_dlg(top_level, label, task, terminate_is_stop, stop_flag); } static void funnel_update_progress(funnel_progress_window_t* win, float pr, const gchar* task) { diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index 3149b40b11..3fbc73dc8d 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -2318,7 +2318,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * return FALSE; } - progbar = create_progress_dlg("Saving voice in a file", dest, TRUE, &stop_flag); + progbar = create_progress_dlg(top_level, "Saving voice in a file", dest, TRUE, &stop_flag); if (format == SAVE_AU_FORMAT) /* au format */ { diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index 0c82fb4b25..5036b5d6aa 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -839,7 +839,8 @@ packet_list_dissect_and_cache_all(PacketList *packet_list) /* allow certain "interupts" to happen during this code. */ /* (Note that the progress_dlg window is set to "modal" */ /* so that clicking on other windows is disabled). */ - progbar = delayed_create_progress_dlg("Construct", "Columns", + progbar = delayed_create_progress_dlg(gtk_widget_get_window(packet_list->view), + "Construct", "Columns", TRUE, &progbar_stop_flag, &progbar_start_time, progbar_val); diff --git a/ui/gtk/packet_list_store.h b/ui/gtk/packet_list_store.h index 34ce0dfa94..4c5120e3a9 100644 --- a/ui/gtk/packet_list_store.h +++ b/ui/gtk/packet_list_store.h @@ -93,7 +93,7 @@ struct _PacketList gint n_columns; /**< Note: We need one extra column to store the entire PacketListRecord */ GType column_types[NUM_COL_FMTS+1]; - GtkWidget *view; /**< @todo XXX - Does this really belong here?? */ + GtkWidget *view; gint sort_id; GtkSortType sort_order; diff --git a/ui/gtk/progress_dlg.c b/ui/gtk/progress_dlg.c index 8725948001..bb40c21034 100644 --- a/ui/gtk/progress_dlg.c +++ b/ui/gtk/progress_dlg.c @@ -49,7 +49,7 @@ struct progdlg { GtkWidget *dlg_w; /* top-level window widget */ GTimeVal start_time; GTimeVal last_time; /* last time it was updated */ - + GtkLabel *status_lb; GtkLabel *elapsed_lb; GtkLabel *time_left_lb; @@ -83,7 +83,7 @@ struct progdlg { * be read. */ progdlg_t * -create_progress_dlg(const gchar *task_title, const gchar *item_title, +create_progress_dlg(const gpointer top_level_window _U_, const gchar *task_title, const gchar *item_title, gboolean terminate_is_stop, gboolean *stop_flag) { progdlg_t *dlg; @@ -231,9 +231,9 @@ create_progress_dlg(const gchar *task_title, const gchar *item_title, } progdlg_t * -delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title, - gboolean terminate_is_stop, gboolean *stop_flag, - const GTimeVal *start_time, gfloat progress) +delayed_create_progress_dlg(const gpointer top_level_window, const gchar *task_title, + const gchar *item_title, gboolean terminate_is_stop, + gboolean *stop_flag, const GTimeVal *start_time, gfloat progress) { GTimeVal time_now; gdouble delta_time; @@ -289,7 +289,7 @@ delayed_create_progress_dlg(const gchar *task_title, const gchar *item_title, if (progress >= (delta_time / (delta_time + min_display))) return NULL; - dlg = create_progress_dlg(task_title, item_title, terminate_is_stop, + dlg = create_progress_dlg(top_level_window, task_title, item_title, terminate_is_stop, stop_flag); /* @@ -351,21 +351,21 @@ update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *status) /* calculate some timing values */ g_get_current_time(&time_now); - + delta_time = (time_now.tv_sec - dlg->last_time.tv_sec) * 1e6 + time_now.tv_usec - dlg->last_time.tv_usec; /* after the first time don't update more than every 100ms */ - if (dlg->last_time.tv_sec && delta_time < 100*1000) + if (dlg->last_time.tv_sec && delta_time < 100*1000) return; dlg->last_time = time_now; delta_time = (time_now.tv_sec - dlg->start_time.tv_sec) * 1e6 + time_now.tv_usec - dlg->start_time.tv_usec; - + ul_percentage = (gulong) (percentage * 100); ul_elapsed = (gulong) (delta_time / 1000 / 1000); - + /* update labels */ g_snprintf(tmp, sizeof(tmp), "%lu%% of %s", ul_percentage, dlg->title); gtk_window_set_title(GTK_WINDOW(dlg_w), tmp); diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index d987090f34..6733735465 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -2392,7 +2392,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * return FALSE; } - progbar = create_progress_dlg("Saving voice in a file", dest, TRUE, &stop_flag); + progbar = create_progress_dlg(top_level, "Saving voice in a file", dest, TRUE, &stop_flag); if (format == SAVE_AU_FORMAT) /* au format */ { |