Wireshark-dev: [Wireshark-dev] Interface list dialog

From: Carlos G Mendioroz <tron@xxxxxxxxxxx>
Date: Tue, 26 May 2009 09:16:28 -0300
Hi,
a while back I opened a bug regarding the if dialog not using/showing
the user comment, which results in a painful search for those like me
with multiport NICs on windows.

Finally I did what I should have done, fix the code and while trying to
upload the patch, I faced 2 problems:
-I can not find my old bug
-I found another (newer) bug for the same (3414).

The patch is very short, just borrowing the code from the main_welcome
interface list:

--- gtk/capture_if_dlg.c	2009-02-27 15:59:03.000000000 -0200
+++ ../wireshark-1.1.3/gtk/capture_if_dlg.c	2009-05-26
08:52:20.140625000 -0300
@@ -507,6 +507,7 @@
   GString       *if_tool_str = g_string_new("");
   const gchar   *addr_str;
   gchar         *tmp_str;
+  gchar         *user_descr;
   if_stat_cache_t *sc;

   if (cap_if_w != NULL) {
@@ -669,10 +670,21 @@
       g_string_append(if_tool_str, "\n");

       /* description */
-      if (if_info->description != NULL)
-        if_dlg_data->descr_lb = gtk_label_new(if_info->description);
-      else
-        if_dlg_data->descr_lb = gtk_label_new("");
+      user_descr = capture_dev_user_descr_find(if_info->name);
+      if (user_descr) {
+#ifndef _WIN32
+        gchar *comment = user_descr;
+        user_descr = g_strdup_printf("%s (%s)", comment, if_info->name);
+        g_free (comment);
+#endif
+        if_dlg_data->descr_lb = gtk_label_new(user_descr);
+        g_free (user_descr);
+      } else {
+          if (if_info->description != NULL)
+            if_dlg_data->descr_lb = gtk_label_new(if_info->description);
+          else
+            if_dlg_data->descr_lb = gtk_label_new("");
+      }
       gtk_misc_set_alignment(GTK_MISC(if_dlg_data->descr_lb), 0.0, 0.5);
       gtk_table_attach_defaults(GTK_TABLE(if_tb),
if_dlg_data->descr_lb, 2, 3, row, row+1);


-- 
Carlos G Mendioroz  <tron@xxxxxxxxxxx>  LW7 EQI  Argentina