Updating branch refs/heads/eric/bugzilla-patches
         to f691bf19ef81df90008af72efbac5441ca68bad4 (commit)
       from bb1b43e8f608daf05110432f30dd3c4d411470ad (commit)

commit f691bf19ef81df90008af72efbac5441ca68bad4
Author: Stefan Seyfried <[email protected]>
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 <[email protected]>

 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);
 }
_______________________________________________
Xfce4-commits mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to