Get rid of default type from the activity definition.
Modify code to use activity type id instead, except from mapping service to activity.
This commit is contained in:
@@ -18,11 +18,11 @@ class ActivityHost:
|
||||
|
||||
self._activity = dbus.Interface(proxy_obj, Activity.ACTIVITY_INTERFACE)
|
||||
self._id = self._activity.get_id()
|
||||
self._default_type = self._activity.get_default_type()
|
||||
self._type = self._activity.get_type()
|
||||
self._gdk_window = gtk.gdk.window_foreign_new(self._xid)
|
||||
|
||||
registry = conf.get_activity_registry()
|
||||
info = registry.get_activity(self._default_type)
|
||||
info = registry.get_activity(self._type)
|
||||
self._icon_name = info.get_icon()
|
||||
|
||||
def get_id(self):
|
||||
@@ -45,8 +45,8 @@ class ActivityHost:
|
||||
def get_shared(self):
|
||||
return self._activity.get_shared()
|
||||
|
||||
def get_default_type(self):
|
||||
return self._default_type
|
||||
def get_type(self):
|
||||
return self._type
|
||||
|
||||
def present(self):
|
||||
self._window.activate(gtk.get_current_event_time())
|
||||
|
||||
+6
-16
@@ -155,12 +155,12 @@ class Shell(gobject.GObject):
|
||||
activity = self.get_current_activity()
|
||||
if activity:
|
||||
registry = conf.get_activity_registry()
|
||||
module = registry.get_activity(activity.get_default_type())
|
||||
module = registry.get_activity(activity.get_type())
|
||||
self._console.set_page(module.get_id())
|
||||
|
||||
def join_activity(self, service):
|
||||
registry = conf.get_activity_registry()
|
||||
info = registry.get_activity(service.get_type())
|
||||
info = registry.get_activity_from_type(service.get_type())
|
||||
|
||||
activity_id = service.get_activity_id()
|
||||
|
||||
@@ -172,24 +172,14 @@ class Shell(gobject.GObject):
|
||||
|
||||
if activity_ps:
|
||||
activity = ActivityFactory.create(info.get_id())
|
||||
activity.set_default_type(service.get_type())
|
||||
activity.join(activity_ps.object_path())
|
||||
else:
|
||||
logging.error('Cannot start activity.')
|
||||
|
||||
def start_activity(self, activity_name):
|
||||
activity = ActivityFactory.create(activity_name)
|
||||
registry = conf.get_activity_registry()
|
||||
info = registry.get_activity_from_id(activity_name)
|
||||
if info:
|
||||
default_type = info.get_default_type()
|
||||
if default_type != None:
|
||||
activity.set_default_type(default_type)
|
||||
activity.execute('test', [])
|
||||
return activity
|
||||
else:
|
||||
logging.error('No such activity in the directory')
|
||||
return None
|
||||
def start_activity(self, activity_type):
|
||||
activity = ActivityFactory.create(activity_type)
|
||||
activity.execute('test', [])
|
||||
return activity
|
||||
|
||||
def get_chat_controller(self):
|
||||
return self._chat_controller
|
||||
|
||||
@@ -11,7 +11,7 @@ class ActivityItem(IconItem):
|
||||
def __init__(self, activity, size):
|
||||
icon_name = activity.get_icon()
|
||||
if not icon_name:
|
||||
act_type = activity.get_default_type()
|
||||
act_type = activity.get_type()
|
||||
raise RuntimeError("Activity %s did not have an icon!" % act_type)
|
||||
IconItem.__init__(self, icon_name=icon_name,
|
||||
color=IconColor('white'), size=size)
|
||||
|
||||
@@ -21,7 +21,7 @@ class ActivityItem(IconItem):
|
||||
|
||||
def get_icon_name(self):
|
||||
registry = conf.get_activity_registry()
|
||||
info = registry.get_activity(self._service.get_type())
|
||||
info = registry.get_activity_from_type(self._service.get_type())
|
||||
|
||||
return info.get_icon()
|
||||
|
||||
@@ -62,7 +62,7 @@ class MeshGroup(goocanvas.Group):
|
||||
|
||||
def __check_service(self, service):
|
||||
registry = conf.get_activity_registry()
|
||||
if registry.get_activity(service.get_type()) != None:
|
||||
if registry.get_activity_from_type(service.get_type()) != None:
|
||||
if not self.has_activity(service.get_activity_id()):
|
||||
self.add_activity(service)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user