Skip to content

Commit

Permalink
Display the interface comment if defined.
Browse files Browse the repository at this point in the history
On non-win32 also display the interface name.

svn path=/trunk/; revision=25114
  • Loading branch information
stigbjorlykke committed Apr 18, 2008
1 parent 2f78f01 commit b205017
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion capture_ui_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions capture_ui_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
* 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,
Expand Down
22 changes: 17 additions & 5 deletions gtk/main_welcome.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down

0 comments on commit b205017

Please sign in to comment.