[gnome-boxes] Show update display in Properties page



commit f9d70733068a775586f0ae7dcb0b87677a157321
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Fri Jul 20 03:46:37 2012 +0200

    Show update display in Properties page
    
    Factor out the code to show the display in the right place depending
    on current UI state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680293

 src/machine.vala |   47 ++++++++++++++++++++++++++++++++++-------------
 1 files changed, 34 insertions(+), 13 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index ff3c0b4..cb3a7b9 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -38,6 +38,27 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         }
     }
 
+    private void show_display () {
+        Gtk.Widget widget;
+        try {
+            widget = display.get_display (0);
+        } catch (Boxes.Error error) {
+            warning (error.message);
+            return;
+        }
+
+        switch (App.app.ui_state) {
+        case Boxes.UIState.DISPLAY:
+            App.app.display_page.show_display (display, widget);
+            widget.grab_focus ();
+            break;
+
+        case Boxes.UIState.PROPERTIES:
+            machine_actor.update_display (widget, false);
+            break;
+        }
+    }
+
     private Display? _display;
     public Display? display {
         get { return _display; }
@@ -60,20 +81,20 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
                 return;
 
             show_id = _display.show.connect ((id) => {
-                App.app.ui_state = Boxes.UIState.DISPLAY;
-                Timeout.add (App.app.duration, () => {
-                    if  (App.app.ui_state != Boxes.UIState.DISPLAY)
-                          return false;
-                    try {
-                        var widget = display.get_display (0);
-                        App.app.display_page.show_display (display, widget);
-                        widget.grab_focus ();
-                    } catch (Boxes.Error error) {
-                        warning (error.message);
-                    }
-
-                    return false;
-                });
+                switch (App.app.ui_state) {
+                case Boxes.UIState.CREDS:
+                    App.app.ui_state = Boxes.UIState.DISPLAY;
+                    Timeout.add (App.app.duration, () => {
+                        show_display ();
+                        return false;
+                     });
+                    break;
+
+                case Boxes.UIState.DISPLAY:
+                case Boxes.UIState.PROPERTIES:
+                    show_display ();
+                    break;
+                }
             });
 
             hide_id = _display.hide.connect ((id) => {



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