[gnome-boxes/wip/system-libvirt-import2: 1/3] vm-creator: Make a method protected & virtual



commit 6eb0852ea9ffa511236f4c4c045b7f8e88490434
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Oct 15 21:35:59 2013 -0400

    vm-creator: Make a method protected & virtual
    
    Make create_domain_name_and_title_from_media protected & virtual.

 src/vm-creator.vala |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 5347d62..920a175 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -206,6 +206,24 @@ private class Boxes.VMCreator {
         return pool;
     }
 
+    protected virtual 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;
+
+        var pool = yield get_storage_pool ();
+        for (var i = 2;
+             connection.find_domain_by_name (name) != null ||
+             connection.find_domain_by_name (title) != null || // We used to use title as name
+             pool.get_volume (name) != null; i++) {
+            // If you change the naming logic, you must address the issue of duplicate titles you'll be 
introducing
+            name = base_name + "-" + i.to_string ();
+            title = base_title + " " + i.to_string ();
+        }
+    }
+
     private void increment_num_reboots (LibvirtMachine machine) {
         num_reboots++;
         try {
@@ -301,23 +319,6 @@ private class Boxes.VMCreator {
         return percent;
     }
 
-    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;
-
-        var pool = yield get_storage_pool ();
-        for (var i = 2;
-             connection.find_domain_by_name (name) != null ||
-             connection.find_domain_by_name (title) != null || // We used to use title as name
-             pool.get_volume (name) != null; i++) {
-            // If you change the naming logic, you must address the issue of duplicate titles you'll be 
introducing
-            name = base_name + "-" + i.to_string ();
-            title = base_title + " " + i.to_string ();
-        }
-    }
-
     private async StorageVol create_target_volume (string name, int64 storage) throws GLib.Error {
         var pool = yield get_storage_pool ();
 


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