Pass a serialized Service object through when joining an activity

This commit is contained in:
Dan Williams
2006-06-18 01:31:55 -04:00
parent 9f1c77a55a
commit 4e6cbab48e
4 changed files with 43 additions and 31 deletions
+4 -3
View File
@@ -111,9 +111,10 @@ class BrowserActivity(activity.Activity):
vbox.show()
# FIXME remove, when we join the activity this will happen automatically
self._pservice.track_activity(self.get_id())
# Join the shared activity if we were started from one
if self._initial_service:
self._pservice.join_shared_activity(self._initial_service)
def get_embed(self):
return self.embed
+11 -9
View File
@@ -8,6 +8,7 @@ import gobject
import sugar.env
from sugar.browser.BrowserActivity import BrowserActivity
from sugar.presence import Service
class BrowserShell(dbus.service.Object):
def __init__(self, bus_name, object_path = '/com/redhat/Sugar/Browser'):
@@ -30,20 +31,21 @@ class BrowserShell(dbus.service.Object):
links.append(link)
return links
def _start_browser_cb(self, browser, activity_id):
if activity_id:
browser.connect_to_shell(activity_id)
else:
browser.connect_to_shell()
def _start_browser_cb(self, browser, service):
browser.connect_to_shell(service)
@dbus.service.method('com.redhat.Sugar.BrowserShell')
def open_browser(self, uri):
def open_browser(self, uri, serialized_service=None):
service = None
if serialized_service is not None:
serivce = Service.deserialize(serialized_service)
browser = BrowserActivity(uri)
self.__browsers.append(browser)
gobject.idle_add(self._start_browser_cb, browser, None)
gobject.idle_add(self._start_browser_cb, browser, service)
@dbus.service.method('com.redhat.Sugar.BrowserShell')
def open_browser_with_id(self, uri, activity_id):
def open_browser_from_service_foobar(self, uri, serialized_service):
serivce = Service.deserialize(serialized_service)
browser = BrowserActivity(uri)
self.__browsers.append(browser)
gobject.idle_add(self._start_browser_cb, browser, activity_id)
gobject.idle_add(self._start_browser_cb, browser, service)