From 10e417e82e30b653aa1f75719a7dbcbea502a1af Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 2 Feb 2009 04:15:17 +0000 Subject: [PATCH] Add Linux support for determining the interface icon; this depends on a 2.6 kernel feature, but it will just pick the default icon if that feature doesn't work. svn path=/trunk/; revision=27350 --- gtk/capture_if_dlg.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gtk/capture_if_dlg.c b/gtk/capture_if_dlg.c index ad5d7fb559..13725d0cd8 100644 --- a/gtk/capture_if_dlg.c +++ b/gtk/capture_if_dlg.c @@ -32,6 +32,11 @@ #include +#ifdef __linux__ +#include +#include +#endif + #include #include "../globals.h" @@ -68,7 +73,7 @@ #include "../image/toolbar/modem_16.xpm" #endif -#if defined(_WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) #include "../image/toolbar/network_wireless_16.xpm" #endif #include "../image/toolbar/network_wired_16.xpm" @@ -414,6 +419,21 @@ GtkWidget * capture_get_if_icon(const if_info_t* if_info _U_) if ( strncmp(if_info->name,"vmnet",5) == 0) { return xpm_to_widget(network_wireless_16_xpm); } +#elif defined(__linux__) + /* + * Look for /sys/class/net/{device}/wireless. + */ + struct stat statb; + char *wireless_path; + + wireless_path = g_strdup_printf("/sys/class/net/%s/wireless", if_info->name); + if (wireless_path != NULL) { + if (stat(wireless_path, &statb) == 0) { + free(wireless_path); + return xpm_to_widget(network_wireless_16_xpm); + } + free(wireless_path); + } #endif return xpm_to_widget(network_wired_16_xpm);