[gnome-clocks/wip/vala] Got the time tick-tick-ticking in my head



commit 472cbd0751e6558a2c4a05a22dd985321cc66f94
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Feb 17 17:07:06 2013 +0100

    Got the time tick-tick-ticking in my head

 src/alarm.vala |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/src/alarm.vala b/src/alarm.vala
index 60e9b68..9e60cba 100644
--- a/src/alarm.vala
+++ b/src/alarm.vala
@@ -500,27 +500,29 @@ public class MainPanel : Gd.Stack, Clocks.Clock {
 
         visible_child = content_view;
         show_all ();
+
+        // Start ticking...
+        Utils.WallClock.get_default ().tick.connect (() => {
+            foreach (var a in alarms) {
+                if (a.tick()) {
+                    // a.tick() returns true if the state changed
+                    if (a.state == Item.State.RINGING) {
+                        standalone.alarm = a;
+                        standalone.update ();
+                        ring ();
+                    } else if (standalone.alarm == a) {
+                        // update the alarm shown in the standalone
+                        standalone.update ();
+                    }
+                }
+            }
+        });
     }
 
     public virtual signal void ring () {
         visible_child = standalone;
     }
 
-    private void tick () {
-        foreach (var a in alarms) {
-            if (a.tick()) {
-                // a.tick() returns true if the state changed
-                if (a.state == Item.State.RINGING) {
-                    standalone.alarm = a;
-                    standalone.update ();
-                    ring ();
-                } else if (standalone.alarm == a) {
-                    // update the alarm shown in the standalone
-                    standalone.update ();
-                }
-            }
-        }
-    }
 
     private void load () {
         foreach (var a in settings.get_value ("alarms")) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]