[gnome-boxes] Pass UnattendedFile to add_unattended_file



commit a88b7b8239e47dcaa692fc39db78b91cddafc60b
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Thu May 24 16:20:03 2012 +0200

    Pass UnattendedFile to add_unattended_file
    
    This makes add_unattended_file usable with any class inheriting
    from UnattendedFile, not only with UnattendedTextFile instances.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677038

 src/unattended-installer.vala |    8 ++++----
 src/winxp-installer.vala      |    5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 2bb0cc4..f83dabb 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -101,7 +101,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         newline_type = DataStreamNewlineType.LF;
 
         unattended_files = new GLib.List<UnattendedFile> ();
-        unattended_files.append (new UnattendedTextFile (this, unattended_src_path, unattended_dest_name));
+        add_unattended_file (new UnattendedTextFile (this, unattended_src_path, unattended_dest_name));
 
         var time = TimeVal ();
         var date = new DateTime.from_timeval_local (time);
@@ -274,8 +274,8 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
 
     protected virtual async void prepare_direct_boot (Cancellable? cancellable) throws GLib.Error {}
 
-    protected void add_unattended_text_file (string unattended_src_path, string unattended_dest_name) {
-        unattended_files.append (new UnattendedTextFile (this, unattended_src_path, unattended_dest_name));
+    protected void add_unattended_file (UnattendedFile file) {
+        unattended_files.append (file);
     }
 
     private async void create_disk_image (Cancellable? cancellable) throws GLib.Error {
@@ -320,7 +320,7 @@ private abstract class Boxes.UnattendedInstaller: InstallerMedia {
         var file = File.new_for_path (avatar_path);
         if (file.query_exists ()) {
             avatar.file = avatar_path;
-            unattended_files.append (new UnattendedAvatarFile (this, avatar_path, avatar_format));
+            add_unattended_file (new UnattendedAvatarFile (this, avatar_path, avatar_format));
         }
     }
 }
diff --git a/src/winxp-installer.vala b/src/winxp-installer.vala
index 810eb21..1aa1ab4 100644
--- a/src/winxp-installer.vala
+++ b/src/winxp-installer.vala
@@ -28,12 +28,11 @@ private class Boxes.WinXPInstaller: WindowsInstaller {
 
         var name = media.os.short_id + ".cmd";
         unattended_source = get_unattended (name);
-        add_unattended_text_file (unattended_source, name);
+        add_unattended_file (new UnattendedTextFile (this, unattended_source, name));
 
         name = media.os.short_id + ".reg";
         unattended_source = get_unattended (name);
-        add_unattended_text_file (unattended_source, name);
-
+        add_unattended_file (new UnattendedTextFile (this, unattended_source, name));
         newline_type = DataStreamNewlineType.CR_LF;
     }
 



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