Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/presence/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/presence/util.py')
-rw-r--r--src/sugar/presence/util.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sugar/presence/util.py b/src/sugar/presence/util.py
index 265e390..f00228f 100644
--- a/src/sugar/presence/util.py
+++ b/src/sugar/presence/util.py
@@ -10,7 +10,7 @@ ACCOUNT_MANAGER_PATH = '/org/freedesktop/Telepathy/AccountManager'
class ConnectionManager(object):
def __init__(self):
- self.connections_per_account = []
+ self._connections_per_account = {}
bus = dbus.SessionBus()
obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, ACCOUNT_MANAGER_PATH)
@@ -32,11 +32,11 @@ class ConnectionManager(object):
connection_name = connection_path.replace('/', '.')[1:]
connection = bus.get_object(connection_name, connection_path)
- self.connections[account_path] = connection
+ self._connections_per_account[account_path] = connection
def get_preferred_connection(self):
best_connection = None, None
- for account_path, connection in self.connections.items():
+ for account_path, connection in self._connections_per_account.items():
if 'salut' in connection.object_path:
best_connection = account_path, connection
elif 'gabble' in connection.object_path:
@@ -44,6 +44,14 @@ class ConnectionManager(object):
break
return best_connection
+ def get_connection(self, account_path):
+ return self._connections_per_account[account_path]
+
+ def get_connections(self):
+ return self._connections_per_account.values()
+
+ connections = property(get_connections)
+
_connection_manager = None
def get_connection_manager():