[gnome-boxes] app-window: Present window when machine activated



commit b2c41b055b7c3891864b6d4cbe5d18c42ec5d950
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Aug 3 12:57:31 2014 +0200

    app-window: Present window when machine activated
    
    This presents a machine's window if the machine is activated and is
    already running in a window, otherwise it creates a new window for the
    machine.
    
    This is needed to make multiple windows possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734486

 src/app-window.vala |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 88b2de1..e131fca 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -219,13 +219,21 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
 
     public void select_item (CollectionItem item) {
         if (ui_state == UIState.COLLECTION && !selection_mode) {
-            current_item = item;
+            return_if_fail (item is Machine);
 
-            if (current_item is Machine) {
-                var machine = current_item as Machine;
+            var machine = item as Machine;
 
+            if (machine.window != App.app.main_window) {
+                machine.window.present ();
+
+                return;
+            }
+
+            current_item = item;
+
+            if (current_item is Machine)
                 connect_to (machine);
-            } else
+            else
                 warning ("unknown item, fix your code");
 
             item_selected (item);


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