[gnome-shell-extensions] window-list: Only have a single context menu at any time



commit b87ddf1195ed97e322a90994fc8f1ec2c8ec8614
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 15 00:17:39 2014 +0100

    window-list: Only have a single context menu at any time
    
    Depending on the number of windows, AppButtons use different right-click
    menus ("Minimize" vs. "Minimize all").
    As the menu for the multiple-windows case remains the same, it is created
    and added just once. However this means that in the single-window case,
    the corresponding PopupMenuManager will track two menus for the same
    source actor, resulting in various misbehaviors.
    Fix these issues by adding and removing the app context menu appropriately,
    so that the PopupMenuManager tracks a single menu at any time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724688

 extensions/window-list/extension.js |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 0531b40..d83fa00 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -391,7 +391,6 @@ const AppButton = new Lang.Class({
         this._appContextMenu = new AppContextMenu(this.actor, this.app);
         this._appContextMenu.connect('open-state-changed', _onMenuStateChanged);
         this._appContextMenu.actor.hide();
-        this._contextMenuManager.addMenu(this._appContextMenu);
         Main.uiGroup.add_actor(this._appContextMenu.actor);
 
         this._textureCache = St.TextureCache.get_default();
@@ -470,6 +469,7 @@ const AppButton = new Lang.Class({
                 this._windowContextMenu.actor.hide();
                 this._contextMenuManager.addMenu(this._windowContextMenu);
             }
+            this._contextMenuManager.removeMenu(this._appContextMenu);
             this._contextMenu = this._windowContextMenu;
         } else {
             if (this._windowTitle) {
@@ -480,6 +480,7 @@ const AppButton = new Lang.Class({
                 this._windowContextMenu = null;
             }
             this._contextMenu = this._appContextMenu;
+            this._contextMenuManager.addMenu(this._appContextMenu);
         }
 
     },


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