[gnome-shell/wip/new-notifications: 2/17] panel: Properly fizzle out re-setting the menu to the same app



commit 504ef7d58c77a51fff4bd6e65a7541dc08f758de
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Dec 3 19:46:59 2013 -0500

    panel: Properly fizzle out re-setting the menu to the same app
    
    Ever since the RemoteMenu rewrite, actionGroup has been private,
    meaning that we never fizzled out setting the app menu to the
    same thing when we didn't need to.
    
    This means that when updating the menu, we reset the menu. If
    we reset the menu at some unfortunate times, like when the menu
    was opening, then various bugs could happen where the menu we
    were opening was swapped out from under our feet, getting various
    components confused.
    
    Add public API to compare whether a RemoteMenu is for a specific
    action group and menu model, and fizzle out where appropriate.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719468

 js/ui/panel.js      |    2 +-
 js/ui/remoteMenu.js |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 2337a63..fea689d 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -497,7 +497,7 @@ const AppMenuButton = new Lang.Class({
             menu = null;
         } else if (this._targetApp.action_group && this._targetApp.menu) {
             if (this.menu instanceof RemoteMenu.RemoteMenu &&
-                this.menu.actionGroup == this._targetApp.action_group)
+                this.menu.equals(this._targetApp.menu, this._targetApp.action_group))
                 return;
 
             menu = new RemoteMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
diff --git a/js/ui/remoteMenu.js b/js/ui/remoteMenu.js
index 7d7ebbf..2a8e943 100644
--- a/js/ui/remoteMenu.js
+++ b/js/ui/remoteMenu.js
@@ -192,6 +192,10 @@ const RemoteMenu = new Lang.Class({
                                               _removeItem.bind(null, this));
     },
 
+    equals: function(model, actionGroup) {
+        return this._model == model && this._actionGroup == actionGroup;
+    },
+
     destroy: function() {
         this._tracker.destroy();
         this.parent();


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