[gnome-boxes] wizard-source: Show first Downloadable distros with logos



commit fa45ade6751b64b86a41ba356e1f4aa2450e7a0b
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Nov 29 10:32:59 2017 +0100

    wizard-source: Show first Downloadable distros with logos
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790614

 src/downloader.vala    |    2 +-
 src/wizard-source.vala |   15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/downloader.vala b/src/downloader.vala
index 53397cc..2f8137e 100644
--- a/src/downloader.vala
+++ b/src/downloader.vala
@@ -35,7 +35,7 @@ private class Boxes.Downloader : GLib.Object {
         return downloader;
     }
 
-    private static string fetch_os_logo_url (Osinfo.Os os) {
+    public static string fetch_os_logo_url (Osinfo.Os os) {
         if (os.logo != null)
             return os.logo;
 
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index f26376e..f92a93f 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -445,7 +445,20 @@ private class Boxes.WizardSource: Gtk.Stack {
             try {
                 var table = os_db.list_latest_downloadable_oses.end (result);
 
-                table.get_values ().foreach (available_downloads_model.append);
+                foreach (var os in table.get_values ()) {
+                    available_downloads_model.insert_sorted (os, (a, b) => {
+                        var os1 = a as Osinfo.Os;
+                        var os2 = b as Osinfo.Os;
+
+                        if (Downloader.fetch_os_logo_url (os1) != null)
+                            return -1;
+
+                        if (Downloader.fetch_os_logo_url (os2) != null)
+                            return 1;
+
+                        return 0;
+                    });
+                }
             } catch (OSDatabaseError error) {
                 debug ("Failed to populate the list of downloadable OSes: %s", error.message);
             }


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