{
protected Gtk.Label l_date;
protected Gtk.Label l_time;
+ protected Gtk.Label l_deadline;
public Clock()
{
l_time = new Gtk.Label("--:--");
l_time.modify_font(Pango.FontDescription.from_string("Sans 60"));
pack_start(l_time, false, false, 0);
+ l_deadline = new Gtk.Label("");
+ l_deadline.modify_font(Pango.FontDescription.from_string("Sans 30"));
+ pack_start(l_deadline, false, false, 0);
zavai.clock.clock.minute_changed += on_minute_changed;
+ zavai.clock.clock.schedule_changed += on_schedule_changed;
zavai.clock.clock.request("ui.main.clock");
+
+ // Read the current schedule
+ on_schedule_changed();
+ }
+
+ private void on_schedule_changed()
+ {
+ zavai.clock.Alarm a = zavai.clock.clock.next_alarm();
+ if (a == null)
+ l_deadline.set_text("");
+ else
+ {
+ var t = Time.local(a.deadline);
+ l_deadline.set_text(a.label + ": " + t.format("%a %d %b %H:%M"));
+ }
}
private void on_minute_changed(long ts, zavai.clock.SourceType type)
// Ticks once a minute
public signal void minute_changed(long time, SourceType source);
+ public signal void schedule_changed();
public Clock()
{
//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);
zavai.log.error("Cannot reschedule alarms: " + e.message);
}
}
+ schedule_changed();
}
public void check_alarms()
zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 10, "Test second"));
zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 5, "Test first"));
+ zavai.clock.clock.schedule(new zavai.clock.Alarm(time_t() + 30, "Test third"));
//zavai.ui.power.power_menu.toggle();