From 958504b1ca5760ec263e72f69787e9cd5afc7118 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
Date: Sat, 6 Dec 2008 21:42:19 +0000
Subject: [PATCH] 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().
---
src/jarabe/frame/notification.py | 4 ++--
src/jarabe/journal/expandedentry.py | 2 +-
src/jarabe/journal/listview.py | 4 ++--
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
|
b
|
class NotificationIcon(gtk.EventBox): |
31 | 31 | 'icon-filename' : (str, None, None, None, gobject.PARAM_READWRITE) |
32 | 32 | } |
33 | 33 | |
34 | | _PULSE_TIMEOUT = 3000 |
| 34 | _PULSE_TIMEOUT = 3 |
35 | 35 | |
36 | 36 | def __init__(self, **kwargs): |
37 | 37 | self._icon = PulsingIcon(pixel_size=style.STANDARD_ICON_SIZE) |
… |
… |
class NotificationIcon(gtk.EventBox): |
45 | 45 | self.add(self._icon) |
46 | 46 | self._icon.show() |
47 | 47 | |
48 | | gobject.timeout_add(self._PULSE_TIMEOUT, self.__stop_pulsing_cb) |
| 48 | gobject.timeout_add_seconds(self._PULSE_TIMEOUT, self.__stop_pulsing_cb) |
49 | 49 | |
50 | 50 | self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE) |
51 | 51 | |
diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index 1e0b890..5b0d0f4 100644
a
|
b
|
class ExpandedEntry(hippo.CanvasBox): |
310 | 310 | |
311 | 311 | def _title_notify_text_cb(self, entry, pspec): |
312 | 312 | if not self._update_title_sid: |
313 | | self._update_title_sid = gobject.timeout_add(1000, |
| 313 | self._update_title_sid = gobject.timeout_add_seconds(1, |
314 | 314 | self._update_title_cb) |
315 | 315 | |
316 | 316 | 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
|
b
|
DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' |
34 | 34 | DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' |
35 | 35 | DS_DBUS_PATH = '/org/laptop/sugar/DataStore' |
36 | 36 | |
37 | | UPDATE_INTERVAL = 300000 |
| 37 | UPDATE_INTERVAL = 300 |
38 | 38 | |
39 | 39 | EMPTY_JOURNAL = _("Your Journal is empty") |
40 | 40 | NO_MATCH = _("No matching entries ") |
… |
… |
class BaseListView(gtk.HBox): |
424 | 424 | if self._update_dates_timer is None: |
425 | 425 | logging.debug('Adding date updating timer') |
426 | 426 | self._update_dates_timer = \ |
427 | | gobject.timeout_add(UPDATE_INTERVAL, |
| 427 | gobject.timeout_add_seconds(UPDATE_INTERVAL, |
428 | 428 | self.__update_dates_timer_cb) |
429 | 429 | else: |
430 | 430 | self._fully_obscured = True |
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index fe3ad36..9f6a51f 100644
a
|
b
|
class ShellModel(gobject.GObject): |
539 | 539 | |
540 | 540 | # FIXME: better learn about finishing processes by receiving a signal. |
541 | 541 | # Now just check whether an activity has a window after ~90sec |
542 | | gobject.timeout_add(90000, self._check_activity_launched, activity_id) |
| 542 | gobject.timeout_add_seconds(90, self._check_activity_launched, |
| 543 | activity_id) |
543 | 544 | |
544 | 545 | def notify_launch_failed(self, activity_id): |
545 | 546 | home_activity = self.get_activity_by_id(activity_id) |