diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 13 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/notify-main.c | 3 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-db.c | 17 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 17 |
4 files changed, 40 insertions, 10 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5c67ea4e6c..95340dc1b4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,18 @@ 2001-06-24 Federico Mena Quintero <federico@ximian.com> + * 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. + +2001-06-24 Federico Mena Quintero <federico@ximian.com> + * gui/alarm-notify/alarm-notify.c: Converted to use BonoboXObject. * gui/gnome-cal.c (gnome_calendar_open): Ask the alarm diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index d608579933..b8b409632d 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -29,6 +29,7 @@ #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-init.h> #include <libgnomevfs/gnome-vfs-init.h> +#include <glade/glade.h> #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-generic-factory.h> #include <liboaf/liboaf.h> @@ -101,6 +102,8 @@ main (int argc, char **argv) if (!gnome_vfs_init ()) g_error (_("Could not initialize gnome-vfs")); + glade_gnome_init (); + alarm_init (); alarm_queue_init (); diff --git a/calendar/pcs/cal-backend-db.c b/calendar/pcs/cal-backend-db.c index 56b9786c0d..73aef5d054 100644 --- a/calendar/pcs/cal-backend-db.c +++ b/calendar/pcs/cal-backend-db.c @@ -998,7 +998,11 @@ compute_alarm_range (CalComponent *comp, 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); @@ -1062,10 +1066,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; 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; |