diff options
Diffstat (limited to 'src/jarabe/model/shell.py')
-rw-r--r-- | src/jarabe/model/shell.py | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py index ec315ca..7f86c2f 100644 --- a/src/jarabe/model/shell.py +++ b/src/jarabe/model/shell.py @@ -45,10 +45,10 @@ def get_sugar_window_type(wnck_window): class Activity(gobject.GObject): """Activity which appears in the "Home View" of the Sugar shell - + This class stores the Sugar Shell's metadata regarding a given activity/application in the system. It interacts with - the sugar.activity.* modules extensively in order to + the sugar.activity.* modules extensively in order to accomplish its tasks. """ @@ -61,14 +61,14 @@ class Activity(gobject.GObject): def __init__(self, activity_info, activity_id, window=None): """Initialise the HomeActivity - + activity_info -- sugar.activity.registry.ActivityInfo instance, provides the information required to actually create the new instance. This is, in effect, the "type" of activity being created. activity_id -- unique identifier for this instance of the activity type - window -- Main WnckWindow of the activity + window -- Main WnckWindow of the activity """ gobject.GObject.__init__(self) @@ -104,7 +104,7 @@ class Activity(gobject.GObject): def get_service(self): """Get the activity service - + Note that non-native Sugar applications will not have such a service, so the return value will be None in those cases. @@ -123,7 +123,7 @@ class Activity(gobject.GObject): """Retrieve the activity's icon (file) name""" if self.is_journal(): icon_theme = gtk.icon_theme_get_default() - info = icon_theme.lookup_icon('activity-journal', + info = icon_theme.lookup_icon('activity-journal', gtk.ICON_SIZE_SMALL_TOOLBAR, 0) if not info: return None @@ -134,11 +134,11 @@ class Activity(gobject.GObject): return self._activity_info.get_icon() else: return None - + def get_icon_color(self): """Retrieve the appropriate icon colour for this activity - - Uses activity_id to index into the PresenceService's + + Uses activity_id to index into the PresenceService's set of activity colours, if the PresenceService does not have an entry (implying that this is not a Sugar-shared application) uses the local user's profile colour for the icon. @@ -158,10 +158,10 @@ class Activity(gobject.GObject): else: client = gconf.client_get_default() return XoColor(client.get_string("/desktop/sugar/user/color")) - + def get_activity_id(self): """Retrieve the "activity_id" passed in to our constructor - + This is a "globally likely unique" identifier generated by sugar.util.unique_id """ @@ -176,12 +176,12 @@ class Activity(gobject.GObject): def get_window(self): """Retrieve the X-windows root window of this application - - This was stored by the set_window method, which was - called by HomeModel._add_activity, which was called + + This was stored by the set_window method, which was + called by HomeModel._add_activity, which was called via a callback that looks for all 'window-opened' events. - + HomeModel currently uses a dbus service query on the activity to determine to which HomeActivity the newly launched window belongs. @@ -201,8 +201,8 @@ class Activity(gobject.GObject): def get_launch_time(self): """Return the time at which the activity was first launched - - Format is floating-point time.time() value + + Format is floating-point time.time() value (seconds since the epoch) """ return self._launch_time @@ -267,20 +267,20 @@ class Activity(gobject.GObject): def _set_active_success(self): pass - + def _set_active_error(self, err): logging.error("set_active() failed: %s", err) class ShellModel(gobject.GObject): """Model of the shell (activity management) - + The ShellModel is basically the point of registration for all running activities within Sugar. It traps events that tell the system there is a new activity being created (generated by the activity factories), or removed, as well as those which tell us that the currently focussed activity has changed. - + The HomeModel tracks a set of HomeActivity instances, which are tracking the window to activity mappings the activity factories have set up. @@ -288,7 +288,7 @@ class ShellModel(gobject.GObject): __gsignals__ = { 'activity-added': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, + gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])), 'activity-removed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, @@ -300,13 +300,13 @@ class ShellModel(gobject.GObject): gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])), 'launch-started': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, + gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])), 'launch-completed': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, + gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])), 'launch-failed': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, + gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])) } @@ -429,15 +429,15 @@ class ShellModel(gobject.GObject): self._active_activity = home_activity self.emit('active-activity-changed', self._active_activity) - def __iter__(self): + def __iter__(self): return iter(self._activities) - + def __len__(self): return len(self._activities) - + def __getitem__(self, i): return self._activities[i] - + def index(self, obj): return self._activities.index(obj) |