On 2011-06-05 20:30, Yves-Alexis Perez wrote:

I traced the code a bit and found function xfpm_battery_refresh_icon()
which looks a bit fishy. It's the function that converts battery
percentage to an icon name.

So you have a tentative fix ready? I can try testing it, I should have a
mostly empty battery and I think force_discharge with laptop plugged
should be safe.

Yup, got a working patch. The bug was just shoddy coding - two if loops with missing final elses and an uninitalizd string icon_name.

Attached simple patch fixes the if clauses and makes sure the string variable is always defined before returning.



- Kim
diff -ruN xfce4-power-manager-1.0.10-orig/src/xfpm-battery.c xfce4-power-manager-1.0.10/src/xfpm-battery.c
--- xfce4-power-manager-1.0.10-orig/src/xfpm-battery.c	2011-02-15 15:58:47.000000000 +0200
+++ xfce4-power-manager-1.0.10/src/xfpm-battery.c	2011-06-05 21:25:42.000000000 +0300
@@ -302,8 +302,7 @@
 			xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage),
 			"charging");
 	}
-	else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING ||
-		  battery->priv->state == XFPM_DEVICE_STATE_PENDING_DISCHARGING)
+	else
 	{
 	    g_snprintf (icon_name, 128, "%s%s", 
 			battery->priv->icon_prefix, 
@@ -320,7 +319,7 @@
 	{
 	    g_snprintf (icon_name, 128, "%s-100", battery->priv->icon_prefix);
 	}
-	else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING )
+	else
 	{
 	    g_snprintf (icon_name, 128, "%s-%s", 
 			battery->priv->icon_prefix, 

Reply via email to