diff options
author | Daniel Drake <dsd@laptop.org> | 2008-12-06 21:42:19 (GMT) |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2008-12-06 21:48:51 (GMT) |
commit | 958504b1ca5760ec263e72f69787e9cd5afc7118 (patch) | |
tree | d841902df962a71bb74a30ad0f382801b8cae93f /src | |
parent | 8c8b205fdf23accfaade79b9162812d5c59b30a9 (diff) |
Use g_timeout_add_seconds() for power efficiency
This attempts to align second-granularity wakeups across the system,
reducing CPU wakeups a little.
I considered all timeouts of duration 1 second or greater, and moved
the non-timing-critical ones to g_timeout_add_seconds().
Diffstat (limited to 'src')
-rw-r--r-- | src/jarabe/frame/notification.py | 4 | ||||
-rw-r--r-- | src/jarabe/journal/expandedentry.py | 2 | ||||
-rw-r--r-- | src/jarabe/journal/listview.py | 4 | ||||
-rw-r--r-- | src/jarabe/model/shell.py | 3 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/jarabe/frame/notification.py b/src/jarabe/frame/notification.py index 68107ba..61a84e9 100644 --- a/src/jarabe/frame/notification.py +++ b/src/jarabe/frame/notification.py @@ -31,7 +31,7 @@ class NotificationIcon(gtk.EventBox): 'icon-filename' : (str, None, None, None, gobject.PARAM_READWRITE) } - _PULSE_TIMEOUT = 3000 + _PULSE_TIMEOUT = 3 def __init__(self, **kwargs): self._icon = PulsingIcon(pixel_size=style.STANDARD_ICON_SIZE) @@ -45,7 +45,7 @@ class NotificationIcon(gtk.EventBox): self.add(self._icon) self._icon.show() - gobject.timeout_add(self._PULSE_TIMEOUT, self.__stop_pulsing_cb) + gobject.timeout_add_seconds(self._PULSE_TIMEOUT, self.__stop_pulsing_cb) self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE) diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py index 1e0b890..5b0d0f4 100644 --- a/src/jarabe/journal/expandedentry.py +++ b/src/jarabe/journal/expandedentry.py @@ -310,7 +310,7 @@ class ExpandedEntry(hippo.CanvasBox): def _title_notify_text_cb(self, entry, pspec): if not self._update_title_sid: - self._update_title_sid = gobject.timeout_add(1000, + self._update_title_sid = gobject.timeout_add_seconds(1, self._update_title_cb) def _title_focus_out_event_cb(self, entry, event): diff --git a/src/jarabe/journal/listview.py b/src/jarabe/journal/listview.py index a34184a..1f3281f 100644 --- a/src/jarabe/journal/listview.py +++ b/src/jarabe/journal/listview.py @@ -34,7 +34,7 @@ DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' DS_DBUS_PATH = '/org/laptop/sugar/DataStore' -UPDATE_INTERVAL = 300000 +UPDATE_INTERVAL = 300 EMPTY_JOURNAL = _("Your Journal is empty") NO_MATCH = _("No matching entries ") @@ -424,7 +424,7 @@ class BaseListView(gtk.HBox): if self._update_dates_timer is None: logging.debug('Adding date updating timer') self._update_dates_timer = \ - gobject.timeout_add(UPDATE_INTERVAL, + gobject.timeout_add_seconds(UPDATE_INTERVAL, self.__update_dates_timer_cb) else: self._fully_obscured = True diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py index fe3ad36..9f6a51f 100644 --- a/src/jarabe/model/shell.py +++ b/src/jarabe/model/shell.py @@ -539,7 +539,8 @@ class ShellModel(gobject.GObject): # FIXME: better learn about finishing processes by receiving a signal. # Now just check whether an activity has a window after ~90sec - gobject.timeout_add(90000, self._check_activity_launched, activity_id) + gobject.timeout_add_seconds(90, self._check_activity_launched, + activity_id) def notify_launch_failed(self, activity_id): home_activity = self.get_activity_by_id(activity_id) |