[gnome-boxes] Choose resources according to media architecture



commit e14f0ce46c70cf42ebf2f984ba8c42961ced7414
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jan 26 07:34:06 2012 +0200

    Choose resources according to media architecture
    
    We were always prefering recommended/minimum resources for 64-bit even
    if the OS being installed was 32-bit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668162

 src/os-database.vala |   16 +++++++++++++---
 src/wizard.vala      |    2 +-
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/os-database.vala b/src/os-database.vala
index 403a4f6..430f6ea 100644
--- a/src/os-database.vala
+++ b/src/os-database.vala
@@ -60,12 +60,22 @@ private class Boxes.OSDatabase {
         return media;
     }
 
-    public Resources get_resources_for_os (Os? os) {
+    public Resources get_resources_for_os (Os? os, string? architecture) {
         if (os == null)
             return get_default_resources ();
 
-        // Prefer x86_64 resources
-        string[] prefs = {"x86_64", "i686", "i386", ARCHITECTURE_ALL};
+        // Prefer x86_64 resources by default
+        string[] architectures = {"x86_64", "i686", "i386", ARCHITECTURE_ALL};
+        string[] prefs;
+        if (architecture != null) {
+            prefs = new string[0];
+            prefs += architecture;
+
+            foreach (var arch in architectures)
+                if (arch != architecture)
+                    prefs += arch;
+        } else
+            prefs = architectures;
 
         // First try recommended resources
         var list = os.get_recommended_resources ();
diff --git a/src/wizard.vala b/src/wizard.vala
index 2b7d084..bcf9663 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -207,7 +207,7 @@ private class Boxes.Wizard: Boxes.UI {
 
         try {
             install_media = InstallerMedia.instantiate.end (result);
-            resources = os_db.get_resources_for_os (install_media.os);
+            resources = os_db.get_resources_for_os (install_media.os, install_media.os_media.architecture);
             prep_progress.fraction = 1.0;
             page = page + 1;
         } catch (IOError.CANCELLED cancel_error) { // We did this, so no warning!



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