[gnome-boxes] Restructure the show_display() code



commit 201f6e6e8dfa75c9b04145698a3172b30368e625
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 9 11:47:41 2012 +0100

    Restructure the show_display() code
    
    Merge the Display.show signal handler lambda into the
    show_display () method that it will eventually call anyway.
    This centralizes all that code which lets us reuse it later.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672268

 src/machine.vala |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/src/machine.vala b/src/machine.vala
index 4ee5d39..e6f3898 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -61,6 +61,15 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
         widget = display.get_display (0);
 
         switch (App.app.ui_state) {
+        case Boxes.UIState.CREDS:
+            App.app.ui_state = Boxes.UIState.DISPLAY;
+            show_timeout_id = Timeout.add (App.app.duration, () => {
+                show_timeout_id = 0;
+                show_display ();
+                return false;
+            });
+            break;
+
         case Boxes.UIState.DISPLAY:
             App.app.display_page.show_display (display, widget);
             widget.grab_focus ();
@@ -99,23 +108,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             // Translators: The %s will be expanded with the name of the vm
             status = _("Connecting to %s").printf (name);
 
-            show_id = _display.show.connect ((id) => {
-                switch (App.app.ui_state) {
-                case Boxes.UIState.CREDS:
-                    App.app.ui_state = Boxes.UIState.DISPLAY;
-                    show_timeout_id = Timeout.add (App.app.duration, () => {
-                        show_timeout_id = 0;
-                        show_display ();
-                        return false;
-                     });
-                    break;
-
-                case Boxes.UIState.DISPLAY:
-                case Boxes.UIState.PROPERTIES:
-                    show_display ();
-                    break;
-                }
-            });
+            show_id = _display.show.connect ((id) => { show_display (); });
 
             hide_id = _display.hide.connect ((id) => {
                 App.app.display_page.remove_display ();



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