Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2008-10-29 10:39:46 (GMT)
committer Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>2008-10-29 10:39:46 (GMT)
commitfe62b74c2e2efab69191fc42de9fc6f6dcd2b506 (patch)
treed5902ecfe60fb72c72698021cbd96bbbe2616132 /src
parent50ad58f1b41d2ccaf2dd5e6f9ee7422d366e1441 (diff)
parentbe000b84871de2015a10fdb41c07e77b7ed979f9 (diff)
Merge branch '8900'
Conflicts: src/jarabe/model/neighborhood.py
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/model/neighborhood.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index e849330..e36a876 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -27,7 +27,8 @@ from jarabe.model import bundleregistry
from jarabe.util.telepathy import connection_watcher
from dbus import PROPERTIES_IFACE
-from telepathy.interfaces import CONNECTION_INTERFACE_REQUESTS
+from telepathy.interfaces import CONNECTION_INTERFACE_REQUESTS, CHANNEL_INTERFACE
+from telepathy.client import Channel
CONN_INTERFACE_GADGET = 'org.laptop.Telepathy.Gadget'
CHAN_INTERFACE_VIEW = 'org.laptop.Telepathy.Channel.Interface.View'
@@ -129,21 +130,31 @@ class Neighborhood(gobject.GObject):
def _request_random_buddies(self, conn, nb):
logging.debug("Request %d random buddies" % nb)
- conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel(
+ path, props = conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel(
{ 'org.freedesktop.Telepathy.Channel.ChannelType':
'org.laptop.Telepathy.Channel.Type.BuddyView',
'org.laptop.Telepathy.Channel.Interface.View.MaxSize': nb
})
+ view = Channel(conn.service_name, path)
+ view[CHANNEL_INTERFACE].connect_to_signal('Closed',
+ lambda: self.__respawnable_view_closed_cb(
+ lambda: self._request_random_buddies(conn, nb)))
+
def _request_random_activities(self, conn, nb):
logging.debug("Request %d random activities" % nb)
- conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel(
+ path, props = conn[CONNECTION_INTERFACE_REQUESTS].CreateChannel(
{ 'org.freedesktop.Telepathy.Channel.ChannelType':
'org.laptop.Telepathy.Channel.Type.ActivityView',
'org.laptop.Telepathy.Channel.Interface.View.MaxSize': nb
})
+ view = Channel(conn.service_name, path)
+ view[CHANNEL_INTERFACE].connect_to_signal('Closed',
+ lambda: self.__respawnable_view_closed_cb(
+ lambda: self._request_random_activities(conn, nb)))
+
def __publish_gadget_changed_cb(self, client_, cnxn_id_, entry, user_data=None):
if entry.value.type == gconf.VALUE_BOOL:
publish = entry.value.get_bool()
@@ -160,6 +171,13 @@ class Neighborhood(gobject.GObject):
(conn.service_name.split('.')[-1], publish))
conn[CONN_INTERFACE_GADGET].Publish(publish)
+ def __respawnable_view_closed_cb(self, request_fct):
+ # Views are closed if the Gadget component is restarted. As we always
+ # want to have the random views opened, we re-request them if they are
+ # closed.
+ logging.debug('View closed. Re-request it')
+ request_fct()
+
def _get_buddies_cb(self, buddy_list):
for buddy in buddy_list:
self._buddy_appeared_cb(self._pservice, buddy)