Add per-window actions

GTK+ also exports window-specific actions, by putting the object path
for the exported action group in the _DBUS_OBJECT_PATH X property.
We add this action group to the app's muxer with a 'win' prefix,
since that is what the exported menu expects. Whenever the focus
window changes, we update the window-specific actions of its
application, and emit notify::action-group to cause the app
menu to be updated.
This commit is contained in:
Matthias Clasen
2011-12-15 01:25:35 -05:00
committed by Colin Walters
parent 4aa1fe9ca2
commit 6c4e9d23f2
4 changed files with 37 additions and 2 deletions

View File

@ -244,6 +244,7 @@ const AppMenuButton = new Lang.Class({
this._menuManager = menuManager;
this._targetApp = null;
this._appMenuNotifyId = 0;
this._actionGroupNotifyId = 0;
let bin = new St.Bin({ name: 'appMenu' });
this.actor.add_actor(bin);
@ -522,8 +523,12 @@ const AppMenuButton = new Lang.Class({
if (this._appMenuNotifyId)
this._targetApp.disconnect(this._appMenuNotifyId);
if (targetApp)
if (this._actionGroupNotifyId)
this._targetApp.disconnect(this._actionGroupNotifyId);
if (targetApp) {
this._appMenuNotifyId = targetApp.connect('notify::menu', Lang.bind(this, this._sync));
this._actionGroupNotifyId = targetApp.connect('notify::action-group', Lang.bind(this, this._sync));
}
this._targetApp = targetApp;
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);