[gnome-boxes] List favorite machines before others in collection view



commit 4778ff874c617277a1934905bf0b998741f6f7bb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Oct 24 23:11:11 2012 +0200

    List favorite machines before others in collection view
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688613

 src/box-config.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/box-config.vala b/src/box-config.vala
index 7d8cfb3..c8c7996 100644
--- a/src/box-config.vala
+++ b/src/box-config.vala
@@ -183,7 +183,15 @@ public class Boxes.BoxConfig: GLib.Object, Boxes.IConfig {
     }
 
     public int compare (BoxConfig other) {
-        // sort first by last time used
+        // sort favorites first
+        // FIXME: We should probably have some fixed catagories rather than hard-coded strings
+        if ("favorite" in categories) {
+            if (!("favorite" in other.categories))
+                return -1;
+        } else if ("favorite" in other.categories)
+            return 1;
+
+        // then by last time used
         if (access_last_time > 0 && other.access_last_time > 0) {
             if (access_last_time > other.access_last_time)
                 return -1;


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