From 5a5ec44e5a7382cfccdb8ba6ed4673600e5c44ce Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Sun, 24 Jun 2001 23:56:38 +0000 Subject: Initialize libglade. 2001-06-24 Federico Mena Quintero * gui/alarm-notify/notify-main.c (main): Initialize libglade. * pcs/cal-backend-file.c (compute_alarm_range): icaldurationtype_as_int() will now return a negative value if dur->is_neg is true, so we need to flip the sign of some operations here. (add_alarm_occurrences_cb): Likewise. * pcs/cal-backend-db.c (compute_alarm_range): Likewise. (add_alarm_occurrences_cb): Likewise. svn path=/trunk/; revision=10456 --- calendar/pcs/cal-backend-file.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'calendar/pcs/cal-backend-file.c') diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index fdf7eefad1..b7ba095a30 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -1157,7 +1157,11 @@ compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t dur_time = icaldurationtype_as_int (*dur); if (dur->is_neg) - *alarm_end = MAX (*alarm_end, end + dur_time); + /* If the duration is negative then dur_time + * will be negative as well; that is why we + * subtract to expand the range. + */ + *alarm_end = MAX (*alarm_end, end - dur_time); else *alarm_start = MIN (*alarm_start, start - dur_time); @@ -1222,10 +1226,13 @@ add_alarm_occurrences_cb (CalComponent *comp, time_t start, time_t end, gpointer else occur_time = end; - if (dur->is_neg) - trigger_time = occur_time - dur_time; - else - trigger_time = occur_time + dur_time; + /* If dur->is_neg is true then dur_time will already be + * negative. So we do not need to test for dur->is_neg here; we + * can simply add the dur_time value to the occur_time and get + * the correct result. + */ + + trigger_time = occur_time + dur_time; if (trigger_time < aod->start || trigger_time >= aod->end) continue; -- cgit v1.2.3