[gnome-boxes/wip/system-libvirt-import2: 6/13] vm-creator: Refactor create_domain_name_and_title_from_media



commit 6d12e189489b63d2b1d368f4815122a18e3a3eb6
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Nov 14 18:49:24 2013 +0000

    vm-creator: Refactor create_domain_name_and_title_from_media
    
    Seperate out creation of base name and title to seperate virtual
    protected method so subclasses can provide their own implementation for
    this.

 src/vm-creator.vala |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index e1f72ab..34709e8 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -217,6 +217,11 @@ private class Boxes.VMCreator {
         return config;
     }
 
+    protected virtual void create_domain_base_name_and_title (out string base_name, out string base_title) {
+        base_title = install_media.label;
+        base_name = (install_media.os != null) ? install_media.os.short_id : "boxes-unknown";
+    }
+
     private void increment_num_reboots (LibvirtMachine machine) {
         num_reboots++;
         try {
@@ -313,11 +318,12 @@ private class Boxes.VMCreator {
     }
 
     private async void create_domain_name_and_title_from_media (out string name, out string title) throws 
GLib.Error {
-        var base_title = install_media.label;
-        title = base_title;
-        var base_name = (install_media.os != null) ? install_media.os.short_id : "boxes-unknown";
-        name = base_name;
+        string base_name, base_title;
 
+        create_domain_base_name_and_title (out base_name, out base_title);
+
+        name = base_name;
+        title = base_title;
         var pool = yield get_storage_pool ();
         for (var i = 2;
              connection.find_domain_by_name (name) != null ||


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