diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-04-06 01:01:03 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-04-06 08:01:28 +0000 |
commit | bfd3d269e2705129c4d7e75c66b9750ba0fbf0bc (patch) | |
tree | 7b72c8e11ae8e8017f849ef015185598d1c15d30 | |
parent | d4bfa9c43b05ccbdef212f55fb56b73a5033e5f6 (diff) |
Show a list of interfaces on the welcome screen when capturing.
In a non-update-list-of-packets-in-real-time capture, once the capture
starts, put up a message on the welcome screen indicating on what
interfaces we're capturing, rather than leaving the "waiting for stuff
to arrive from dumpcap" message up.
Make some routines not used outside main_welcome.c static while we're at
it.
Change-Id: I461dd1333d3fa2b64f20310f7b77b45578f9b40d
Reviewed-on: https://code.wireshark.org/review/7942
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | ui/gtk/main_welcome.c | 33 | ||||
-rw-r--r-- | ui/gtk/main_welcome.h | 15 |
2 files changed, 27 insertions, 21 deletions
diff --git a/ui/gtk/main_welcome.c b/ui/gtk/main_welcome.c index 915d7794ac..688508bdf9 100644 --- a/ui/gtk/main_welcome.c +++ b/ui/gtk/main_welcome.c @@ -134,6 +134,9 @@ static gboolean activate_link_cb(GtkLabel *label _U_, gchar *uri, gpointer user_ #define CAPTURE_HB_BOX_CAPTURE "CaptureHorizontalBoxCapture" #define CAPTURE_HB_BOX_REFRESH "CaptureHorizontalBoxRefresh" +static void +welcome_header_push_msg(const gchar *msg_format, ...) + G_GNUC_PRINTF(1, 2); static GtkWidget * scroll_box_dynamic_new(GtkWidget *child_box, guint max_childs, guint scrollw_y_size) { @@ -381,20 +384,24 @@ welcome_header_new(void) return eb; } +static void +welcome_header_push_msg(const gchar *msg_format, ...) { + va_list ap; + gchar *msg; -void -welcome_header_push_msg(const gchar *msg) { - gchar *msg_copy = g_strdup(msg); + va_start(ap, msg_format); + msg = g_strdup_vprintf(msg_format, ap); + va_end(ap); - status_messages = g_slist_append(status_messages, msg_copy); + status_messages = g_slist_append(status_messages, msg); - welcome_header_set_message(msg_copy); + welcome_header_set_message(msg); gtk_widget_hide(welcome_hb); } -void +static void welcome_header_pop_msg(void) { gchar *msg = NULL; @@ -1503,6 +1510,19 @@ welcome_capture_update_started_cb(capture_session *cap_session _U_) } static void +welcome_capture_fixed_started_cb(capture_session *cap_session) +{ + capture_options *capture_opts = cap_session->capture_opts; + GString *interface_names; + + welcome_header_pop_msg(); + + interface_names = get_iface_list_string(capture_opts, 0); + welcome_header_push_msg("Capturing on %s", interface_names->str); + g_string_free(interface_names, TRUE); +} + +static void welcome_capture_fixed_finished_cb(capture_session *cap_session _U_) { welcome_header_pop_msg(); @@ -1537,6 +1557,7 @@ welcome_capture_callback(gint event, capture_session *cap_session, case(capture_cb_capture_update_finished): break; case(capture_cb_capture_fixed_started): + welcome_capture_fixed_started_cb(cap_session); break; case(capture_cb_capture_fixed_continue): break; diff --git a/ui/gtk/main_welcome.h b/ui/gtk/main_welcome.h index 650bb42dde..0793b30daf 100644 --- a/ui/gtk/main_welcome.h +++ b/ui/gtk/main_welcome.h @@ -47,23 +47,8 @@ void main_welcome_add_recent_capture_file(const char *widget_cf_name, GObject *m /* reload the list of interfaces */ void welcome_if_panel_reload(void); -/** Push a status message into the welcome screen header similar to - * statusbar_push_*_msg(). This hides everything under the header. - * If msg is dynamically allocated, it is up to the caller to free - * it. If msg is NULL, the default message will be shown. - * - * @param msg The message - */ -void welcome_header_push_msg(const gchar *msg); - void welcome_header_set_message(gchar *msg); -/** Pop a status message from the welcome screen. If there are no - * messages on the stack, the default message and the main columns - * will be shown. - */ -void welcome_header_pop_msg(void); - GtkWidget* get_welcome_window(void); void change_interface_selection(gchar* name, gboolean activate); |