[gnome-boxes] Move SPICE password setup to InstallerMedia



commit 27050e84a75c50f2245358759557aa94d03e3b3e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jul 11 11:55:41 2012 +0300

    Move SPICE password setup to InstallerMedia
    
    Let InstallerMedia and its subclasses handle setup of SPICE password in
    the domain config.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679706

 src/installer-media.vala      |    2 ++
 src/unattended-installer.vala |    8 +++++++-
 src/vm-configurator.vala      |    9 +--------
 3 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 5b1a4bf..b014bca 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -79,6 +79,8 @@ private class Boxes.InstallerMedia : GLib.Object {
         domain.add_device (disk);
     }
 
+    public virtual void setup_spice_config (DomainGraphicsSpice graphics) {}
+
     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 1bfdb2b..4c69429 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -32,10 +32,10 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         }
     }
 
-    public bool password_mandatory { get; protected set; }
     public DataStreamNewlineType newline_type;
     public File? disk_file;
 
+    protected bool password_mandatory;
     protected GLib.List<UnattendedFile> unattended_files;
 
     protected Gtk.Table setup_table;
@@ -150,6 +150,12 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         domain.add_device (disk);
     }
 
+    public override void setup_spice_config (DomainGraphicsSpice graphics) {
+        // If guest requires password, we let it take care of authentications and free the user from one
+        // authentication layer.
+        if (express_install && !password_mandatory && password != "")
+            graphics.set_password (password);
+    }
 
 
     }
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index fb98b62..c4af285 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -64,14 +64,7 @@ private class Boxes.VMConfigurator {
 
         var graphics = new DomainGraphicsSpice ();
         graphics.set_autoport (true);
-        if (install_media is UnattendedInstaller) {
-            var unattended = install_media as UnattendedInstaller;
-
-            // If guest requires password, we let it take care of authentications and free the user from one
-            // authentication layer.
-            if (unattended.express_install && !unattended.password_mandatory && unattended.password != "")
-                graphics.set_password (unattended.password);
-        }
+        install_media.setup_spice_config (graphics);
         domain.add_device (graphics);
 
         // SPICE agent channel. This is needed for features like copy&paste between host and guest etc to work.



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