Avoid to reparse the activity registry on each activity start, hrm!
This commit is contained in:
parent
9786385baa
commit
5f912f0330
@ -23,7 +23,6 @@ import gobject
|
|||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
from sugar.presence import presenceservice
|
from sugar.presence import presenceservice
|
||||||
from sugar.activity import bundleregistry
|
|
||||||
from sugar.activity.activityhandle import ActivityHandle
|
from sugar.activity.activityhandle import ActivityHandle
|
||||||
from sugar import util
|
from sugar import util
|
||||||
|
|
||||||
@ -75,9 +74,7 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
def __init__(self, service_name, activity_handle):
|
def __init__(self, service_name, activity_handle):
|
||||||
"""Initialise the handler
|
"""Initialise the handler
|
||||||
|
|
||||||
service_name -- used to retrieve the activity bundle
|
service_name -- the service name of the bundle factory
|
||||||
from the global BundleRegistry. This is what
|
|
||||||
determines what activity will be run.
|
|
||||||
activity_handle -- stores the values which are to
|
activity_handle -- stores the values which are to
|
||||||
be passed to the service to uniquely identify
|
be passed to the service to uniquely identify
|
||||||
the activity to be created and the sharing
|
the activity to be created and the sharing
|
||||||
@ -100,16 +97,16 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
self._service_name = service_name
|
self._service_name = service_name
|
||||||
self._activity_handle = activity_handle
|
self._activity_handle = activity_handle
|
||||||
|
|
||||||
registry = bundleregistry.get_registry()
|
|
||||||
bundle = registry.get_bundle(service_name)
|
|
||||||
|
|
||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
proxy_obj = bus.get_object(service_name, bundle.get_object_path(), follow_name_owner_changes=True)
|
object_path = '/' + service_name.replace('.', '/')
|
||||||
|
proxy_obj = bus.get_object(service_name, object_path,
|
||||||
|
follow_name_owner_changes=True)
|
||||||
factory = dbus.Interface(proxy_obj, _ACTIVITY_FACTORY_INTERFACE)
|
factory = dbus.Interface(proxy_obj, _ACTIVITY_FACTORY_INTERFACE)
|
||||||
|
|
||||||
factory.create(self._activity_handle.get_dict(),
|
factory.create(self._activity_handle.get_dict(),
|
||||||
reply_handler=self._reply_handler,
|
reply_handler=self._reply_handler,
|
||||||
error_handler=self._error_handler)
|
error_handler=self._error_handler)
|
||||||
|
|
||||||
def get_activity_id(self):
|
def get_activity_id(self):
|
||||||
"""Retrieve the unique identity for this activity"""
|
"""Retrieve the unique identity for this activity"""
|
||||||
return self._activity_handle.activity_id
|
return self._activity_handle.activity_id
|
||||||
|
Loading…
Reference in New Issue
Block a user