[gnome-boxes] app-window: Set state only on own machines



commit e5d0f6f391480972056d3823cd6c839ff76054d5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Jul 13 19:40:15 2015 +0100

    app-window: Set state only on own machines
    
    If we unconditionally forward state change event to current machine from
    AppWindow, state changes from one window end up in another. This patches
    fixes this by checking if machine's window is the same as the window
    that is about to forward it's state change to the machine.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751728

 src/app-window.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 5a278e7..57b5edf 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -174,6 +174,8 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         if (ui_state != UIState.COLLECTION)
             searchbar.search_mode_enabled = false;
 
+        var machine = (current_item is Machine)? current_item as Machine : null;
+
         switch (ui_state) {
         case UIState.COLLECTION:
             if (App.app.collection.items.length != 0)
@@ -188,8 +190,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
                 status_bind = null;
             }
             topbar.status = _("Boxes");
-            if (current_item is Machine) {
-                var machine = current_item as Machine;
+            if (machine != null) {
                 if (got_error_id != 0) {
                     machine.disconnect (got_error_id);
                     got_error_id = 0;
@@ -215,7 +216,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
             break;
         }
 
-        if (current_item != null)
+        if (machine != null && this == machine.window)
             current_item.set_state (ui_state);
     }
 


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