[gnome-boxes] libvirt-machine: update domain xml when connecting display



commit 1317189be7adef4e18907031399361de3f90afc7
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Sun Feb 5 15:41:25 2012 +0100

    libvirt-machine: update domain xml when connecting display
    
    When the machine is started, the Spice port is added to the domain
    XML.  But the "updated" signal is not emitted in this case, and it
    fails to lookup connection details.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669409

 src/libvirt-machine.vala |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index bc5d5bb..21b2e27 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -90,6 +90,14 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         stats = new MachineStat[STATS_SIZE];
     }
 
+    public void update_domain_config () {
+        try {
+            this.domain_config = domain.get_config (0);
+        } catch (GLib.Error error) {
+            critical ("Failed to fetch configuration for domain '%s': %s", domain.get_name (), error.message);
+        }
+    }
+
     public LibvirtMachine (CollectionSource source,
                            Boxes.App app,
                            GVir.Connection connection,
@@ -101,13 +109,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         this.domain = domain;
         this.domain_config = domain.get_config (0);
 
-        domain.updated.connect (() => {
-            try {
-                this.domain_config = domain.get_config (0);
-            } catch (GLib.Error error) {
-                critical ("Failed to fetch configuration for domain '%s': %s", domain.get_name (), error.message);
-            }
-        });
+        domain.updated.connect (update_domain_config);
 
         set_screenshot_enable (true);
         set_stats_enable (true);
@@ -264,6 +266,8 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
 
         return_if_fail (_connect_display == true);
 
+        update_domain_config ();
+
         try {
             var xmldoc = domain_config.to_xml ();
             type = extract_xpath (xmldoc, "string(/domain/devices/graphics/@type)", true);



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