[gnome-documents/wip/provider-v2: 1/5] manager: save a reference to the manager in items
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/provider-v2: 1/5] manager: save a reference to the manager in items
- Date: Sat, 8 Dec 2012 04:17:27 +0000 (UTC)
commit 90169c1a78b443ddcca463bfeaa6ce8eb90a851c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Dec 7 14:25:47 2012 -0500
manager: save a reference to the manager in items
This is useful when an item wants to call a method on its manager
without needing to go through Global.
src/manager.js | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/manager.js b/src/manager.js
index f850412..17171f3 100644
--- a/src/manager.js
+++ b/src/manager.js
@@ -54,6 +54,7 @@ const BaseManager = new Lang.Class({
},
addItem: function(item) {
+ item._manager = this;
this._items[item.id] = item;
this.emit('item-added', item);
},
@@ -96,6 +97,7 @@ const BaseManager = new Lang.Class({
if (item) {
delete this._items[id];
this.emit('item-removed', item);
+ item._manager = null;
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]