[Goodies-commits] r7184 - in xfce4-power-manager/trunk: . src

Ali Abdallah aliov at xfce.org
Mon Apr 13 21:23:48 CEST 2009


Author: aliov
Date: 2009-04-13 19:23:47 +0000 (Mon, 13 Apr 2009)
New Revision: 7184

Modified:
   xfce4-power-manager/trunk/ChangeLog
   xfce4-power-manager/trunk/src/xfpm-battery.c
Log:
Fix icon refreshing, it should fix bug 5221

Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog	2009-04-13 17:39:06 UTC (rev 7183)
+++ xfce4-power-manager/trunk/ChangeLog	2009-04-13 19:23:47 UTC (rev 7184)
@@ -1,4 +1,7 @@
 
+2009-04-13 21:23 Ali aliov at xfce.org 
+	 * : Fix icon refreshing, it should fix bug 5221
+
 2009-04-12 22:54 Ali aliov at xfce.org 
 	 * : Provide the possibility to disable brightness control on key press by setting a xfconf property
 

Modified: xfce4-power-manager/trunk/src/xfpm-battery.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-battery.c	2009-04-13 17:39:06 UTC (rev 7183)
+++ xfce4-power-manager/trunk/src/xfpm-battery.c	2009-04-13 19:23:47 UTC (rev 7184)
@@ -155,8 +155,6 @@
 static void
 xfpm_battery_refresh_icon (XfpmBattery *battery, 
 			   gboolean is_present,
-			   gboolean is_charging, 
-			   gboolean is_discharging,
 			   guint percentage
 			   )
 {
@@ -166,42 +164,41 @@
 				 battery->priv->type == HAL_DEVICE_TYPE_UPS ? "gpm-ups-missing" : "gpm-primary-missing");
 	return;
     }
+    
     /* Battery full */
-    if ( !is_charging && !is_discharging )
+    if ( battery->priv->state == BATTERY_FULLY_CHARGED )
     {
 	if ( battery->priv->type == HAL_DEVICE_TYPE_PRIMARY)
-	    xfpm_tray_icon_set_icon (battery->priv->icon,
-				     "gpm-primary-charged");
+	    xfpm_tray_icon_set_icon (battery->priv->icon, battery->priv->adapter_present ? "gpm-primary-charged" : "gpm-primary-100");
 	else
 	{
 	    gchar *icon = g_strdup_printf("%s%s", 
 	    			          battery->priv->icon_prefix, 
-	    			          xfpm_battery_get_icon_index(battery->priv->type, percentage));
+	    			          xfpm_battery_get_icon_index (battery->priv->type, percentage));
 	    xfpm_tray_icon_set_icon (battery->priv->icon, icon);
 	    g_free(icon);
 	}
-	return;
     }
-    
-    if ( is_charging )
+    else if ( battery->priv->state == BATTERY_IS_CHARGING || battery->priv->state == BATTERY_NOT_FULLY_CHARGED )
     {
 	gchar *icon = g_strdup_printf("%s%s-%s",
 				      battery->priv->icon_prefix, 
-	    			      xfpm_battery_get_icon_index(battery->priv->type, percentage),
+	    			      xfpm_battery_get_icon_index (battery->priv->type, percentage),
 				      "charging");
+				      
 	xfpm_tray_icon_set_icon (battery->priv->icon, icon);
 	g_free(icon);
-	return;
     }
-    
-    if ( is_discharging )
+    else if ( battery->priv->state == BATTERY_IS_DISCHARGING || battery->priv->state == BATTERY_CHARGE_CRITICAL ||
+	      battery->priv->state == BATTERY_CHARGE_LOW )
     {
 	gchar *icon = g_strdup_printf("%s%s",
 				      battery->priv->icon_prefix, 
-	    			      xfpm_battery_get_icon_index(battery->priv->type, percentage));
+	    			      xfpm_battery_get_icon_index (battery->priv->type, percentage));
+				      
 	xfpm_tray_icon_set_icon (battery->priv->icon, icon);
 	g_free(icon);
-	return;
+	
     }
 }
 
@@ -420,7 +417,6 @@
 		  "time", &time,
 		  NULL);
     
-    xfpm_battery_refresh_icon (battery, is_present, is_charging, is_discharging, percentage);
     battery->priv->type == HAL_DEVICE_TYPE_PRIMARY ?
 			   xfpm_battery_refresh_tooltip_primary (battery, is_present, 
 								 is_charging, is_discharging, 
@@ -431,7 +427,8 @@
 								 is_charging, is_discharging, 
 								 last_full, current_charge,
 								 percentage, time);
-     xfpm_battery_refresh_visible_icon (battery);
+    xfpm_battery_refresh_icon (battery, is_present, percentage);
+    xfpm_battery_refresh_visible_icon (battery);
 }
 
 static void




More information about the Goodies-commits mailing list