On Fri, 2006-01-27 at 10:12 -0600, Jason Martens wrote: > Why is the "Wireless Networks" entry required at all? Isn't it obvious > with the signal meters which ones are wireless and which ones are > wired? Maybe we just need a little network cable icon to go next to the > wired connection to make it more obvious. Sure, it is obvious. But is it stetic? Not sure. It definitely removes a lot of code, though. See attached screenshot and patch. Robert Love
Attachment:
nm-no-wireless-menu.png
Description: PNG image
Index: gnome/applet/applet.c =================================================================== RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet.c,v retrieving revision 1.101 diff -u -r1.101 applet.c --- gnome/applet/applet.c 26 Jan 2006 21:08:42 -0000 1.101 +++ gnome/applet/applet.c 27 Jan 2006 18:50:00 -0000 @@ -1525,24 +1525,7 @@ case DEVICE_TYPE_802_11_WIRELESS: { - NMWirelessMenuItem *item; - GtkMenuItem *gtk_item; - - if (!applet->wireless_enabled) - break; - - item = wireless_menu_item_new (); - gtk_item = wireless_menu_item_get_item (item); - - wireless_menu_item_update (item, device, n_devices); - - g_object_set_data (G_OBJECT (gtk_item), "device", g_strdup (network_device_get_nm_path (device))); - g_object_set_data (G_OBJECT (gtk_item), "nm-item-data", item); - g_signal_connect(G_OBJECT (gtk_item), "activate", G_CALLBACK (nmwa_menu_item_activate), applet); - - gtk_menu_shell_append (GTK_MENU_SHELL (menu), GTK_WIDGET (gtk_item)); - gtk_widget_show (GTK_WIDGET (gtk_item)); - break; + /* We do not do anything for wireless devices. We will add the networks separately, later. */ } default: Index: gnome/applet/menu-items.c =================================================================== RCS file: /cvs/gnome/NetworkManager/gnome/applet/menu-items.c,v retrieving revision 1.12 diff -u -r1.12 menu-items.c --- gnome/applet/menu-items.c 29 Dec 2005 16:54:34 -0000 1.12 +++ gnome/applet/menu-items.c 27 Jan 2006 18:50:00 -0000 @@ -100,74 +100,6 @@ /**************************************************************** - * Wireless menu item - ****************************************************************/ - -struct NMWirelessMenuItem -{ - GtkMenuItem *menu_item; - GtkLabel *label; -}; - - -static gboolean label_expose (GtkWidget *widget) -{ - /* Bad hack to make the label draw normally, instead of insensitive. */ - widget->state = GTK_STATE_NORMAL; - - return FALSE; -} - -NMWirelessMenuItem *wireless_menu_item_new (void) -{ - NMWirelessMenuItem *item = g_malloc0 (sizeof (NMWirelessMenuItem)); - - item->menu_item = GTK_MENU_ITEM (gtk_menu_item_new ()); - - /* Make sure it looks slightly different if the label determines the width of the widget */ - item->label = GTK_LABEL (gtk_label_new (NULL)); - gtk_misc_set_padding (GTK_MISC (item->label), 6, 0); - g_signal_connect (G_OBJECT (item->label), "expose-event", G_CALLBACK (label_expose), NULL); - - gtk_container_add (GTK_CONTAINER (item->menu_item), GTK_WIDGET (item->label)); - gtk_widget_show (GTK_WIDGET (item->label)); - - gtk_widget_set_sensitive (GTK_WIDGET (item->menu_item), FALSE); - - return item; -} - -GtkMenuItem *wireless_menu_item_get_item (NMWirelessMenuItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - - return item->menu_item; -} - -void wireless_menu_item_update (NMWirelessMenuItem *item, NetworkDevice *dev, const gint n_devices) -{ - char *text; - const char *dev_name; - gint n_essids; - - g_return_if_fail (dev != NULL); - g_return_if_fail (item != NULL); - g_assert (network_device_is_wireless (dev)); - - n_essids = network_device_get_num_wireless_networks (dev); - dev_name = network_device_get_desc (dev) ? network_device_get_desc (dev) : network_device_get_iface (dev); - - if (n_devices > 1) - text = g_strdup_printf (ngettext ("Wireless Network (%s)", "Wireless Networks (%s)", n_essids), dev_name); - else - text = g_strdup (ngettext ("Wireless Network", "Wireless Networks", n_essids)); - - gtk_label_set_markup (GTK_LABEL (item->label), text); - g_free (text); -} - - -/**************************************************************** * Wireless Network menu item ****************************************************************/ Index: gnome/applet/menu-items.h =================================================================== RCS file: /cvs/gnome/NetworkManager/gnome/applet/menu-items.h,v retrieving revision 1.1 diff -u -r1.1 menu-items.h --- gnome/applet/menu-items.h 27 Apr 2005 18:05:02 -0000 1.1 +++ gnome/applet/menu-items.h 27 Jan 2006 18:50:00 -0000 @@ -27,17 +27,12 @@ typedef struct NMWiredMenuItem NMWiredMenuItem; -typedef struct NMWirelessMenuItem NMWirelessMenuItem; typedef struct NMNetworkMenuItem NMNetworkMenuItem; NMWiredMenuItem *wired_menu_item_new (void); GtkCheckMenuItem *wired_menu_item_get_check_item (NMWiredMenuItem *item); void wired_menu_item_update (NMWiredMenuItem *item, NetworkDevice *dev, const gint n_devices); - -NMWirelessMenuItem *wireless_menu_item_new (void); -GtkMenuItem *wireless_menu_item_get_item (NMWirelessMenuItem *item); -void wireless_menu_item_update (NMWirelessMenuItem *item, NetworkDevice *dev, const gint n_devices); NMNetworkMenuItem *network_menu_item_new (GtkSizeGroup *encryption_size_group); GtkCheckMenuItem *network_menu_item_get_check_item (NMNetworkMenuItem *item);