[gnome-boxes] util: Add find_usb_device_by_prop()



commit 97f79f6342c77bdcf4aeb8cee6091ba12163508f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Mar 31 22:56:13 2015 +0100

    util: Add find_usb_device_by_prop()
    
    Add a variant of find_device_by_prop() that confines the device search
    to USB only.

 src/util-app.vala |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/util-app.vala b/src/util-app.vala
index 5fff6ac..8f8d4a7 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -67,9 +67,18 @@ namespace Boxes {
         container.remove (widget);
     }
 
-    public Osinfo.Device? find_device_by_prop (Osinfo.DeviceList devices, string prop_name, string 
prop_value) {
+    public Osinfo.Device? find_usb_device_by_prop (Osinfo.DeviceList devices, string prop_name, string 
prop_value) {
+        return find_device_by_prop (devices, prop_name, prop_value, "usb");
+    }
+
+    public Osinfo.Device? find_device_by_prop (Osinfo.DeviceList devices,
+                                               string            prop_name,
+                                               string            prop_value,
+                                               string?           bus_type = null) {
         var filter = new Osinfo.Filter ();
         filter.add_constraint (prop_name, prop_value);
+        if (bus_type != null)
+            filter.add_constraint (Osinfo.DEVICE_PROP_BUS_TYPE, bus_type);
 
         var filtered = (devices as Osinfo.List).new_filtered (filter);
         if (filtered.get_length () > 0)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]