[gnome-shell/wip/fmuellner/notification-redux+sass: 46/61] messageTray: Do not show banners while the calendar is open



commit 0c0379b0462d993fefde65eb7f98ca33afae3306
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 13 23:53:18 2015 +0100

    messageTray: Do not show banners while the calendar is open

 js/ui/dateMenu.js    |    4 +++-
 js/ui/messageTray.js |   12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index b715280..7af3467 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -357,13 +357,15 @@ const DateMenuButton = new Lang.Class({
                                    this._messageList.setDate(date);
                                }));
 
-        // Whenever the menu is opened, select today
         this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
+            // Whenever the menu is opened, select today
             if (isOpen) {
                 let now = new Date();
                 this._calendar.setDate(now);
                 this._date.setDate(now);
             }
+            // Block notification banners while the menu is open
+            Main.messageTray.bannerBlocked = isOpen;
         }));
 
         // Fill up the first column
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index aedbb45..2ff0d4e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1447,6 +1447,7 @@ const MessageTray = new Lang.Class({
             this._onStatusChanged(proxy.status);
         }));
         this._busy = false;
+        this._bannerBlocked = false;
         this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
             this._onStatusChanged(status);
         }));
@@ -1547,6 +1548,13 @@ const MessageTray = new Lang.Class({
         this._onSourceEnableChanged(source.policy, source);
     },
 
+    set bannerBlocked(v) {
+        if (this._bannerBlocked == v)
+            return;
+        this._bannerBlocked = v;
+        this._updateState();
+    },
+
     _addSource: function(source) {
         let obj = {
             source: source,
@@ -1739,6 +1747,10 @@ const MessageTray = new Lang.Class({
     // _updateState() figures out what (if anything) needs to be done
     // at the present time.
     _updateState: function() {
+        this.actor.visible = !this._bannerBlocked;
+        if (this._bannerBlocked)
+            return;
+
         // If our state changes caused _updateState to be called,
         // just exit now to prevent reentrancy issues.
         if (this._updatingState)


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