From 95e5c5cfb13ac3c1e0744936f6ccfc3edc0122ae Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Thu, 8 Dec 2011 21:55:51 +0100 Subject: [PATCH] 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 file changed, 6 insertions(+) diff --git a/js/ui/panel.js b/js/ui/panel.js index 78a14a104..3f3f74b56 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);