[Xfce4-commits] [xfce/xfce4-power-manager] 01/02: Never use symbolic icons for the systray (Bug #11756)

noreply at xfce.org noreply at xfce.org
Thu Apr 16 09:59:58 CEST 2015


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository xfce/xfce4-power-manager.

commit f6ceafb12f43ab7968455cadefdac48383022820
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Apr 16 08:17:32 2015 +0200

    Never use symbolic icons for the systray (Bug #11756)
    
    and always make sure to have an icon name,
    even if UPower decides not to return one
---
 .../power-manager-plugin/power-manager-button.c    |   42 +++++++++-----------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/panel-plugins/power-manager-plugin/power-manager-button.c b/panel-plugins/power-manager-plugin/power-manager-button.c
index ef9b2ea..1545efc 100644
--- a/panel-plugins/power-manager-plugin/power-manager-button.c
+++ b/panel-plugins/power-manager-plugin/power-manager-button.c
@@ -358,12 +358,13 @@ power_manager_button_device_icon_expose (GtkWidget *img, GdkEventExpose *event,
 static void
 power_manager_button_update_device_icon_and_details (PowerManagerButton *button, UpDevice *device)
 {
-    GList *item;
-    BatteryDevice *battery_device, *display_device;
-    const gchar *object_path = up_device_get_object_path(device);
-    gchar *details, *icon_name, *upower_icon;
-    GdkPixbuf *pix = NULL;
-    guint type = 0;
+    GList          *item;
+    BatteryDevice  *battery_device;
+    BatteryDevice  *display_device;
+    const gchar    *object_path = up_device_get_object_path(device);
+    gchar          *details;
+    gchar          *icon_name;
+    GdkPixbuf      *pix = NULL;
 
     XFPM_DEBUG("entering for %s", object_path);
 
@@ -377,27 +378,21 @@ power_manager_button_update_device_icon_and_details (PowerManagerButton *button,
 
     battery_device = item->data;
 
-    /* hack, this depends on XFPM_DEVICE_TYPE_* being in sync with UP_DEVICE_KIND_* */
-    g_object_get (device,
-                  "kind", &type,
-                  "icon-name", &upower_icon,
-                  NULL);
-
     icon_name = get_device_icon_name (button->priv->upower, device);
     details = get_device_description (button->priv->upower, device);
 
-    if (icon_name)
-    {
-        pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
-                                        icon_name,
-                                        32,
-                                        GTK_ICON_LOOKUP_USE_BUILTIN,
-                                        NULL);
-        g_free (icon_name);
-    }
+    /* If UPower doesn't give us an icon, just use the default */
+    if (icon_name == NULL)
+        icon_name = g_strdup (PANEL_DEFAULT_ICON);
+
+    pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                    icon_name,
+                                    32,
+                                    GTK_ICON_LOOKUP_USE_BUILTIN,
+                                    NULL);
 
     if (battery_device->details)
-	g_free (battery_device->details);
+        g_free (battery_device->details);
     battery_device->details = details;
 
     /* If we had an image before, remove it and the callback */
@@ -412,11 +407,12 @@ power_manager_button_update_device_icon_and_details (PowerManagerButton *button,
         DBG("this is the display device, updating");
         /* it is! update the panel button */
         g_free (button->priv->panel_icon_name);
-        button->priv->panel_icon_name = upower_icon;
+        button->priv->panel_icon_name = g_strdup (icon_name);
         power_manager_button_set_icon (button);
         /* update tooltip */
         power_manager_button_set_tooltip (button);
     }
+    g_free (icon_name);
 
     /* If the menu is being displayed, update it */
     if (button->priv->menu && battery_device->menu_item)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list