Display the interface comment if defined.
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 18 Apr 2008 14:29:54 +0000 (14:29 +0000)
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 18 Apr 2008 14:29:54 +0000 (14:29 +0000)
On non-win32 also display the interface name.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25114 f5534014-38df-0310-8fa8-9805f1628bb7

capture_ui_utils.c
capture_ui_utils.h
gtk/main_welcome.c

index 0c58a0ccd1cbfc0973649660435f89e03b6a1ebb..be5f9fa65e27ac314526d7f0b6aca94be8e430aa 100644 (file)
@@ -40,7 +40,7 @@
  * Find user-specified capture device description that matches interface
  * name, if any.
  */
-static char *
+char *
 capture_dev_user_descr_find(const gchar *if_name)
 {
        char    *p;
index 8370b31d4a996591b4a9732b59033acd84d8dabe..4093ae4cb200e10ff5180ce1fbb6a6c7325ce624 100644 (file)
  *  GList of available capture interfaces.
  */
 
+/**
+ * Find user-specified capture device description that matches interface
+ * name, if any.
+ */
+char *capture_dev_user_descr_find(const gchar *if_name);
+
 /** Return as descriptive a name for an interface as we can get.
  * If the user has specified a comment, use that.  Otherwise,
  * if get_interface_list() supplies a description, use that,
index a416f4a9e2436b1a401904bfddb38afa90ccd59c..6a116b19d93c4b67f697d78c015dade429751294 100644 (file)
@@ -38,6 +38,7 @@
 #include "capture.h"
 #include "capture-pcap-util.h"
 #include "capture_opts.h"
+#include "capture_ui_utils.h"
 #include "simple_dialog.h"
 #include "wiretap/file_util.h"
 
@@ -435,7 +436,7 @@ welcome_if_panel_new(void)
   gchar         *err_str;
   int           ifs;
   GList         *curr;
-
+  gchar         *descr;
 
   panel_vb = gtk_vbox_new(FALSE, 0);
 
@@ -458,11 +459,22 @@ welcome_if_panel_new(void)
           continue;
       }
 
-    if (if_info->description != NULL)
-        interface_hb = welcome_if_new(if_info->description, &topic_content_bg, g_strdup(if_info->name));
-    else
+      descr = capture_dev_user_descr_find(if_info->name);
+      if (descr) {
+#ifndef _WIN32
+       gchar *comment = descr;
+       descr = g_strdup_printf("%s (%s)", comment, if_info->name);
+       g_free (comment);
+#endif
+       interface_hb = welcome_if_new(descr, &topic_content_bg, g_strdup(if_info->name));
+       g_free (descr);
+      } else if (if_info->description != NULL) {
+       interface_hb = welcome_if_new(if_info->description, &topic_content_bg, g_strdup(if_info->name));
+      } else {
         interface_hb = welcome_if_new(if_info->name, &topic_content_bg, g_strdup(if_info->name));
-    gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2);
+      }
+
+      gtk_box_pack_start(GTK_BOX(panel_vb), interface_hb, FALSE, FALSE, 2);
   }
 
   free_interface_list(if_list);