[gnome-shell] panel: Block banners when opening menus that would overlap



commit 08690d658f426e901a7d3df50a8ed46ec77a74be
Author: Meet Parikh <meetprkh gnome gmail com>
Date:   Thu Apr 23 22:13:58 2015 +0530

    panel: Block banners when opening menus that would overlap
    
    We currently block banners while the time+date menu is open, as it
    would obscure the notification. However it is not necessarily the
    only menu for which this is the case, so generalize the behavior
    to all menus that would overlap banners when open.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745910

 js/ui/dateMenu.js |    2 --
 js/ui/panel.js    |   19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 7307d7d..12d7eea 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -357,8 +357,6 @@ const DateMenuButton = new Lang.Class({
                 this._date.setDate(now);
                 this._messageList.setDate(now);
             }
-            // Block notification banners while the menu is open
-            Main.messageTray.bannerBlocked = isOpen;
         }));
 
         // Fill up the first column
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 2a95136..46be6ac 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -1003,6 +1003,25 @@ const Panel = new Lang.Class({
         if (parent)
             parent.remove_actor(container);
 
+        if (indicator._openChangedId > 0)
+            indicator.menu.disconnect(indicator._openChangedId);
+        indicator._openChangedId = 0;
+
+        if (indicator.menu)
+            indicator._openChangedId = indicator.menu.connect('open-state-changed',
+                Lang.bind(this, function(menu, isOpen) {
+                    let boxAlignment;
+                    if (box == this._leftBox)
+                        boxAlignment = Clutter.ActorAlign.START;
+                    else if (box == this._centerBox)
+                        boxAlignment = Clutter.ActorAlign.CENTER;
+                    else if (box == this._rightBox)
+                        boxAlignment = Clutter.ActorAlign.END;
+
+                    if (boxAlignment == Main.messageTray.bannerAlignment)
+                        Main.messageTray.bannerBlocked = isOpen;
+                }));
+
         box.insert_child_at_index(container, position);
         if (indicator.menu)
             this.menuManager.addMenu(indicator.menu);


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