[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Only use batteries for current charge state that are used for power supply

noreply at xfce.org noreply at xfce.org
Fri Aug 29 18:07:29 CEST 2014


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

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

commit 6ca832f368171ddb722f9f940462e9a1b0077601
Author: Harald Judt <h.judt at gmx.at>
Date:   Thu Aug 7 14:55:15 2014 +0200

    Only use batteries for current charge state that are used for power supply
    
    See http://upower.freedesktop.org/docs/Device.html#Device:PowerSupply
---
 src/xfpm-power.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/xfpm-power.c b/src/xfpm-power.c
index 5535f77..e428a15 100644
--- a/src/xfpm-power.c
+++ b/src/xfpm-power.c
@@ -468,22 +468,25 @@ xfpm_power_get_current_charge_state (XfpmPower *power)
 {
     GList *list;
     guint len, i;
+    gboolean power_supply;
     XfpmBatteryCharge max_charge_status = XFPM_BATTERY_CHARGE_UNKNOWN;
 
     list = g_hash_table_get_values (power->priv->hash);
     len = g_list_length (list);
 
-    for ( i = 0; i < len; i++)
+    for ( i = 0; i < len; i++ )
     {
 	XfpmBatteryCharge battery_charge;
 	UpDeviceKind type;
 
 	g_object_get (G_OBJECT (g_list_nth_data (list, i)),
-		      "charge-status", &battery_charge,
-		      "device-type", &type,
-		      NULL);
+                  "charge-status", &battery_charge,
+                  "device-type", &type,
+                  "power-supply", &power_supply,
+                  NULL);
 	if ( type != UP_DEVICE_KIND_BATTERY &&
-	     type != UP_DEVICE_KIND_UPS )
+	     type != UP_DEVICE_KIND_UPS &&
+	     power_supply != TRUE)
 	    continue;
 
 	max_charge_status = MAX (max_charge_status, battery_charge);

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


More information about the Xfce4-commits mailing list