[gnome-boxes] vm-configurator: Add get_source_media_path()



commit b85cd4182f655101ad16f9f1b8cec66b6ca1f786
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Nov 17 18:33:52 2012 +0200

    vm-configurator: Add get_source_media_path()
    
    Add a method for retreiving the installer media from domain config.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688770

 src/vm-configurator.vala |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index d21dce3..137d4a4 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -297,6 +297,26 @@ private class Boxes.VMConfigurator {
         return get_custom_xml_node (domain, "os-state");
     }
 
+    public static string? get_source_media_path (Domain domain) {
+        string path = null;
+
+        var devices = domain.get_devices ();
+        foreach (var device in devices) {
+            if (!(device is DomainDisk))
+                continue;
+
+            var disk = device as DomainDisk;
+            var disk_type = disk.get_guest_device_type ();
+            if (disk_type == DomainDiskGuestDeviceType.CDROM) {
+                path = disk.get_source ().dup ();
+
+                break;
+            }
+        }
+
+        return path;
+    }
+
     private static string? get_custom_xml_node (Domain domain, string node_name) {
         var xml = domain.get_custom_xml (BOXES_NS_URI);
         if (xml != null) {



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