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.
This commit is contained in:
Giovanni Campagna 2011-12-08 21:55:51 +01:00
parent 757fb5796e
commit 95e5c5cfb1

View File

@ -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);