[gnome-shell] stop looking for existing channels manually
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] stop looking for existing channels manually
- Date: Wed, 16 Feb 2011 09:15:35 +0000 (UTC)
commit b750dde05b1d52562f8dd073020046b38632fb3d
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Feb 8 11:04:22 2011 +0100
stop looking for existing channels manually
Mission-control will give them to you as we have Recover=True on the Observer.
js/ui/telepathyClient.js | 85 +---------------------------------------------
1 files changed, 1 insertions(+), 84 deletions(-)
---
diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js
index 95313f0..d6e0aa8 100644
--- a/js/ui/telepathyClient.js
+++ b/js/ui/telepathyClient.js
@@ -56,28 +56,12 @@ Client.prototype = {
Tp.CHANNEL_DISPATCHER_BUS_NAME,
Tp.CHANNEL_DISPATCHER_OBJECT_PATH);
- // Acquire existing connections. (Needed to make things work
- // through a restart.)
- let accountManager = new Telepathy.AccountManager(DBus.session,
- Tp.ACCOUNT_MANAGER_BUS_NAME,
- Tp.ACCOUNT_MANAGER_OBJECT_PATH);
-
- accountManager.GetRemote('ValidAccounts', Lang.bind(this,
- function (accounts, err) {
- if (!accounts)
- return;
-
- for (let i = 0; i < accounts.length; i++)
- this._gotAccount(accounts[i]);
- }));
- accountManager.connect('AccountValidityChanged', Lang.bind(this, this._accountValidityChanged));
-
// Set up a SimpleObserver, which will call _observeChannels whenever a
// channel matching its filters is detected.
// The second argument, recover, means _observeChannels will be run
// for any existing channel as well.
let dbus = Tp.DBusDaemon.dup();
- this._observer = Tp.SimpleObserver.new(dbus, false, 'GnomeShell', true,
+ this._observer = Tp.SimpleObserver.new(dbus, true, 'GnomeShell', true,
Lang.bind(this, this._observeChannels));
// We only care about single-user text-based chats
@@ -130,73 +114,6 @@ Client.prototype = {
context.accept();
},
- _accountValidityChanged: function(accountManager, accountPath, valid) {
- if (!valid) {
- delete this._accounts[accountPath];
- // We don't need to clean up connections, sources, etc; they'll
- // get Closed and cleaned up independently.
- } else
- this._gotAccount(accountPath);
- },
-
- _gotAccount: function(accountPath) {
- let account = new Telepathy.Account(DBus.session,
- Tp.ACCOUNT_MANAGER_BUS_NAME,
- accountPath);
- this._accounts[accountPath] = account;
- account.GetRemote('Connection', Lang.bind(this,
- function (connPath, err) {
- if (!connPath || connPath == '/')
- return;
-
- let connReq = new Telepathy.ConnectionRequests(DBus.session,
- Telepathy.pathToName(connPath),
- connPath);
- connReq.GetRemote('Channels', Lang.bind(this,
- function(channels, err) {
- if (!channels)
- return;
-
- this._addChannels(accountPath, connPath, channels);
- }));
-
- contactManager.addConnection(connPath);
- }));
- },
-
- _addChannels: function(accountPath, connPath, channelDetailsList) {
- for (let i = 0; i < channelDetailsList.length; i++) {
- let [channelPath, props] = channelDetailsList[i];
-
- // If this is being called from the startup code then it
- // won't have passed through our filters, so we need to
- // check the channel/targetHandle type ourselves.
-
- let channelType = props[Tp.PROP_CHANNEL_CHANNEL_TYPE];
- if (channelType != Tp.IFACE_CHANNEL_TYPE_TEXT)
- continue;
-
- let targetHandleType = props[Tp.PROP_CHANNEL_TARGET_HANDLE_TYPE];
- if (targetHandleType != Tp.HandleType.CONTACT &&
- targetHandleType != Tp.HandleType.NONE)
- continue;
-
- let targetHandle = props[Tp.PROP_CHANNEL_TARGET_HANDLE];
- let targetId = props[Tp.PROP_CHANNEL_TARGET_ID];
-
- if (this._sources[connPath + ':' + targetHandle])
- continue;
-
- let source = new Source(accountPath, connPath, channelPath,
- targetHandle, targetHandleType, targetId);
- this._sources[connPath + ':' + targetHandle] = source;
- source.connect('destroy', Lang.bind(this,
- function() {
- delete this._sources[connPath + ':' + targetHandle];
- }));
- }
- },
-
_presenceChanged: function(contactManager, connPath, handle,
type, message) {
let source = this._sources[connPath + ':' + handle];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]