Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-04-11 19:08:40 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-04-11 19:08:40 (GMT)
commit894fcea9fca5908efb8b4f0edb81f7f2f9f55464 (patch)
treed52f7366aa9fca79b9ca96bf8c01e79315f4ec2f
parenteeb09294d8713c6b8a1e3d7b8b53e692b989cdcb (diff)
Remove get_default_type() and bundle default types; obsolete
-rw-r--r--shell/model/MeshModel.py2
-rw-r--r--shell/view/Shell.py7
-rw-r--r--shell/view/home/MeshBox.py2
-rw-r--r--sugar/activity/activity.py25
-rw-r--r--sugar/activity/activityfactoryservice.py1
-rw-r--r--sugar/activity/bundle.py7
-rw-r--r--sugar/activity/bundleregistry.py7
7 files changed, 9 insertions, 42 deletions
diff --git a/shell/model/MeshModel.py b/shell/model/MeshModel.py
index b14d6f7..dd25d9f 100644
--- a/shell/model/MeshModel.py
+++ b/shell/model/MeshModel.py
@@ -38,6 +38,8 @@ class ActivityModel:
def get_color(self):
return XoColor(self._activity.get_color())
+ def get_service_name(self):
+ return self._bundle.get_service_name()
class MeshModel(gobject.GObject):
__gsignals__ = {
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index 6d74f29..391657d 100644
--- a/shell/view/Shell.py
+++ b/shell/view/Shell.py
@@ -114,19 +114,18 @@ class Shell(gobject.GObject):
# we have a bundle on the system capable of handling
# this activity type
breg = self._model.get_bundle_registry()
- bundle = breg.find_by_default_type(bundle_id)
+ bundle = breg.get_bundle(bundle_id)
if not bundle:
logging.error("Couldn't find activity for type %s" % bundle_id)
return
- act_type = bundle.get_service_name()
home_model = self._model.get_home()
- home_model.notify_activity_launch(activity_id, act_type)
+ home_model.notify_activity_launch(activity_id, bundle_id)
handle = ActivityHandle(activity_id)
handle.pservice_id = activity_id
- handler = activityfactory.create(act_type, handle)
+ handler = activityfactory.create(bundle_id, handle)
handler.connect('error', self._join_error_cb, home_model)
def _start_error_cb(self, handler, err, home_model):
diff --git a/shell/view/home/MeshBox.py b/shell/view/home/MeshBox.py
index 40347f3..218a44d 100644
--- a/shell/view/home/MeshBox.py
+++ b/shell/view/home/MeshBox.py
@@ -189,7 +189,7 @@ class ActivityView(SnowflakeBox):
del self._icons[key]
def _clicked_cb(self, item):
- bundle_id = self._model.get_service().get_type()
+ bundle_id = self._model.get_service().get_service_name()
self._shell.join_activity(bundle_id, self._model.get_id())
class MeshBox(SpreadBox):
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py
index fe0780c..5360253 100644
--- a/sugar/activity/activity.py
+++ b/sugar/activity/activity.py
@@ -85,10 +85,6 @@ class Activity(Window, gtk.Container):
"""Gets the activity service name."""
return os.environ['SUGAR_BUNDLE_SERVICE_NAME']
- def get_default_type(self):
- """Gets the type of the default activity network service"""
- return os.environ['SUGAR_BUNDLE_DEFAULT_TYPE']
-
def get_shared(self):
"""Returns TRUE if the activity is shared on the mesh."""
return self._shared
@@ -98,31 +94,16 @@ class Activity(Window, gtk.Container):
return self._activity_id
def _join(self, service):
+ """Join an existing instance of this activity on the network."""
self._service = service
self._shared = True
-
- # Publish the default service, it's a copy of
- # one of those we found on the network.
- default_type = self.get_default_type()
- services = activity_ps.get_services_of_type(default_type)
- if len(services) > 0:
- service = services[0]
- addr = service.get_address()
- port = service.get_port()
- properties = service.get_published_values()
- self._service = self._pservice.share_activity(
- self, default_type, properties, addr, port)
- else:
- logging.error('Cannot join the activity')
-
+ self._service.join()
self.present()
def share(self):
"""Share the activity on the network."""
logging.debug('Share activity %s on the network.' % self.get_id())
-
- default_type = self.get_default_type()
- self._service = self._pservice.share_activity(self, default_type)
+ self._service = self._pservice.share_activity(self)
self._shared = True
def execute(self, command, args):
diff --git a/sugar/activity/activityfactoryservice.py b/sugar/activity/activityfactoryservice.py
index 08b5eec..cf51f9c 100644
--- a/sugar/activity/activityfactoryservice.py
+++ b/sugar/activity/activityfactoryservice.py
@@ -150,7 +150,6 @@ def run(bundle_path):
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
os.environ['SUGAR_BUNDLE_SERVICE_NAME'] = bundle.get_service_name()
- os.environ['SUGAR_BUNDLE_DEFAULT_TYPE'] = bundle.get_default_type()
factory = ActivityFactoryService(bundle.get_service_name(),
bundle.get_class())
diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py
index b8172e0..98b9e9a 100644
--- a/sugar/activity/bundle.py
+++ b/sugar/activity/bundle.py
@@ -146,13 +146,6 @@ class Bundle:
"""Get the path to the service object"""
return '/' + self._service_name.replace('.', '/')
- def get_default_type(self):
- """Get the type of the main network service which tracks presence
- and provides info about the activity, for example the title."""
- splitted = self.get_service_name().split('.')
- splitted.reverse()
- return '_' + '_'.join(splitted) + '._udp'
-
def get_icon(self):
"""Get the activity icon name"""
return self._icon
diff --git a/sugar/activity/bundleregistry.py b/sugar/activity/bundleregistry.py
index 8469688..0cad4b2 100644
--- a/sugar/activity/bundleregistry.py
+++ b/sugar/activity/bundleregistry.py
@@ -93,13 +93,6 @@ class BundleRegistry(gobject.GObject):
else:
return None
- def find_by_default_type(self, default_type):
- """Find a bundle by the network service default type"""
- for bundle in self._bundles.values():
- if bundle.get_default_type() == default_type:
- return bundle
- return None
-
def add_search_path(self, path):
"""Add a directory to the bundles search path"""
self._search_path.append(path)