Show next deadline
[gregoa/zavai.git] / src / clock.vala
index 3d97a901de39a1970952395a63fd434eed9c6000..394ff29e08e5622fe55859e394a526b52be3d138 100644 (file)
@@ -73,6 +73,7 @@ public class Clock: zavai.Service
 
     // Ticks once a minute
     public signal void minute_changed(long time, SourceType source);
+    public signal void schedule_changed();
 
        public Clock()
        {
@@ -107,6 +108,13 @@ public class Clock: zavai.Service
         //notification.Alarm += on_alarm;
        }
 
+    public Alarm? next_alarm()
+    {
+        if (alarms == null)
+            return null;
+        return alarms.data;
+    }
+
     public void schedule(Alarm a)
     {
         alarms.insert_sorted(a, alarm_compare);
@@ -131,6 +139,7 @@ public class Clock: zavai.Service
                 zavai.log.error("Cannot reschedule alarms: " + e.message);
             }
         }
+        schedule_changed();
     }
 
     public void check_alarms()