[gnome-clocks] Use a single timeout to update all the clocks
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Use a single timeout to update all the clocks
- Date: Sun, 2 Sep 2012 12:31:08 +0000 (UTC)
commit 540291db3a733cc07df4987eb3abfec9269da34a
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Sep 2 14:26:55 2012 +0200
Use a single timeout to update all the clocks
gnomeclocks/world.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gnomeclocks/world.py b/gnomeclocks/world.py
index 84af502..9aff942 100644
--- a/gnomeclocks/world.py
+++ b/gnomeclocks/world.py
@@ -137,11 +137,6 @@ class DigitalClock():
self.drawing = DigitalClockDrawing()
self.standalone = None
self.update()
- self.timeout = GObject.timeout_add(1000, self.update)
-
- def stop_update(self):
- GObject.source_remove(self.timeout)
- self.timeout = 0
def get_local_time(self, secs):
t = secs + time.timezone + self.offset
@@ -176,7 +171,6 @@ class DigitalClock():
self.standalone.update(img, t, self.sunrise, self.sunset)
self._last_time = t
- return True
def get_sunrise_sunset(self):
world = GWeather.Location.new_world(True)
@@ -271,6 +265,13 @@ class World(Clock):
self.load_clocks()
self.show_all()
+ self.timeout_id = GObject.timeout_add(1000, self._update_clocks)
+
+ def _update_clocks(self):
+ for c in self.clocks:
+ c.update()
+ return True
+
def _on_item_activated(self, iconview, path):
d = self.liststore[path][3]
self.emit("show-standalone", d)
@@ -324,7 +325,6 @@ class World(Clock):
def delete_clocks(self, clocks):
for c in clocks:
- c.stop_update()
self.clocks.remove(c)
self.storage.save(self.clocks)
self.iconview.unselect_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]