[patch] stop what wireless devices?



I was just playing with NM on a box without any wireless interface, and noticed the context menu had a "Stop All Wireless Devices" menu item. It was fun to click on and off for a few seconds. Then I got bored and decided to write this patch.


? wireless-menu-item.patch
Index: gnome/applet/applet.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet.c,v
retrieving revision 1.43
diff -d -u -p -r1.43 applet.c
--- gnome/applet/applet.c	30 Aug 2005 22:23:42 -0000	1.43
+++ gnome/applet/applet.c	1 Sep 2005 07:11:09 -0000
@@ -2025,12 +2025,30 @@ static GtkWidget *nmwa_dropdown_menu_cre
  */
 static void nmwa_context_menu_update (NMWirelessApplet *applet)
 {
-	GtkWidget *image;	
+	GtkWidget *image;
+	GSList *element;
+	gboolean have_wireless = FALSE;
 
 	g_return_if_fail (applet != NULL);
 	g_return_if_fail (applet->stop_wireless_item != NULL);
 
 	gtk_widget_destroy (applet->stop_wireless_item);
+
+	for (element = applet->device_list; element; element = element->next)
+	{
+		NetworkDevice *dev = (NetworkDevice *)(element->data);
+
+		g_assert (dev);
+
+		if (network_device_get_type (dev) == DEVICE_TYPE_WIRELESS_ETHERNET)
+		{
+			have_wireless = TRUE;
+			break;
+		}
+	}
+
+	if (!have_wireless)
+		return;
 
 	if (applet->wireless_enabled)
 	{


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]