diff options
-rw-r--r-- | capture.c | 30 | ||||
-rw-r--r-- | capture_ui_utils.c | 16 | ||||
-rw-r--r-- | capture_ui_utils.h | 1 | ||||
-rw-r--r-- | gtk/main.c | 2 |
4 files changed, 45 insertions, 4 deletions
@@ -133,6 +133,7 @@ gboolean capture_start(capture_options *capture_opts) { gboolean ret; + guint i; GString *source = g_string_new(""); if (capture_opts->state != CAPTURE_STOPPED) @@ -144,9 +145,32 @@ capture_start(capture_options *capture_opts) g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Start ..."); - g_string_printf(source, "%s", get_iface_description(capture_opts)); - if(capture_opts->cfilter && capture_opts->cfilter[0]) { - g_string_append_printf(source, " (%s)", capture_opts->cfilter); +#ifdef _WIN32 + if (capture_opts->ifaces->len < 2) { +#else + if (capture_opts->ifaces->len < 4) { +#endif + for (i = 0; i < capture_opts->ifaces->len; i++) { + interface_options interface_opts; + + interface_opts = g_array_index(capture_opts->ifaces, interface_options, i); + if (i > 0) { + if (capture_opts->ifaces->len > 2) { + g_string_append_printf(source, ","); + } + g_string_append_printf(source, " "); + if (i == capture_opts->ifaces->len - 1) { + g_string_append_printf(source, "and "); + } + } + g_string_append_printf(source, "%s", get_iface_description_for_interface(capture_opts, i)); + if ((interface_opts.cfilter != NULL) && + (strlen(interface_opts.cfilter) > 0)) { + g_string_append_printf(source, " (%s)", interface_opts.cfilter); + } + } + } else { + g_string_append_printf(source, "%u interfaces", capture_opts->ifaces->len); } cf_set_tempfile_source(capture_opts->cf, source->str); g_string_free(source, TRUE); diff --git a/capture_ui_utils.c b/capture_ui_utils.c index 15b091ea5d..90b8b435bc 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -408,4 +408,20 @@ get_iface_description(capture_options *capture_opts) return(capture_opts->iface_descr); } + +const char * +get_iface_description_for_interface(capture_options *capture_opts, guint i) +{ + interface_options interface_opts; + + interface_opts = g_array_index(capture_opts->ifaces, interface_options, i); + if (!interface_opts.descr && interface_opts.name) { + interface_opts.descr = get_interface_descriptive_name(interface_opts.name); + } + capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i); + g_array_insert_val(capture_opts->ifaces, i, interface_opts); + + return (interface_opts.descr); +} + #endif /* HAVE_LIBPCAP */ diff --git a/capture_ui_utils.h b/capture_ui_utils.h index e93142c79d..0b50d6b4dc 100644 --- a/capture_ui_utils.h +++ b/capture_ui_utils.h @@ -97,5 +97,6 @@ char *build_capture_combo_name(GList *if_list, gchar *if_name); * @return A pointer to capture_ops->iface_descr */ const char *get_iface_description(capture_options *capture_opts); +const char *get_iface_description_for_interface(capture_options *capture_opts, guint i); #endif diff --git a/gtk/main.c b/gtk/main.c index 35d2e88c23..5fa49b3a94 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1522,7 +1522,7 @@ main_capture_set_main_window_title(capture_options *capture_opts) GString *title = g_string_new(""); g_string_append(title, "Capturing "); - if(capture_opts->iface) { + if (capture_opts->ifaces->len > 0) { g_string_append_printf(title, "from %s ", cf_get_tempfile_source(capture_opts->cf)); } set_main_window_name(title->str); |