Rereading labels from at jobs works
authorEnrico Zini <enrico@enricozini.org>
Fri, 27 Nov 2009 16:00:50 +0000 (17:00 +0100)
committerEnrico Zini <enrico@enricozini.org>
Fri, 27 Nov 2009 16:00:50 +0000 (17:00 +0100)
src/clock.vala
src/zavai.vala

index 834290d75d0e72d70d104c40cd0d51b2accf5a8f..f472a3c70658fef20e4f62ac521449cd6b0908fd 100644 (file)
@@ -126,7 +126,7 @@ public class Alarm : Object
                                {
                                        size_t size = line.size();
                                        if (size < 15) continue;
-                                       label = line.substring(13, (long)(size - 15));
+                                       label = line.substring(13, (long)(size - 14));
                                        break;
                                }
                        }
index 749ebefe319c26273fbde6a093fcc6d19a8aed40..2cd7f2a2749fd85ec0b6a58509fbd08209427373 100644 (file)
@@ -43,15 +43,16 @@ static int main (string[] args) {
 
        int id = at.earliestID();
        stderr.printf("%d\n", id);
-       bool res = at.jobContents(id, fd => {
-               FileStream fs = FileStream.fdopen(fd, "r");
-               if (fs == null)
-                       return false;
-               string? line;
-               while ((line = fs.read_line()) != null)
-                       stdout.printf(" LN %s\n", line);
-               return true;
-       });
+       if (id != -1)
+       {
+               string? label = zavai.clock.Alarm.getLabel(id);
+               if (label == null)
+                       stdout.printf("generic at job\n");
+               else
+                       stdout.printf("zavai at job: %s\n", label);
+       }
+
+       zavai.clock.Alarm.schedule("now + 1 hour", "Antani blinda la supercazzola");
 
        return 0;