Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/activity
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-09-02 08:54:34 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-09-02 08:54:34 (GMT)
commit58a79eb1234f1681af033ff8711c3dbc6baa00b0 (patch)
tree97c3bdabc8ddc97ba885d17883410ba0914c1cb6 /sugar/activity
parent8ffff18bc330540d38a8188a79e53467dcf19874 (diff)
Get rid of default type from the activity definition.
Modify code to use activity type id instead, except from mapping service to activity.
Diffstat (limited to 'sugar/activity')
-rw-r--r--sugar/activity/Activity.py29
-rw-r--r--sugar/activity/ActivityFactory.py7
2 files changed, 19 insertions, 17 deletions
diff --git a/sugar/activity/Activity.py b/sugar/activity/Activity.py
index de6218a..62fbed6 100644
--- a/sugar/activity/Activity.py
+++ b/sugar/activity/Activity.py
@@ -7,6 +7,7 @@ import gtk
import gobject
from sugar.presence.PresenceService import PresenceService
+from sugar.conf import ActivityRegistry
import sugar.util
ACTIVITY_SERVICE_NAME = "org.laptop.Activity"
@@ -47,14 +48,14 @@ class ActivityDbusService(dbus.service.Object):
return self._activity.get_id()
@dbus.service.method(ACTIVITY_INTERFACE)
- def get_default_type(self):
- """Get the activity default type"""
- return self._activity.get_default_type()
+ def get_type(self):
+ """Get the activity type"""
+ return self._activity.get_type()
@dbus.service.method(ACTIVITY_INTERFACE)
- def set_default_type(self, default_type):
- """Set the activity default type"""
- self._activity.set_default_type(default_type)
+ def set_type(self, activity_type):
+ """Set the activity type"""
+ self._activity.set_type(activity_type)
@dbus.service.method(ACTIVITY_INTERFACE)
def get_shared(self):
@@ -92,16 +93,14 @@ class Activity(gtk.Window):
self._bus = ActivityDbusService(bus_name, get_object_path(xid))
self._bus.start(self._pservice, self)
- def set_default_type(self, default_type):
- """Set the activity default type.
+ def set_type(self, activity_type):
+ """Sets the activity type."""
+ self._activity_type = activity_type
+ self._default_type = ActivityRegistry.get_default_type(activity_type)
- It's the type of the main network service which tracks presence
- and provides info about the activity, for example the title."""
- self._default_type = default_type
-
- def get_default_type(self):
- """Get the activity default type."""
- return self._default_type
+ def get_type(self):
+ """Gets the activity type."""
+ return self._activity_type
def get_shared(self):
"""Returns TRUE if the activity is shared on the mesh."""
diff --git a/sugar/activity/ActivityFactory.py b/sugar/activity/ActivityFactory.py
index 3d47def..e7a991b 100644
--- a/sugar/activity/ActivityFactory.py
+++ b/sugar/activity/ActivityFactory.py
@@ -19,7 +19,9 @@ def _get_factory(activity_name):
class ActivityFactory(dbus.service.Object):
"""Dbus service that takes care of creating new instances of an activity"""
- def __init__(self, name, activity_class):
+ def __init__(self, activity_type, activity_class):
+ self._activity_type = activity_type
+
splitted_module = activity_class.rsplit('.', 1)
module_name = splitted_module[0]
class_name = splitted_module[1]
@@ -31,13 +33,14 @@ class ActivityFactory(dbus.service.Object):
self._class = getattr(module, class_name)
bus = dbus.SessionBus()
- factory = _get_factory(name)
+ factory = _get_factory(activity_type)
bus_name = dbus.service.BusName(factory, bus = bus)
dbus.service.Object.__init__(self, bus_name, get_path(factory))
@dbus.service.method("com.redhat.Sugar.ActivityFactory")
def create(self):
activity = self._class()
+ activity.set_type(self._activity_type)
return activity.window.xid
def create(activity_name):