From f1b08663ddff6432289ca4780bc823c96d471657 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 18 Apr 1998 04:02:46 +0000 Subject: Yes. Yes. It works. It loads, it saves, it does all that stuff. It works, even if federico complains that we did not test close. Repetition, alarms, all that stuff you all guys love. It it is there. We did minimal testing, but we know you will happilly commit a fix if you find a problem, right? Ok, we are off to a party now. Miguel svn path=/trunk/; revision=155 --- calendar/cal-util/calobj.c | 18 ++++++++++++++++++ calendar/cal-util/calobj.h | 7 +++++++ 2 files changed, 25 insertions(+) (limited to 'calendar/cal-util') diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 47d8c8a97e..624a179b05 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -1102,3 +1102,21 @@ ical_object_compute_end (iCalObject *ico) ico->recur->_enddate = 0; ical_object_generate_events (ico, ico->dtstart, 0, duration_callback, &count); } + +int +alarm_compute_offset (CalendarAlarm *a) +{ + if (!a->enabled) + return -1; + switch (a->units){ + case ALARM_MINUTES: + a->offset = a->count * 60; + break; + case ALARM_HOURS: + a->offset = a->count * 3600; + break; + case ALARM_DAYS: + a->offset = a->count * 24 * 3600; + } + return a->offset; +} diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h index 26b0acf35b..60483c68ad 100644 --- a/calendar/cal-util/calobj.h +++ b/calendar/cal-util/calobj.h @@ -32,6 +32,10 @@ typedef struct { int count; enum AlarmUnit units; char *data; + + /* Does not get saved, internally used */ + time_t offset; + time_t trigger; /* Widgets */ void *w_count; /* A GtkEntry */ @@ -180,6 +184,9 @@ void ical_object_generate_events (iCalObject *ico, time_t start, time /* Computes the enddate field of the recurrence based on the duration */ void ical_object_compute_end (iCalObject *ico); +/* Returns the number of seconds configured to trigger the alarm in advance to an event */ +int alarm_compute_offset (CalendarAlarm *a); + END_GNOME_DECLS #endif -- cgit v1.2.3