Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-08-08 23:50:35 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-08-08 23:50:35 (GMT)
commit7ab6da7278b2a8d50db43f7737ed145e8f27ae7a (patch)
tree51c48ee20ea57c4c196f0ebb8c40e646fa9ecd4e /sugar
parentc6d59fd7b44e65d33cb0a607c1321f1a62405aa2 (diff)
Actually join the activity, check for duplicates in the model.
Diffstat (limited to 'sugar')
-rw-r--r--sugar/activity/Activity.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py
index ce036e9..c1e9297 100644
--- a/sugar/activity/Activity.py
+++ b/sugar/activity/Activity.py
@@ -1,4 +1,5 @@
import sys
+import logging
import dbus
import dbus.service
@@ -116,7 +117,7 @@ class ActivityDbusService(dbus.service.Object):
@dbus.service.method(ACTIVITY_SERVICE_NAME)
def get_shared(self):
- """Get the activity identifier"""
+ """Returns True if the activity is shared on the mesh."""
return self._activity.get_shared()
class Activity(gtk.Window):
@@ -165,10 +166,23 @@ class Activity(gtk.Window):
return self._activity_id
def join(self, activity_ps):
- """Join an activity shared on the network"""
+ """Join an activity shared on the network."""
self._shared = True
self._activity_id = activity_ps.get_id()
+ # Publish the default service, it's a copy of
+ # one of those we found on the network.
+ services = activity_ps.get_services_of_type(self._default_type)
+ if len(services) > 0:
+ service = services[0]
+ addr = service.get_address()
+ port = service.get_port()
+ properties = { 'title' : service.get_published_value('title') }
+ self._service = self._pservice.share_activity(self,
+ self._default_type, properties, addr, port)
+ else:
+ logging.error('Cannot join the activity')
+
def share(self):
"""Share the activity on the network."""
properties = { 'title' : self.get_title() }