diff --git a/ChangeLog b/ChangeLog index 4f428ee374..664ae2738c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-12-15 Robert Love + + * gnome/applet/menu-items.c: A new icon, "network-wireless-encrypted" + is being added to the icon naming spec, so let's use that (Tango CVS + has the icon). Because it is new, however, we fall back to the + current "gnome-lockscreen" if the new icon is not around, thus + behavior is the same. + * gnome/applet/applet.c: Remove setup_stock(). We do not need the + factory junk. + 2005-12-15 Robert Love * src/gnome/applet.c: Don't show the 'Help' menu item until we have, diff --git a/gnome/applet/applet.c b/gnome/applet/applet.c index 86ea8e2e67..b9cdfd8f1d 100644 --- a/gnome/applet/applet.c +++ b/gnome/applet/applet.c @@ -69,7 +69,6 @@ #endif static GObject * nmwa_constructor (GType type, guint n_props, GObjectConstructParam *construct_props); -static void setup_stock (void); static gboolean nmwa_icons_init (NMWirelessApplet *applet); static void nmwa_icons_free (NMWirelessApplet *applet); static void nmwa_about_cb (NMWirelessApplet *applet); @@ -126,7 +125,6 @@ static void nmwa_init (NMWirelessApplet *applet) applet->animation_step = 0; glade_gnome_init (); - setup_stock (); if (!nmwa_icons_init (applet)) return; @@ -2393,28 +2391,6 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet) return GTK_WIDGET (applet); } -static void setup_stock (void) -{ - GtkIconFactory *ifactory; - GtkIconSet *iset; - GtkIconSource *isource; - static gboolean initted = FALSE; - - if (initted) - return; - - ifactory = gtk_icon_factory_new (); - iset = gtk_icon_set_new (); - isource = gtk_icon_source_new (); - - /* we use the lockscreen icon to get a key */ - gtk_icon_source_set_icon_name (isource, "gnome-lockscreen"); - gtk_icon_set_add_source (iset, isource); - gtk_icon_factory_add (ifactory, "gnome-lockscreen", iset); - gtk_icon_factory_add_default (ifactory); - - initted = TRUE; -} static void nmwa_icons_free (NMWirelessApplet *applet) { diff --git a/gnome/applet/menu-items.c b/gnome/applet/menu-items.c index 68974a16f4..973c26bbe9 100644 --- a/gnome/applet/menu-items.c +++ b/gnome/applet/menu-items.c @@ -233,6 +233,7 @@ GtkCheckMenuItem *network_menu_item_get_check_item (NMNetworkMenuItem *item) return item->check_item; } + /* has_encrypted means that the wireless network has an encrypted * area, and thus we need to allow for spacing. */ @@ -255,7 +256,29 @@ void network_menu_item_update (NMNetworkMenuItem *item, WirelessNetwork *network g_object_set (item->security_image, "visible", is_encrypted, NULL); if (wireless_network_get_encrypted (network)) - gtk_image_set_from_stock (GTK_IMAGE (item->security_image), "gnome-lockscreen", GTK_ICON_SIZE_MENU); + { + /* + * We want to use "network-wireless-encrypted," which was recently added to the icon spec, + * but not all themes carry it as of yet. Thus, we fall back to "gnome-lockscreen." + * + * XXX: Would be nice to require gtk-2.6. For now, we have an ugly and a simple version. + */ +#if (GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION < 6) + GdkPixbuf *pixbuf; + GtkIconTheme *icon_theme; + + icon_theme = gtk_icon_theme_get_default (); + pixbuf = gtk_icon_theme_load_icon (icon_theme, "network-wireless-encrypted", GTK_ICON_SIZE_MENU, 0, NULL); + if (!pixbuf) + pixbuf = gtk_icon_theme_load_icon (icon_theme, "gnome-lockscreen", GTK_ICON_SIZE_MENU, 0, NULL); + gtk_image_set_from_pixbuf (GTK_IMAGE (item->security_image), pixbuf); +# else + if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), "network-wireless-encrypted")) + gtk_image_set_from_icon_name (GTK_IMAGE (item->security_image), "network-wireless-encrypted", GTK_ICON_SIZE_MENU); + else + gtk_image_set_from_icon_name (GTK_IMAGE (item->security_image), "gnome-lockscreen", GTK_ICON_SIZE_MENU); +#endif + } else gtk_image_set_from_stock (GTK_IMAGE (item->security_image), NULL, GTK_ICON_SIZE_MENU); }