From ddecddcb420a9f87b203d0f228c6e41b65af5e53 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 03 Jul 2007 18:55:46 +0000 Subject: Remove unused methods from the activity services. Cleanups. --- diff --git a/shell/model/homeactivity.py b/shell/model/homeactivity.py index 3358bf3..f79bcc8 100644 --- a/shell/model/homeactivity.py +++ b/shell/model/homeactivity.py @@ -24,6 +24,10 @@ from sugar.graphics.xocolor import XoColor from sugar.presence import presenceservice from sugar import profile +_SERVICE_NAME = "org.laptop.Activity" +_SERVICE_PATH = "/org/laptop/Activity" +_SERVICE_INTERFACE = "org.laptop.Activity" + class HomeActivity(gobject.GObject): """Activity which appears in the "Home View" of the Sugar shell @@ -70,9 +74,6 @@ class HomeActivity(gobject.GObject): self._window = window self._xid = window.get_xid() - def set_service(self, service): - self._service = service - def get_service(self): """Retrieve the application's sugar introspection service @@ -80,7 +81,16 @@ class HomeActivity(gobject.GObject): such a service, so the return value will be None in those cases. """ - return self._service + bus = dbus.SessionBus() + try: + service = dbus.Interface( + bus.get_object(_SERVICE_NAME + self._activity_id, + _SERVICE_PATH + "/" + self._activity_id), + _SERVICE_INTERFACE) + except dbus.DBusException: + service = None + + return service def get_title(self): """Retrieve the application's root window's suggested title""" @@ -142,10 +152,6 @@ class HomeActivity(gobject.GObject): else: return None - def get_shared(self): - """Return whether this activity is using Presence service sharing""" - return self._service.get_shared() - def get_launch_time(self): """Return the time at which the activity was first launched diff --git a/shell/model/homemodel.py b/shell/model/homemodel.py index ba0a781..e935f66 100644 --- a/shell/model/homemodel.py +++ b/shell/model/homemodel.py @@ -25,10 +25,6 @@ from sugar import wm from model.homeactivity import HomeActivity from model import bundleregistry -_SERVICE_NAME = "org.laptop.Activity" -_SERVICE_PATH = "/org/laptop/Activity" -_SERVICE_INTERFACE = "org.laptop.Activity" - class HomeModel(gobject.GObject): """Model of the "Home" view (activity management) @@ -105,8 +101,6 @@ class HomeModel(gobject.GObject): activity = HomeActivity(bundle, activity_id) self._add_activity(activity) - service = self._get_activity_service(activity_id) - activity.set_service(service) activity.set_window(window) activity.props.launching = False @@ -166,18 +160,6 @@ class HomeModel(gobject.GObject): self.emit('active-activity-changed', self._current_activity) - def _get_activity_service(self, activity_id): - bus = dbus.SessionBus() - try: - service = dbus.Interface( - bus.get_object(_SERVICE_NAME + activity_id, - _SERVICE_PATH + "/" + activity_id), - _SERVICE_INTERFACE) - except dbus.DBusException: - service = None - - return service - def _add_activity(self, activity): self._activities.append(activity) self.emit('activity-added', activity) diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py index df87cba..1d3a32d 100644 --- a/shell/view/ActivityHost.py +++ b/shell/view/ActivityHost.py @@ -37,7 +37,6 @@ class ActivityHost: def __init__(self, model): self._model = model self._window = model.get_window() - self._activity = model.get_service() self._gdk_window = gtk.gdk.window_foreign_new(self.get_xid()) try: @@ -62,12 +61,6 @@ class ActivityHost: def get_model(self): return self._model - def execute(self, command, args): - return self._activity.execute(command, dbus.Array(args)) - - def share(self): - self._activity.share(ignore_reply=True) - def invite(self, buddy): pass diff --git a/shell/view/keyhandler.py b/shell/view/keyhandler.py index 8a6314e..a3dd27f 100644 --- a/shell/view/keyhandler.py +++ b/shell/view/keyhandler.py @@ -49,7 +49,6 @@ _actions_table = { '0x93' : 'frame', 'o' : 'overlay', '0xE0' : 'overlay', - '0xDC' : 'camera', '0x7C' : 'shutdown', 's' : 'shutdown', '0xEB' : 'rotate', @@ -149,14 +148,6 @@ class KeyHandler(object): def handle_overlay(self): self._shell.toggle_chat_visibility() - def handle_camera(self): - current_activity = self._shell.get_current_activity() - if current_activity: - if current_activity.execute('camera', []): - return - - self._shell.start_activity('org.laptop.CameraActivity') - def handle_shutdown(self): model = self._shell.get_model() model.props.state = ShellModel.STATE_SHUTDOWN diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 7f6ad9b..842b415 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -382,10 +382,6 @@ class Activity(Window, gtk.Container): self._share_id = self._pservice.connect("activity-shared", self._internal_share_cb) self._pservice.share_activity(self) - def execute(self, command, args): - """Execute the given command with args""" - return False - def _realize_cb(self, window): wm.set_bundle_id(window.window, self.get_service_name()) wm.set_activity_id(window.window, self._activity_id) diff --git a/sugar/activity/activityservice.py b/sugar/activity/activityservice.py index 97a6034..c9ee482 100644 --- a/sugar/activity/activityservice.py +++ b/sugar/activity/activityservice.py @@ -56,21 +56,6 @@ class ActivityService(dbus.service.Object): self._activity = activity @dbus.service.method(_ACTIVITY_INTERFACE) - def share(self): - """Called by the shell to request the activity to share itself on the network.""" - self._activity.share() - - @dbus.service.method(_ACTIVITY_INTERFACE) - def get_shared(self): - """Returns True if the activity is shared on the mesh.""" - return self._activity.get_shared() - - @dbus.service.method(_ACTIVITY_INTERFACE, - in_signature="sas", out_signature="b") - def execute(self, command, args): - return self._activity.execute(command, args) - - @dbus.service.method(_ACTIVITY_INTERFACE) def set_active(self, active): logging.debug('ActivityService.set_active: %s.' % active) self._activity.props.active = active -- cgit v0.9.1