[gnome-boxes] Order the list of USB devices



commit c9c7d3c76224e324efa4239ffb0d2b790fdb7d69
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Tue Mar 5 13:41:02 2013 +0100

    Order the list of USB devices
    
    When USB devices are unplugged and replugged, they won't
    always reappear in the same place, which can be disturbing. This
    commit alphabetically sort that list so that a given device always
    reappear at the same place. The sort could be made more sophisticated
    in the future if we want to group the devices by type, this kind of
    things.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695207

 src/spice-display.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 63a08e3..161ac7b 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -292,6 +292,12 @@ private class Boxes.SpiceDisplay: Boxes.Display {
                     try {
                         var manager = UsbDeviceManager.get (session);
                         var devs = manager.get_devices ();
+                        devs.sort ( (a, b) => {
+                            string str_a = a.get_description ("    %1$s %2$s");
+                            string str_b = b.get_description ("    %1$s %2$s");
+
+                            return strcmp (str_a, str_b);
+                        });
                         for (int i = 0; i < devs.length; i++) {
                             var dev = devs[i];
 


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