From 8e130440e5002e70c9f69c6b36dd56f691d36430 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 27 Apr 2012 11:38:59 +0200 Subject: [PATCH 2/2] 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. --- 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 e365da9..92d6f0f 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")); -- 1.7.9.2