[gnome-boxes] Fix connect to libvirt machine with password



commit 8ef80d81b0bad3754db65505504c3fcdc80911c5
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Thu Nov 17 01:28:56 2011 +0100

    Fix connect to libvirt machine with password

 src/libvirt-machine.vala |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 4d4262a..2c51134 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -26,8 +26,10 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
 
     private ulong started_id;
     public override void connect_display () {
-        if (_connect_display == true)
+        if (_connect_display) {
+            update_display ();
             return;
+        }
 
         if (state != DomainState.RUNNING) {
             if (started_id != 0)
@@ -35,10 +37,10 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
 
             if (state == DomainState.PAUSED) {
                 started_id = domain.resumed.connect (() => {
-                        domain.disconnect (started_id);
-                        started_id = 0;
-                        connect_display ();
-                    });
+                    domain.disconnect (started_id);
+                    started_id = 0;
+                    connect_display ();
+                });
                 try {
                     domain.resume ();
                 } catch (GLib.Error error) {
@@ -46,10 +48,10 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
                 }
             } else {
                 started_id = domain.started.connect (() => {
-                        domain.disconnect (started_id);
-                        started_id = 0;
-                        connect_display ();
-                    });
+                    domain.disconnect (started_id);
+                    started_id = 0;
+                    connect_display ();
+                });
                 try {
                     domain.start (0);
                 } catch (GLib.Error error) {
@@ -247,6 +249,10 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
     private void update_display () {
         string type, port, socket, host;
 
+        // TODO: this assertion holds true for the moment, I don't see
+        // yet why it shouldn't be
+        return_if_fail (_connect_display == true);
+
         try {
             var xmldoc = domain.get_config (0).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]