[gnome-boxes] Machine: Always disconnect display when we're not displaying it



commit 9bfb2805968c506f20c52d6b4aa0b70549fae558
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Oct 31 10:42:31 2012 +0100

    Machine: Always disconnect display when we're not displaying it
    
    We used to only disconnect Machine.display when going into collection
    view, but that is not always what happens. For instance, we might
    go directly to the wizard if we use the "New" app menu item.
    So, we move this disconnect from App.ui_state_changed to
    Machine.ui_state_changed and disconnect on any state except
    DISPLAY, PROPERTIES and CREDS.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677714

 src/app.vala     |    2 --
 src/machine.vala |   13 +++++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 4d2e076..9991284 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -564,8 +564,6 @@ private class Boxes.App: Boxes.UI {
                     machine.disconnect (status_id);
                     status_id = 0;
                 }
-
-                machine.disconnect_display ();
             }
             fullscreen = false;
             view.visible = true;
diff --git a/src/machine.vala b/src/machine.vala
index 631b016..b3b7393 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -450,6 +450,19 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
 
     public override void ui_state_changed () {
         machine_actor.ui_state = ui_state;
+
+        switch (ui_state) {
+        case Boxes.UIState.DISPLAY:
+        case Boxes.UIState.PROPERTIES:
+        case Boxes.UIState.CREDS:
+            /* These are allowed display states */
+            break;
+        default:
+            /* Disconnect if we go to any other state */
+            disconnect_display ();
+            break;
+        }
+
     }
 }
 



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