[gnome-shell] factor out _createSource
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] factor out _createSource
- Date: Wed, 16 Feb 2011 09:16:25 +0000 (UTC)
commit ccd2fec890c10a4b72ce49652f7a8145801da1d3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Feb 9 11:35:50 2011 +0100
factor out _createSource
js/ui/telepathyClient.js | 37 +++++++++++++++----------------------
1 files changed, 15 insertions(+), 22 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 73d8ec3..f9d61fd 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -79,17 +79,6 @@ Client.prototype = {
targetHandleType != Tp.HandleType.CONTACT)
continue;
- if (this._sources[connPath + ':' + targetHandle])
- continue;
-
- let source = new Source(account, conn, chan);
-
- this._sources[connPath + ':' + targetHandle] = source;
- source.connect('destroy', Lang.bind(this,
- function() {
- delete this._sources[connPath + ':' + targetHandle];
- }));
-
/* Request a TpContact */
Shell.get_tp_contacts(conn, 1, [targetHandle],
contactFeatures.length, contactFeatures,
@@ -98,21 +87,25 @@ Client.prototype = {
return;
/* We got the TpContact */
- if (this._sources[chan.get_object_path()])
- return;
-
- let source = new Source(account, conn, chan, contacts[0]);
-
- this._sources[chan.get_object_path()] = source;
- source.connect('destroy', Lang.bind(this,
- function() {
- delete this._sources[chan.get_object_path()];
- }));
- }));
+ this._createSource(account, conn, channel, contacts[0]);
+ }), null);
}
// Allow dbus method to return
context.accept();
+ },
+
+ _createSource: function(account, conn, channel, contact) {
+ if (this._sources[channel.get_object_path()])
+ return;
+
+ let source = new Source(account, conn, channel, contact);
+
+ this._sources[channel.get_object_path()] = source;
+ source.connect('destroy', Lang.bind(this,
+ function() {
+ delete this._sources[channel.get_object_path()];
+ }));
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]