[Xfce4-commits] [xfce/xfce4-power-manager] 01/03: panel-plugin: Set ac-adapter icon for desktop systems (Bug #13959)

noreply at xfce.org noreply at xfce.org
Sun Nov 19 23:26:02 CET 2017


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

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-power-manager.

commit 560a960e663e43f319e703fb9c8e394829066a42
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Nov 19 22:01:32 2017 +0100

    panel-plugin: Set ac-adapter icon for desktop systems (Bug #13959)
    
    Unfortunately UPower does not differentiate between desktop and laptop
    systems so we decide that it's a desktop if it:
     * is not a UPS
     * does not have a battery
     * does not have a lid
    In this case we show the "ac-adapter" icon for the systray and the
    "ac-adapter-symbolic" icon for the Xfce Panel Plugin.
    
    Before the "battery-missing" icon was shown, which is what UPower
    reports for the display device.
---
 common/xfpm-power-common.c                              |  6 ++++++
 .../power-manager-plugin/power-manager-button.c         | 17 +++--------------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/common/xfpm-power-common.c b/common/xfpm-power-common.c
index cc3c34d..95e64bd 100644
--- a/common/xfpm-power-common.c
+++ b/common/xfpm-power-common.c
@@ -213,6 +213,12 @@ get_device_icon_name (UpClient *upower, UpDevice *device)
         icon_name = g_strdup (XFPM_TABLET_ICON);
     else if ( type == UP_DEVICE_KIND_COMPUTER )
         icon_name = g_strdup (XFPM_COMPUTER_ICON);
+    /* As UPower does not tell us whether a system is a desktop or a laptop we
+       decide this based on whether there is a battery and/or a a lid */
+    else if (!up_client_get_lid_is_present (upower) &&
+             !up_client_get_on_battery (upower) &&
+             g_strcmp0 (upower_icon, "battery-missing-symbolic") == 0)
+        icon_name = g_strdup (XFPM_AC_ADAPTER_ICON);
     else if ( g_strcmp0 (upower_icon, "") != 0 )
         icon_name = g_strndup (upower_icon, icon_base_length);
 
diff --git a/panel-plugins/power-manager-plugin/power-manager-button.c b/panel-plugins/power-manager-plugin/power-manager-button.c
index 9518dc1..2075aa3 100644
--- a/panel-plugins/power-manager-plugin/power-manager-button.c
+++ b/panel-plugins/power-manager-plugin/power-manager-button.c
@@ -491,21 +491,10 @@ power_manager_button_update_device_icon_and_details (PowerManagerButton *button,
         /* update the icon */
         g_free (button->priv->panel_icon_name);
 #ifdef XFCE_PLUGIN
-        g_object_get (device,
-                      "icon-name", &icon_name,
-                      NULL);
-
-        /* ignore empty icon names */
-        if (g_strcmp0(icon_name, "") == 0)
-        {
-            g_free (icon_name);
-            icon_name = NULL;
-        }
-
-        if (icon_name == NULL)
-            icon_name = g_strdup (PANEL_DEFAULT_ICON_SYMBOLIC);
-#endif
+        button->priv->panel_icon_name = g_strdup_printf ("%s-%s", icon_name, "symbolic");
+#else
         button->priv->panel_icon_name = g_strdup (icon_name);
+#endif
         power_manager_button_set_icon (button);
         /* update the tooltip */
         power_manager_button_set_tooltip (button);

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


More information about the Xfce4-commits mailing list