[gnome-shell/wip/message-tray-menu: 71/109] messageTray: Use a PopupMenuManager for the message tray context menu



commit 32ae6f4291bbc7053b01c945b9382f458441dd59
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 19 11:46:06 2013 -0400

    messageTray: Use a PopupMenuManager for the message tray context menu
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699272

 js/ui/messageTray.js |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index ade8b4b..3af6f64 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1719,6 +1719,8 @@ const MessageTray = new Lang.Class({
         this._updateNoMessagesLabel();
 
         this._contextMenu = new MessageTrayContextMenu(this);
+        this._contextMenuManager = new PopupMenu.PopupMenuManager({ grabHelper: this._grabHelper });
+        this._contextMenuManager.addMenu(this._contextMenu);
 
         let clickAction = new Clutter.ClickAction();
         this.actor.add_action(clickAction);
@@ -1727,8 +1729,6 @@ const MessageTray = new Lang.Class({
             let button = action.get_button();
             if (button == 3)
                 this._openContextMenu();
-            if (button == 1 && this._contextMenu.isOpen)
-                this._grabHelper.ungrab({ actor: this._contextMenu.actor });
         }));
 
         clickAction.connect('long-press', Lang.bind(this, function(action, actor, state) {
@@ -1745,12 +1745,6 @@ const MessageTray = new Lang.Class({
     _openContextMenu: function () {
         let [x, y, mask] = global.get_pointer();
         this._contextMenu.setPosition(Math.round(x), Math.round(y));
-        this._grabHelper.grab({ actor: this._contextMenu.actor,
-                                modal: true,
-                                onUngrab: Lang.bind(this, function () {
-                                    this._contextMenu.close(BoxPointer.PopupAnimation.FULL);
-                                })
-        });
         this._contextMenu.open(BoxPointer.PopupAnimation.FULL);
     },
 


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