[gnome-boxes] UnattendedInstaller.setup -> InstallerMedia.prepare_for_installation



commit 76263713d876656a1d54e0d66540be1b440825b8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Jul 11 11:13:08 2012 +0300

    UnattendedInstaller.setup -> InstallerMedia.prepare_for_installation
    
    Move setup from UnattendedInstaller to parent InstallerMedia as a virtual
    function so that users of this function don't need type checks and
    casting to be able to use it. Also give it a more specific/descriptive
    name.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679706

 src/installer-media.vala      |    1 +
 src/unattended-installer.vala |    2 +-
 src/vm-creator.vala           |    3 +--
 3 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 8b5dd65..b65448c 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -59,6 +59,7 @@ private class Boxes.InstallerMedia : GLib.Object {
     }
 
     public virtual void set_direct_boot_params (DomainOs os) {}
+    public virtual async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws GLib.Error {}
 
     public bool is_architecture_compatible (string architecture) {
         return os_media == null || // Unknown media
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 93315e6..de94877 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -114,7 +114,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         setup_ui ();
     }
 
-    public async void setup (string vm_name, Cancellable? cancellable) throws GLib.Error {
+    public override async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws GLib.Error {
         if (!express_toggle.active) {
             debug ("Unattended installation disabled.");
 
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index eeb2837..f03dd60 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -34,8 +34,7 @@ private class Boxes.VMCreator {
 
         string title;
         var name = yield create_domain_name_and_title_from_media (out title);
-        if (install_media is UnattendedInstaller)
-            yield (install_media as UnattendedInstaller).setup (name, cancellable);
+        yield install_media.prepare_for_installation (name, cancellable);
 
         var volume = yield create_target_volume (name, install_media.resources.storage);
         var caps = yield connection.get_capabilities_async (cancellable);



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