]> Pileus Git - lackey/blobdiff - cals/dummy.c
Add cal_load function and update cal APIs
[lackey] / cals / dummy.c
index 62e1dd38c3a9f5ccd1771f115163947e4f56b5b4..8b0279c8758164ba60d2b77a83294b061b3c5cbe 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * Copyright (C) 2012 Andy Spencer <andy753421@gmail.com>
- * 
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -34,13 +34,22 @@ static event_t event = {
        .end   = {2012, OCT, 0, 13, 0},
        .name  = "dummy event",
        .desc  = "this event is random and does not exist",
-       .next  = NULL,
 };
 
+static todo_t todo = {
+       .cal     = &cal,
+       .name    = "dummy todo",
+       .desc    = "this todo is random and does not exist",
+       .due     = {2012, OCT, 0, 13, 0},
+       .status  = 50,
+};
+
+static int     enable;
 static event_t events[8];
+static todo_t  todos[6];
 
 /* Event functions */
-event_t *dummy_events(cal_t *cal, year_t year, month_t month, day_t day, int days)
+event_t *dummy_events(date_t start, date_t end)
 {
        for (int i = 0; i < N_ELEMENTS(events); i++) {
                date_t *s = &events[i].start;
@@ -51,5 +60,17 @@ event_t *dummy_events(cal_t *cal, year_t year, month_t month, day_t day, int day
                if (i+1 < N_ELEMENTS(events))
                        events[i].next = &events[i+1];
        }
-       return &events[0];
+       return enable ? &events[0] : 0;
+}
+
+/* Todo functions */
+todo_t *dummy_todos(date_t start, date_t end)
+{
+       for (int i = 0; i < N_ELEMENTS(todos); i++) {
+               todos[i] = todo;
+               todos[i].status = i*20;
+               if (i+1 < N_ELEMENTS(todos))
+                       todos[i].next = &todos[i+1];
+       }
+       return enable ? &todos[0] : 0;
 }