[gnome-boxes] empty-boxes: Drop use of AppWindow singleton



commit ce68a229866d2f8c650637e12c8373bbde362f4d
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Jul 18 10:04:19 2014 +0200

    empty-boxes: Drop use of AppWindow singleton
    
    Instead of using the AppWindow singleton, EmptyBoxes now has its own
    reference to AppWindow that it receives through a parameter to setup_ui().
    
    This is needed to drop the use of AppWindow singleton and therefore to
    make multiple windows possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732098

 src/app-window.vala  |    1 +
 src/empty-boxes.vala |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 6398001..eea50d4 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -113,6 +113,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         searchbar.setup_ui (this);
         sidebar.setup_ui (this);
         properties.setup_ui (this);
+        empty_boxes.setup_ui (this);
         notificationbar.searchbar = searchbar;
     }
 
diff --git a/src/empty-boxes.vala b/src/empty-boxes.vala
index 46c24d1..ab7a3d5 100644
--- a/src/empty-boxes.vala
+++ b/src/empty-boxes.vala
@@ -8,10 +8,16 @@ private class Boxes.EmptyBoxes : Gtk.Stack, Boxes.UI {
     [GtkChild]
     private Gtk.Box grid_box;
 
+    private AppWindow window;
+
     construct {
         App.app.call_when_ready (on_app_ready);
     }
 
+    public void setup_ui (AppWindow window) {
+        this.window = window;
+    }
+
     private void on_app_ready () {
         update_visibility ();
 
@@ -28,8 +34,8 @@ private class Boxes.EmptyBoxes : Gtk.Stack, Boxes.UI {
             return;
 
         if (visible)
-            App.window.below_bin.set_visible_child_name ("empty-boxes");
+            window.below_bin.set_visible_child_name ("empty-boxes");
         else
-            App.window.below_bin.set_visible_child_name ("collection-view");
+            window.below_bin.set_visible_child_name ("collection-view");
     }
 }


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