[gnome-shell] remoteMenu: Split the tracking code out of RemoteMenu
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] remoteMenu: Split the tracking code out of RemoteMenu
- Date: Mon, 13 May 2013 22:35:06 +0000 (UTC)
commit 026f61f5aab08d7183f5c1cc1b14c61d8f88f1c6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu May 9 17:32:52 2013 -0400
remoteMenu: Split the tracking code out of RemoteMenu
The tracking logic will be used to more easily implement submenus.
https://bugzilla.gnome.org/show_bug.cgi?id=700257
js/ui/remoteMenu.js | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/js/ui/remoteMenu.js b/js/ui/remoteMenu.js
index 758d79a..7d6d7e0 100644
--- a/js/ui/remoteMenu.js
+++ b/js/ui/remoteMenu.js
@@ -19,6 +19,25 @@ function stripMnemonics(label) {
return label.replace(/_([^_])/, '$1');
}
+function _insertItem(menu, trackerItem, position) {
+ let item;
+
+ if (trackerItem.get_is_separator()) {
+ let mapper = new RemoteMenuSeparatorItemMapper(trackerItem);
+ item = mapper.menuItem;
+ } else {
+ let mapper = new RemoteMenuItemMapper(trackerItem);
+ item = mapper.menuItem;
+ }
+
+ menu.addMenuItem(item, position);
+}
+
+function _removeItem(menu, position) {
+ let items = menu._getMenuItems();
+ items[position].destroy();
+}
+
const RemoteMenuSeparatorItemMapper = new Lang.Class({
Name: 'RemoteMenuSeparatorItemMapper',
@@ -114,31 +133,12 @@ const RemoteMenu = new Lang.Class({
this._tracker = Shell.MenuTracker.new(this._actionGroup,
this._model,
null, /* action namespace */
- Lang.bind(this, this._insertItem),
- Lang.bind(this, this._removeItem));
+ _insertItem.bind(null, this),
+ _removeItem.bind(null, this));
},
destroy: function() {
this._tracker.destroy();
this.parent();
},
-
- _insertItem: function(trackerItem, position) {
- let item;
-
- if (trackerItem.get_is_separator()) {
- let mapper = new RemoteMenuSeparatorItemMapper(trackerItem);
- item = mapper.menuItem;
- } else {
- let mapper = new RemoteMenuItemMapper(trackerItem);
- item = mapper.menuItem;
- }
-
- this.addMenuItem(item, position);
- },
-
- _removeItem: function(position) {
- let items = this._getMenuItems();
- items[position].destroy();
- },
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]