[gnome-boxes] collection-view: Hide items until wizard is finished



commit 94414dc4225944b28ab2fc6a5fdcadc172767d53
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 10 17:36:22 2014 +0000

    collection-view: Hide items until wizard is finished
    
    In case of local VMs, we create the machine already before user is out
    of wizard. However, we don't want this newly added machine to be visible
    until user has hit 'Create' button and/or is out of wizard state.
    
    This patch defers the addition of new items to collection view until we
    are out of wizard state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741340

 src/collection-view.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index b610ff6..24c2920 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -123,6 +123,22 @@ private class Boxes.CollectionView: Gd.MainView, Boxes.UI {
             return;
         }
 
+        var window = machine.window;
+        if (window.ui_state == UIState.WIZARD) {
+            // Don't show newly created items until user is out of wizard
+            ulong ui_state_id = 0;
+
+            ui_state_id = window.notify["ui-state"].connect (() => {
+                if (window.ui_state == UIState.WIZARD)
+                    return;
+
+                add_item (item);
+                window.disconnect (ui_state_id);
+            });
+
+            return;
+        }
+
         var iter = append (machine.name, machine.info,  item);
         var pixbuf_id = machine.notify["pixbuf"].connect (() => {
             // apparently iter is stable after insertion/removal/sort


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