[gnome-boxes] app-window: Notificationbar depends on UI state



commit 97b7aa3145071132a001c419b5ca6fb308432c74
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Nov 26 15:34:24 2014 +0000

    app-window: Notificationbar depends on UI state
    
    App window now redirects users of notificationbar to the appropriate
    notification bar, based on UI state. This way we don't need to
    update/change all the users of notificationbar and they are completely
    abstracted from UI state when displaying notifications.

 data/ui/app-window.ui |    2 +-
 src/app-window.vala   |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/app-window.ui b/data/ui/app-window.ui
index ed74372..31ebc7e 100644
--- a/data/ui/app-window.ui
+++ b/data/ui/app-window.ui
@@ -58,7 +58,7 @@
             <property name="visible">True</property>
 
             <child type="overlay">
-              <object class="BoxesNotificationbar" id="notificationbar">
+              <object class="BoxesNotificationbar" id="_notificationbar">
                 <property name="visible">True</property>
               </object>
             </child>
diff --git a/src/app-window.vala b/src/app-window.vala
index 341d8b8..3249e29 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -60,6 +60,19 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         }
     }
 
+    public Notificationbar notificationbar {
+        get {
+            switch (ui_state) {
+            case UIState.WIZARD:
+                return wizard_window.notificationbar;
+            case UIState.PROPERTIES:
+                return props_window.notificationbar;
+            default:
+                return _notificationbar;
+            }
+        }
+    }
+
     public WizardWindow wizard_window;
     public PropertiesWindow  props_window;
 
@@ -68,8 +81,6 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
     [GtkChild]
     public Topbar topbar;
     [GtkChild]
-    public Notificationbar notificationbar;
-    [GtkChild]
     public Selectionbar selectionbar;
     [GtkChild]
     public DisplayPage display_page;
@@ -82,6 +93,9 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
 
     public GLib.Settings settings;
 
+    [GtkChild]
+    private Notificationbar _notificationbar;
+
     private uint configure_id;
     public static const uint configure_id_timeout = 100;  // 100ms
 


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