[gnome-boxes] selectionbar: Setup UI once window is constructed



commit 5e41e15c9e12d1a2b71930c3e75477819124fee4
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Jul 16 11:18:59 2014 +0200

    selectionbar: Setup UI once window is constructed
    
    This is part of the move of the 'selection-mode' property from App to
    AppWindow. This adds setup_ui() to the Selectionbar class to ensure that
    the connection to the notification of 'selection-mode' is done once the
    window is constructed.
    
    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   |    3 +++
 src/selectionbar.vala |   10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 42e79a5..8d11106 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -43,6 +43,8 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     [GtkChild]
     public Notificationbar notificationbar;
     [GtkChild]
+    public Selectionbar selectionbar;
+    [GtkChild]
     public Sidebar sidebar;
     [GtkChild]
     public Wizard wizard;
@@ -107,6 +109,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         wizard.setup_ui ();
         display_page.setup_ui ();
         view.setup_ui ();
+        selectionbar.setup_ui ();
     }
 
     private void save_window_geometry () {
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index e091324..53b78ce 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -13,10 +13,6 @@ private class Boxes.Selectionbar: Gtk.Revealer {
     private Gtk.Button properties_btn;
 
     construct {
-        App.app.notify["selection-mode"].connect (() => {
-            reveal_child = App.app.selection_mode;
-        });
-
         App.app.notify["selected-items"].connect (() => {
             update_favorite_btn ();
             update_properties_btn ();
@@ -25,6 +21,12 @@ private class Boxes.Selectionbar: Gtk.Revealer {
         });
     }
 
+    public void setup_ui () {
+        App.app.notify["selection-mode"].connect (() => {
+            reveal_child = App.app.selection_mode;
+        });
+    }
+
     private bool ignore_favorite_btn_clicks;
     [GtkCallback]
     private void on_favorite_btn_clicked () {


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