Ticket #94: 0001-Use-g_timeout_add_seconds-for-power-efficiency.2.patch

File 0001-Use-g_timeout_add_seconds-for-power-efficiency.2.patch, 3.7 KB (added by dsd, 15 years ago)

sugar patch

  • src/jarabe/frame/notification.py

    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): 
    3131        'icon-filename' : (str, None, None, None, gobject.PARAM_READWRITE)
    3232    }
    3333
    34     _PULSE_TIMEOUT = 3000
     34    _PULSE_TIMEOUT = 3
    3535
    3636    def __init__(self, **kwargs):
    3737        self._icon = PulsingIcon(pixel_size=style.STANDARD_ICON_SIZE)
    class NotificationIcon(gtk.EventBox): 
    4545        self.add(self._icon)
    4646        self._icon.show()
    4747       
    48         gobject.timeout_add(self._PULSE_TIMEOUT, self.__stop_pulsing_cb)
     48        gobject.timeout_add_seconds(self._PULSE_TIMEOUT, self.__stop_pulsing_cb)
    4949
    5050        self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
    5151
  • src/jarabe/journal/expandedentry.py

    diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
    index 1e0b890..5b0d0f4 100644
    a b class ExpandedEntry(hippo.CanvasBox): 
    310310
    311311    def _title_notify_text_cb(self, entry, pspec):
    312312        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,
    314314                                                         self._update_title_cb)
    315315
    316316    def _title_focus_out_event_cb(self, entry, event):
  • src/jarabe/journal/listview.py

    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' 
    3434DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
    3535DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
    3636
    37 UPDATE_INTERVAL = 300000
     37UPDATE_INTERVAL = 300
    3838
    3939EMPTY_JOURNAL = _("Your Journal is empty")
    4040NO_MATCH = _("No matching entries ")
    class BaseListView(gtk.HBox): 
    424424            if self._update_dates_timer is None:
    425425                logging.debug('Adding date updating timer')
    426426                self._update_dates_timer = \
    427                         gobject.timeout_add(UPDATE_INTERVAL,
     427                        gobject.timeout_add_seconds(UPDATE_INTERVAL,
    428428                                            self.__update_dates_timer_cb)
    429429        else:
    430430            self._fully_obscured = True
  • src/jarabe/model/shell.py

    diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
    index fe3ad36..9f6a51f 100644
    a b class ShellModel(gobject.GObject): 
    539539
    540540        # FIXME: better learn about finishing processes by receiving a signal.
    541541        # 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)
    543544
    544545    def notify_launch_failed(self, activity_id):
    545546        home_activity = self.get_activity_by_id(activity_id)