Fixes to alarm scheduling
authorEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 18:41:59 +0000 (19:41 +0100)
committerEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 18:41:59 +0000 (19:41 +0100)
src/app_main.vala
src/clock.vala
src/zavai.vala

index 1eca6497d9c4bd2030db8f2fb793de663f22f0d3..7dc4f9638af0d93964b041cd257df0f35acd901f 100644 (file)
@@ -107,7 +107,7 @@ public class Clock : Gtk.VBox
             l_deadline.set_text("");
         else
         {
-            int remaining = (int)(last_time - last_deadline);
+            int remaining = (int)(last_deadline - last_time);
             int hours = remaining / 3600;
             int minutes = (remaining % 3600) / 60;
             if (hours == 0 && minutes == 0)
index 394ff29e08e5622fe55859e394a526b52be3d138..8b129c82f2cd4b6a3f531988b68a10f18ee70d3d 100644 (file)
@@ -123,7 +123,6 @@ public class Clock: zavai.Service
 
     private void otimed_reschedule()
     {
-        zavai.log.info("No alarms left to reschedule");
         if (alarms != null)
         {
             zavai.log.info("Scheduling next alarm: " + alarms.data.label + " at " + Time.local(alarms.data.deadline).to_string());
@@ -138,7 +137,8 @@ public class Clock: zavai.Service
             } catch (Error e) {
                 zavai.log.error("Cannot reschedule alarms: " + e.message);
             }
-        }
+        } else
+            zavai.log.info("No alarms left to reschedule");
         schedule_changed();
     }
 
index 17dfbb0e12b7b6677704a92724aa0dd779a9d530..23da334b19a927d03b43b516f561bd4c445073aa 100644 (file)
@@ -83,9 +83,11 @@ static int main (string[] args) {
        //zavai.app.show_applet("menu.main");
        zavai.app.show_applet("zavai.status");
 
+/*
        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() + 300, "Test third"));
+*/
 
        //zavai.ui.power.power_menu.toggle();