[gnome-boxes] Add InstallerMedia.get_vm_properties()



commit d7f06463034735c3d4452da752d5782d51a52ccb
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jul 11 12:07:50 2012 +0300

    Add InstallerMedia.get_vm_properties()
    
    Let InstallerMedia and its subclasses provide list of VM properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679706

 src/installer-media.vala      |    8 ++++++++
 src/unattended-installer.vala |   11 +++++++++++
 src/wizard.vala               |   11 ++---------
 3 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 5d78edc..5128a2a 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -83,6 +83,14 @@ private class Boxes.InstallerMedia : GLib.Object {
     public virtual void populate_setup_vbox (Gtk.VBox setup_vbox) {}
     public virtual void check_needed_info () throws UnattendedInstallerError.SETUP_INCOMPLETE {}
 
+    public virtual GLib.List<Pair<string,string>> get_vm_properties () {
+        var properties = new GLib.List<Pair<string,string>> ();
+
+        properties.append (new Pair<string,string> (_("System"), label));
+
+        return properties;
+    }
+
     public bool is_architecture_compatible (string architecture) {
         return os_media == null || // Unknown media
                os_media.architecture == architecture ||
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 639d38e..e018263 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -174,6 +174,17 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
                         (_("Password required for express installation of %s"), label);
     }
 
+    public override List<Pair> get_vm_properties () {
+        var properties = base.get_vm_properties ();
+
+        if (express_install) {
+            properties.append (new Pair<string,string> (_("Username"), username));
+            properties.append (new Pair<string,string> (_("Password"), hidden_password));
+        }
+
+        return properties;
+    }
+
     public virtual string fill_unattended_data (string data) throws RegexError {
         var str = username_regex.replace (data, data.length, 0, username_entry.text);
         str = password_regex.replace (str, str.length, 0, password);
diff --git a/src/wizard.vala b/src/wizard.vala
index dcb15f0..6e017df 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -346,15 +346,8 @@ private class Boxes.Wizard: Boxes.UI {
                 review_label.set_text (_("Will add boxes for all systems available from this account:"));
             }
         } else if (vm_creator != null) {
-            summary.add_property (_("System"), vm_creator.install_media.label);
-
-            if (vm_creator.install_media is UnattendedInstaller) {
-                var media = vm_creator.install_media as UnattendedInstaller;
-                if (media.express_install) {
-                    summary.add_property (_("Username"), media.username);
-                    summary.add_property (_("Password"), media.hidden_password);
-                }
-            }
+            foreach (var property in vm_creator.install_media.get_vm_properties ())
+                summary.add_property (property.first, property.second);
 
             var memory = format_size (vm_creator.install_media.resources.ram, FormatSizeFlags.IEC_UNITS);
             summary.add_property (_("Memory"), memory);



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