ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

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

From: Carlos G Mendioroz <tron@xxxxxxx>
Date: Tue, 26 May 2009 09:40:38 -0300
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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@xxxxxxx>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkob40YACgkQ7qM4U9dTH3/7LACeLt1PeHtkLs7bSIAqZ0UKOOI3
b3UAn0S8oiaujW1wFGot+E8avbk1RZfu
=+5yI
-----END PGP SIGNATURE-----