[Xfce4-commits] <xfce4-power-manager:eric/bugzilla-patches> xfpm-power-info: add current percentage of batteries
Eric Koegel
noreply at xfce.org
Tue Feb 11 05:00:01 CET 2014
Updating branch refs/heads/eric/bugzilla-patches
to bb1b43e8f608daf05110432f30dd3c4d411470ad (commit)
from 1e2b996f5e9c6da6fd2f6ba1ad5d82a3552adf89 (commit)
commit bb1b43e8f608daf05110432f30dd3c4d411470ad
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"));
More information about the Xfce4-commits
mailing list