[Xfce4-commits] <xfce4-power-manager:eric/bugzilla-patches> Fix status icon for devices other than battery and ups (Bug 8188)

Eric Koegel noreply at xfce.org
Sun Jan 19 07:54:01 CET 2014


Updating branch refs/heads/eric/bugzilla-patches
         to 9cae533cfd76113651330811c73f54691608aab4 (commit)
       from 4549373bdd56d42892cdda414b655e4a0b853a6c (commit)

commit 9cae533cfd76113651330811c73f54691608aab4
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sun Jan 19 09:44:31 2014 +0300

    Fix status icon for devices other than battery and ups (Bug 8188)
    
    xfpm_battery_refresh_icon incorrectly adds an additional dash to
    the icon prefix when the device is not a battery or a ups.
    
    Additionally, this patch correctly shows the icon when the device
    reports that it is charging.
    
    This patch only combines the patches submitted by
    Daniel Schubert and Dean Montgomery.

 src/xfpm-battery.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c
index 2e0e504..31576d6 100644
--- a/src/xfpm-battery.c
+++ b/src/xfpm-battery.c
@@ -320,20 +320,22 @@ xfpm_battery_refresh_icon (XfpmBattery *battery)
     {
 	if ( !battery->priv->present || battery->priv->state == XFPM_DEVICE_STATE_EMPTY )
 	{
-	    g_snprintf (icon_name, 128, "%s-000", battery->priv->icon_prefix);
+	    g_snprintf (icon_name, 128, "%s000", battery->priv->icon_prefix);
 	}
 	else if ( battery->priv->state == XFPM_DEVICE_STATE_FULLY_CHARGED )
 	{
-	    g_snprintf (icon_name, 128, "%s-100", battery->priv->icon_prefix);
+	    g_snprintf (icon_name, 128, "%s100", battery->priv->icon_prefix);
 	}
-	else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING )
+	else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING || battery->priv->state == XFPM_DEVICE_STATE_CHARGING )
 	{
-	    g_snprintf (icon_name, 128, "%s-%s",
+	    g_snprintf (icon_name, 128, "%s%s",
 			battery->priv->icon_prefix,
 			xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage));
 	}
     }
 
+    XFPM_DEBUG ("Battery icon %s", icon_name);
+
     gtk_status_icon_set_from_icon_name (GTK_STATUS_ICON (battery), icon_name);
 }
 


More information about the Xfce4-commits mailing list