Remove unneeded ID systems
[gregoa/zavai.git] / src / clock.vala
index d08717bcd9ad82e9e5562c4d8e49ec38a4d6bd1a..fd5e6f0926673c69eca3a50cc7eba828e59131be 100644 (file)
@@ -138,14 +138,13 @@ public class ZavaiClock : Object {
 
 public class AlarmTriggerInfo
 {
 
 public class AlarmTriggerInfo
 {
-    public uint id;
+    public zavai.log.Log log;
     public string label;
     public bool acked;
     public bool canceled;
 
     public AlarmTriggerInfo(string label)
     {
     public string label;
     public bool acked;
     public bool canceled;
 
     public AlarmTriggerInfo(string label)
     {
-        id = 0;
         this.label = label;
         acked = false;
         canceled = false;
         this.label = label;
         acked = false;
         canceled = false;
@@ -165,14 +164,13 @@ public class AlarmTriggerQueue : zavai.Service
         queue = new List<AlarmTriggerInfo>();
     }
 
         queue = new List<AlarmTriggerInfo>();
     }
 
-    public uint enqueue_trigger(AlarmTriggerInfo info)
+    public void enqueue_trigger(AlarmTriggerInfo info)
     {
         // Reuse IDs from the associated logger object
     {
         // Reuse IDs from the associated logger object
-        info.id = zavai.log.log.start("alarm", "Alarm " + info.label);
+        info.log = zavai.log.log.start("alarm", "Alarm " + info.label);
         queue.append(info);
         queue.append(info);
-        if (queue.data.id == info.id)
+        if (queue.data == info)
             triggered(queue.data);
             triggered(queue.data);
-        return info.id;
     }
 
     protected void done_with_first()
     }
 
     protected void done_with_first()
@@ -185,26 +183,26 @@ public class AlarmTriggerQueue : zavai.Service
 
     public void ack(AlarmTriggerInfo info)
     {
 
     public void ack(AlarmTriggerInfo info)
     {
-        if (queue == null || info.id != queue.data.id) return;
+        if (queue == null || info != queue.data) return;
         if (!info.acked && !info.canceled)
         {
             info.acked = true;
             acked(info);
         if (!info.acked && !info.canceled)
         {
             info.acked = true;
             acked(info);
-            zavai.log.log.add(info.id, "alarm acknowledged");
-            zavai.log.log.end(info.id);
+            info.log.add("alarm acknowledged");
+            zavai.log.log.end(info.log);
         }
         done_with_first();
     }
 
     public void cancel(AlarmTriggerInfo info)
     {
         }
         done_with_first();
     }
 
     public void cancel(AlarmTriggerInfo info)
     {
-        if (queue == null || info.id != queue.data.id) return;
+        if (queue == null || info != queue.data) return;
         if (!info.acked && !info.canceled)
         {
             info.canceled = true;
             canceled(info);
         if (!info.acked && !info.canceled)
         {
             info.canceled = true;
             canceled(info);
-            zavai.log.log.add(info.id, "alarm canceled");
-            zavai.log.log.end(info.id);
+            info.log.add("alarm canceled");
+            zavai.log.log.end(info.log);
         }
         done_with_first();
     }
         }
         done_with_first();
     }