Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-09-06 15:48:08 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-09-06 15:48:08 (GMT)
commit885d118b31651bf381b40f6bf10cbd8b28cdc915 (patch)
tree1a5f93aeecf15d95595522ed3e375ac5ad339556
parent9274970085bf850ed885d101fc3f1cade99f9a78 (diff)
Set param-register to False after a RegistrationExists error #2296
-rw-r--r--src/jarabe/model/neighborhood.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 3e89855..9ec6322 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -199,11 +199,31 @@ class _Account(gobject.GObject):
logging.debug('_Account.__got_connection_cb %r', connection_path)
if connection_path == '/':
- # Account has no connection, wait until it has one.
+ self._check_registration_error()
return
self._prepare_connection(connection_path)
+ def _check_registration_error(self):
+ """
+ See if a previous connection attempt failed and we need to unset
+ the register flag.
+ """
+ bus = dbus.Bus()
+ obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, self.object_path)
+ obj.Get(ACCOUNT, 'ConnectionError',
+ reply_handler=self.__got_connection_error_cb,
+ error_handler=partial(self.__error_handler_cb,
+ 'Account.GetConnectionError'))
+
+ def __got_connection_error_cb(self, error):
+ logging.debug('_Account.__got_connection_error_cb %r', error)
+ if error == 'org.freedesktop.Telepathy.Error.RegistrationExists':
+ bus = dbus.Bus()
+ obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, self.object_path)
+ obj.UpdateParameters({'register': False}, [],
+ dbus_interface=ACCOUNT)
+
def __account_property_changed_cb(self, properties):
logging.debug('_Account.__account_property_changed_cb %r %r %r',
self.object_path, properties.get('Connection', None),
@@ -211,6 +231,7 @@ class _Account(gobject.GObject):
if 'Connection' not in properties:
return
if properties['Connection'] == '/':
+ self._check_registration_error()
self._connection = None
elif self._connection is None:
self._prepare_connection(properties['Connection'])