[gnome-shell] Application Menu: watch for menu property changes



commit 951fff5aa0a6440a60d4f94fe523c004c4f7a2ff
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Dec 8 21:55:51 2011 +0100

    Application Menu: watch for menu property changes
    
    By the time the window is first mapped and the app menu button is
    synced, we may not have finished reading the menu. In that case,
    connect to notify::menu and update accordingly.

 js/ui/panel.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 78a14a1..3f3f74b 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -243,6 +243,7 @@ const AppMenuButton = new Lang.Class({
 
         this._menuManager = menuManager;
         this._targetApp = null;
+        this._appMenuNotifyId = 0;
 
         let bin = new St.Bin({ name: 'appMenu' });
         this.actor.add_actor(bin);
@@ -519,6 +520,11 @@ const AppMenuButton = new Lang.Class({
         this._iconBox.hide();
         this._label.setText('');
 
+        if (this._appMenuNotifyId)
+            this._targetApp.disconnect(this._appMenuNotifyId);
+        if (targetApp)
+            this._appMenuNotifyId = targetApp.connect('notify::menu', Lang.bind(this, this._sync));
+
         this._targetApp = targetApp;
         let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
 



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