[gnome-boxes] vm-configurator: Don't ignore custom XML on old VMs



commit 912ff3ec520e2767dc8763523eca1a60a79e2a92
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Jun 24 17:23:10 2016 +0100

    vm-configurator: Don't ignore custom XML on old VMs
    
    Our homepage URL changed in Dec 2014 and that is what we use as
    namespace URL in our custom XML. This meant that we were ignoring custom
    XML on VMs created before that time cause we were only looking for new
    URL. Let's fix this by also look for custom XML by old URL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767613

 src/vm-configurator.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 4b8918f..13cb0d2 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -10,6 +10,7 @@ private errordomain Boxes.VMConfiguratorError {
 private class Boxes.VMConfigurator {
     private const string BOXES_NS = "boxes";
     private const string BOXES_NS_URI = Config.PACKAGE_URL;
+    private const string BOXES_OLD_NS_URI = "http://live.gnome.org/Boxes/";;
     private const string BOXES_XML = "<gnome-boxes>%s</gnome-boxes>";
     private const string LIVE_STATE = "live";
     private const string INSTALLATION_STATE = "installation";
@@ -386,11 +387,17 @@ private class Boxes.VMConfigurator {
     }
 
     private static string? get_custom_xml_node (Domain domain, string node_name) {
-        var xml = domain.get_custom_xml (BOXES_NS_URI);
+        var ns_uri = BOXES_NS_URI;
+        var xml = domain.get_custom_xml (ns_uri);
+        if (xml == null) {
+            ns_uri = BOXES_OLD_NS_URI;
+            xml = domain.get_custom_xml (ns_uri);
+        }
+
         if (xml != null) {
             var reader = new Xml.TextReader.for_memory ((char []) xml.data,
                                                         xml.length,
-                                                        BOXES_NS_URI,
+                                                        ns_uri,
                                                         null,
                                                         Xml.ParserOption.COMPACT);
             reader.next (); // Go to first node


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