summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-31 06:08:33 (GMT)
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-31 06:08:33 (GMT)
commit0d4da2b96df289d1ef47c64ad07546a9cb28fb9e (patch)
treeeac151d17f11eedfd01299c2f2f3bb03ff994eab
parentccacbef435701f1bdada1d50332df628a3c269f2 (diff)
downloadtelepathy-doc-0d4da2b96df289d1ef47c64ad07546a9cb28fb9e.tar.gz
telepathy-doc-0d4da2b96df289d1ef47c64ad07546a9cb28fb9e.tar.xz
Minor fixes to clean up signals for EConnection
-rw-r--r--docs/examples/python_mc5_clients/observer2.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/examples/python_mc5_clients/observer2.py b/docs/examples/python_mc5_clients/observer2.py
index c367435..b731915 100644
--- a/docs/examples/python_mc5_clients/observer2.py
+++ b/docs/examples/python_mc5_clients/observer2.py
@@ -19,6 +19,7 @@ class EConnection(gobject.GObject,
service_name = path.replace('/', '.')[1:]
self.ready_handler = ready_handler
+ self.signals = []
gobject.GObject.__init__(self)
telepathy.client.Connection.__init__(self, service_name, path,
@@ -29,6 +30,9 @@ class EConnection(gobject.GObject,
def _status_changed(self, status, reason):
if status == CONNECTION_STATUS_DISCONNECTED:
+ for signal in self.signals:
+ signal.remove()
+
self.emit('disconnected')
def _connection_ready(self, conn):
@@ -42,8 +46,8 @@ class EConnection(gobject.GObject,
'ContactAttributeInterfaces',
reply_handler=reply, error_handler=error)
- self[CONNECTION].connect_to_signal('StatusChanged',
- self._status_changed)
+ self.signals.append(self[CONNECTION].connect_to_signal(
+ 'StatusChanged', self._status_changed))
def do_disconnect(self):
# required so that we don't transmit this over D-Bus
@@ -62,6 +66,7 @@ class EChannel(gobject.GObject,
self.account_path = account_path
self.conn = conn
self.properties = properties
+ self.signals = []
gobject.GObject.__init__(self)
telepathy.client.Channel.__init__(self, conn.service_name, path,
@@ -70,8 +75,6 @@ class EChannel(gobject.GObject,
self._first_timestamp = None
self._last_timestamp = None
- self.signals = []
-
def __repr__(self):
return 'EChannel(%s)' % self.object_path