[gnome-shell/wip/message-tray-menu: 5/25] popupMenu: Add support for action namespaces
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/message-tray-menu: 5/25] popupMenu: Add support for action namespaces
- Date: Thu, 25 Apr 2013 19:04:44 +0000 (UTC)
commit 9b0cf4bf7ab231f323e3c9e7c9902320e21ee90e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Apr 23 16:49:43 2013 -0400
popupMenu: Add support for action namespaces
js/ui/popupMenu.js | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 71cccfe..53b075a 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1789,7 +1789,7 @@ const RemoteMenu = new Lang.Class({
this.actionGroup = actionGroup;
this._actions = {};
- this._trackMenu(model, this);
+ this._trackMenu(model, this, null);
this._actionStateChangeId = this.actionGroup.connect('action-state-changed', Lang.bind(this,
this._actionStateChanged));
this._actionEnableChangeId = this.actionGroup.connect('action-enabled-changed', Lang.bind(this,
this._actionEnabledChanged));
@@ -1869,9 +1869,9 @@ const RemoteMenu = new Lang.Class({
}));
},
- _trackMenu: function(model, item) {
+ _trackMenu: function(model, item, action_namespace) {
item._tracker = Shell.MenuTracker.new(model,
- null, /* action namespace */
+ action_namespace,
Lang.bind(this, this._insertItem, item),
Lang.bind(this, this._removeItem, item));
@@ -1881,7 +1881,7 @@ const RemoteMenu = new Lang.Class({
});
},
- _createMenuItem: function(model, index) {
+ _createMenuItem: function(model, index, action_namespace) {
let labelValue = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_LABEL, null);
let label = labelValue ? labelValue.deep_unpack() : '';
// remove all underscores that are not followed by another underscore
@@ -1889,13 +1889,16 @@ const RemoteMenu = new Lang.Class({
let submenuModel = model.get_item_link(index, Gio.MENU_LINK_SUBMENU);
if (submenuModel) {
+ let section_namespace = model.get_item_attribute_value(index,
Gio.MENU_ATTRIBUTE_ACTION_NAMESPACE, null).deep_unpack();
let item = new PopupSubMenuMenuItem(label);
- this._trackMenu(submenuModel, item.menu);
+ this._trackMenu(submenuModel, item.menu, action_namespace + '.' + section_namespace);
return item;
}
let item = new PopupMenuItem(label);
let action_id = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_ACTION, null).deep_unpack();
+ if (action_namespace)
+ action_id = action_namespace + '.' + action_id;
item.actor.can_focus = item.actor.reactive = false;
item.action_id = action_id;
@@ -1960,7 +1963,7 @@ const RemoteMenu = new Lang.Class({
if (is_separator)
item = new PopupSeparatorMenuItem();
else
- item = this._createMenuItem(model, item_index);
+ item = this._createMenuItem(model, item_index, action_namespace);
target.addMenuItem(item, position);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]