From d4bfa9c43b05ccbdef212f55fb56b73a5033e5f6 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 5 Apr 2015 16:42:35 -0700 Subject: Have a common routine for constructing strings listing interfaces. We have a bunch of duplicated code to make those lists; make a common routine for that. (dumpcap currently doesn't use it, as the routine in question uses a routine in libui, which dumpcap doesn't use. We should probably fix that.) Change-Id: I9058bf3320d420b8713e90743618972da1d1c6ed Reviewed-on: https://code.wireshark.org/review/7934 Reviewed-by: Guy Harris --- ui/gtk/capture_info_dlg.c | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) (limited to 'ui/gtk/capture_info_dlg.c') diff --git a/ui/gtk/capture_info_dlg.c b/ui/gtk/capture_info_dlg.c index 63158944f2..a3b392c0c8 100644 --- a/ui/gtk/capture_info_dlg.c +++ b/ui/gtk/capture_info_dlg.c @@ -118,7 +118,6 @@ capture_info_ui_create(capture_info *cinfo, capture_session *cap_session) capture_info_ui_t *info; gchar *cap_w_title; gchar *title_iface; - gchar *descr; GString *str; info = g_new0(capture_info_ui_t,1); @@ -152,42 +151,10 @@ capture_info_ui_create(capture_info *cinfo, capture_session *cap_session) info->counts[13].value_ptr = &(cinfo->counts->i2c_data); /* - * Create the dialog window, with a title that includes the interface. - * - * If we have a descriptive name for the interface, show that, - * rather than its raw name. On NT 5.x (2K/XP/Server2K3), the - * interface name is something like "\Device\NPF_{242423..." - * which is pretty useless to the normal user. On other platforms, - * it might be less cryptic, but if a more descriptive name is - * available, we should still use that. + * Create the dialog window, with a title that includes the interfaces + * on which we're capturing. */ - str = g_string_new(""); -#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); - descr = get_interface_descriptive_name(interface_opts.name); - if (i > 0) { - if (capture_opts->ifaces->len > 2) { - g_string_append_printf(str, ","); - } - g_string_append_printf(str, " "); - if (i == capture_opts->ifaces->len - 1) { - g_string_append_printf(str, "and "); - } - } - g_string_append_printf(str, "%s", descr); - g_free(descr); - } - } else { - g_string_append_printf(str, "%u interfaces", capture_opts->ifaces->len); - } + str = get_iface_list_string(capture_opts, 0); title_iface = g_strdup_printf("Wireshark: Capture from %s", str->str); g_string_free(str, TRUE); cap_w_title = create_user_window_title(title_iface); -- cgit v1.2.1