]> Pileus Git - lackey/blob - src/cal.c
Add todo view
[lackey] / src / cal.c
1 /*
2  * Copyright (C) 2012 Andy Spencer <andy753421@gmail.com>
3  * 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "util.h"
19 #include "date.h"
20 #include "cal.h"
21
22 /* Global data */
23 event_t *EVENTS;
24 todo_t  *TODOS;
25
26 /* Initialize */
27 void cal_init(void)
28 {
29         EVENTS = cal_events(2012, JAN, 0, 366);
30         TODOS  = cal_todos(2012, JAN, 0, 366);
31
32         /* Debug */
33         for (event_t *e = EVENTS; e; e = e->next)
34                 debug("event: %04d-%02d-%02d %02d:%02d: %s - %s\n",
35                                 e->start.year, e->start.month, e->start.day,
36                                 e->start.hour, e->start.min, e->name, e->desc);
37         for (todo_t *e = TODOS; e; e = e->next)
38                 debug("todo: %04d-%02d-%02d %02d:%02d: %s - %s\n",
39                                 e->start.year, e->start.month, e->start.day,
40                                 e->start.hour, e->start.min, e->name, e->desc);
41 }
42
43 /* Get events */
44 event_t *cal_events(year_t year, month_t month, day_t day, int days)
45 {
46         return ical_events(0, year, month, day, days)
47            ?: dummy_events(0, year, month, day, days);
48 }
49
50 /* Get todos */
51 todo_t *cal_todos(year_t year, month_t month, day_t day, int days)
52 {
53         return ical_todos(0, year, month, day, days)
54            ?: dummy_todos(0, year, month, day, days);
55 }