[Xfce4-commits] [xfce/xfce4-power-manager] 08/13: xfpm-power-info: add current percentage of batteries

noreply at xfce.org noreply at xfce.org
Tue Apr 8 18:43:02 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 12a6838500c368b6319119172ed1b8a10f044d7c
Author: Stefan Seyfried <seife+obs at b1-systems.com>
Date:   Fri Apr 27 11:38:59 2012 +0200

    xfpm-power-info: add current percentage of batteries
    
    a bluetooth mouse's battery might not have any Energy* properties (all
    zero), but a Percentage property, so it might be useful to show that.
    
    Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
 src/xfpm-power-info.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/xfpm-power-info.c b/src/xfpm-power-info.c
index f0c9e50..a53a6be 100644
--- a/src/xfpm-power-info.c
+++ b/src/xfpm-power-info.c
@@ -410,6 +410,20 @@ xfpm_info_add_device_view (XfpmInfo *info, GHashTable *props, const gchar *objec
 	    i++;
 	}
 	
+	value = g_hash_table_lookup (props, "Percentage");
+
+	if ( value )
+	{
+	    str = g_strdup_printf("%d", (guint) g_value_get_double (value));
+	    gtk_list_store_append (list_store, &iter);
+	    gtk_list_store_set (list_store, &iter,
+				XFPM_DEVICE_INFO_NAME, _("Energy percent"),
+				XFPM_DEVICE_INFO_VALUE, str,
+				-1);
+	    i++;
+	    g_free(str);
+	}
+
 	/* TRANSLATORS: Unit here is What hour*/
 	str = xfpm_info_get_energy_property (props, "EnergyFullDesign", _("Wh"));
 	

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


More information about the Xfce4-commits mailing list