App menu: only create the popup menu with a GMenu

Since the application proxy is created asynchronously, at the time
the GActionGroup (GActionMuxer) is created, there is no GDBusMenu yet.
Defer creating the menu in that case.
Also, clear out signal handlers if have no target application.

https://bugzilla.gnome.org/show_bug.cgi?id=633028
This commit is contained in:
Giovanni Campagna 2012-01-09 16:31:44 +01:00
parent 11637bae43
commit 1bac40fbe3

View File

@ -528,6 +528,9 @@ const AppMenuButton = new Lang.Class({
if (targetApp) { if (targetApp) {
this._appMenuNotifyId = targetApp.connect('notify::menu', Lang.bind(this, this._sync)); this._appMenuNotifyId = targetApp.connect('notify::menu', Lang.bind(this, this._sync));
this._actionGroupNotifyId = targetApp.connect('notify::action-group', Lang.bind(this, this._sync)); this._actionGroupNotifyId = targetApp.connect('notify::action-group', Lang.bind(this, this._sync));
} else {
this._appMenuNotifyId = 0;
this._actionGroupNotifyId = 0;
} }
this._targetApp = targetApp; this._targetApp = targetApp;
@ -549,7 +552,7 @@ const AppMenuButton = new Lang.Class({
_maybeSetMenu: function() { _maybeSetMenu: function() {
let menu; let menu;
if (this._targetApp.action_group) { if (this._targetApp.action_group && this._targetApp.menu) {
if (this.menu instanceof PopupMenu.RemoteMenu && if (this.menu instanceof PopupMenu.RemoteMenu &&
this.menu.actionGroup == this._targetApp.action_group) this.menu.actionGroup == this._targetApp.action_group)
return; return;