From ee8b5c358d78aec969719b322b46f7b9dc2ab7d6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 27 Apr 2012 11:03:17 +0200 Subject: [PATCH 1/2] xfpm-battery: do not show an icon for HID devices my bluetooth mouse always shows up as a second battery which is not too useful -- ignore devices starting with "hid-" TODO: check if this affects UPSs. --- src/xfpm-battery.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c index 34a1da1..9404477 100644 --- a/src/xfpm-battery.c +++ b/src/xfpm-battery.c @@ -606,10 +606,25 @@ static void xfpm_battery_changed_cb (DBusGProxy *proxy, XfpmBattery *battery) { GHashTable *props; - + GValue *value; + const gchar *cstr; + const gchar *p; + props = xfpm_power_get_interface_properties (battery->priv->proxy_prop, UPOWER_IFACE_DEVICE); + value = g_hash_table_lookup (props, "NativePath"); + if ( value ) + { + cstr = g_value_get_string (value); + p = strrchr (cstr, '/'); + if ( p && (strncmp( p, "/hid-", 5 ) == 0) ) + { + XFPM_DEBUG("Ignoring battery '%s' - is a HID device\n", cstr); + return; + } + } + if ( props ) xfpm_battery_refresh (battery, props); } -- 1.7.9.2