[Xfce4-commits] [xfce/xfce4-power-manager] 09/13: xfpm-battery: do not show an icon for HID devices

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

    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.
    
    Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
 src/xfpm-battery.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/xfpm-battery.c b/src/xfpm-battery.c
index 31576d6..2034c60 100644
--- a/src/xfpm-battery.c
+++ b/src/xfpm-battery.c
@@ -608,10 +608,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);
 }

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


More information about the Xfce4-commits mailing list