[network-manager-applet] applet/indicator: use icon names by default



commit 59678db1c7e0b3afbad15356b6936b614dd61cd2
Author: Dan Williams <dcbw redhat com>
Date:   Tue Feb 17 14:31:42 2015 -0600

    applet/indicator: use icon names by default
    
    It seems that many implementations don't support pixmaps at all,
    instead using only the icon-name.  Unfortunately that means that
    these implementations' users loose some valuable information like
    encryption status of the AP, but it's better than showing no
    icon at all.
    
    There are two solutions to this problem:
    
    1) extend dbusmenu to allow multiple icons, which we would use to
    show both the signal bars and a lock icon, much like Mac OS X and
    iOS.  This is preferable.
    
    2) add all possible icon combinations (5 signal bars * 2 encryption
    states).  This is less easy for theme authors to work with and
    means shipping more icons.  Not preferred.  Work on dbusmenu instead.

 src/ap-menu-item.c |    5 +++++
 src/mb-menu-item.c |    8 +++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c
index 6951043..e126172 100644
--- a/src/ap-menu-item.c
+++ b/src/ap-menu-item.c
@@ -135,7 +135,12 @@ update_icon (NMNetworkMenuItem *item, NMApplet *applet)
        }
 
 #ifdef ENABLE_INDICATOR
+#ifdef DBUSMENU_PIXMAP_SUPPORT
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_new_from_pixbuf (icon));
+#else
+       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                      gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU));
+#endif
        /* For some reason we must always re-set always-show after setting the image */
        gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
 #else
diff --git a/src/mb-menu-item.c b/src/mb-menu-item.c
index 216f7b6..6a5ffdc 100644
--- a/src/mb-menu-item.c
+++ b/src/mb-menu-item.c
@@ -194,10 +194,16 @@ nm_mb_menu_item_new (const char *connection_name,
        /* And the strength icon, if we have strength information at all */
        if (enabled && strength) {
                const char *icon_name = mobile_helper_get_quality_icon_name (strength);
-               GdkPixbuf *pixbuf = nma_icon_check_and_load (icon_name, applet);
 
 #ifdef ENABLE_INDICATOR
+#ifdef DBUSMENU_PIXMAP_SUPPORT
+               GdkPixbuf *pixbuf = nma_icon_check_and_load (icon_name, applet);
+
                gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), gtk_image_new_from_pixbuf 
(pixbuf));
+#else
+               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
+                                              gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU));
+#endif
                /* For some reason we must always re-set always-show after setting the image */
                gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
 #else


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