[gnome-boxes/wip/rishi/rhel: 3/18] wizard, wizard-source: Try to show a logo while downloading



commit a126c07e54a74146519d5ce85c7bc3660dd4d8bf
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Sep 11 19:39:31 2017 +0200

    wizard, wizard-source: Try to show a logo while downloading
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777133

 src/wizard-source.vala |   20 +++++++++++++++++---
 src/wizard.vala        |    6 ++++++
 2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index eb99882..8545363 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -128,6 +128,8 @@ private class Boxes.WizardSource: Gtk.Stack {
 
     private Gtk.Box media_vbox;
 
+    private Gtk.ListStore? media_urls_store;
+
     public MediaManager media_manager;
 
     public bool download_required {
@@ -139,6 +141,18 @@ private class Boxes.WizardSource: Gtk.Stack {
         }
     }
 
+    public Osinfo.Os? get_os_from_uri (string uri) {
+        Osinfo.Os? os = null;
+
+        media_urls_store.foreach ((store, path, iter) => {
+            string? os_uri;
+            media_urls_store.get (iter, 0, out os_uri, 1, out os);
+            return os_uri == uri;
+        });
+
+        return os;
+    }
+
     private SourcePage _page;
     public SourcePage page {
         get { return _page; }
@@ -185,16 +199,16 @@ private class Boxes.WizardSource: Gtk.Stack {
         var os_db = media_manager.os_db;
         os_db.get_all_media_urls_as_store.begin ((db, result) => {
             try {
-                var url_store = os_db.get_all_media_urls_as_store.end (result);
+                media_urls_store = os_db.get_all_media_urls_as_store.end (result);
                 var completion = new Gtk.EntryCompletion ();
                 completion.text_column = 0;
-                completion.model = url_store;
+                completion.model = media_urls_store;
                 weak Gtk.CellRendererText cell = completion.get_cells ().nth_data (0) as 
Gtk.CellRendererText;
                 cell.ellipsize = Pango.EllipsizeMode.MIDDLE;
                 completion.set_match_func ((store, key, iter) => {
                     string url;
 
-                    url_store.get (iter, 0, out url);
+                    media_urls_store.get (iter, 0, out url);
 
                     return url.contains (key);
                 });
diff --git a/src/wizard.vala b/src/wizard.vala
index c4cacb2..b13f7df 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -403,6 +403,12 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
             continue_button.sensitive = false;
             download_media.begin (wizard_source.uri, progress);
 
+            var os = wizard_source.get_os_from_uri (wizard_source.uri);
+            if (os == null)
+                debug ("Failed to find Osinfo.Os for %s", wizard_source.uri);
+            else
+                Downloader.fetch_os_logo.begin (installer_image, os, 128);
+
             return true;
         }
 


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