From 27a4ae413001ad90d7fbcbe58414a7796a092281 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 17 Sep 2002 14:49:07 +0000 Subject: Fixes #26362 2002-09-17 Rodrigo Moya Fixes #26362 * gui/e-itip-control.c (show current): add a default reminder if default reminders are set in the configuration. svn path=/trunk/; revision=18084 --- calendar/ChangeLog | 7 +++++++ calendar/gui/e-itip-control.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 502fbb209c..8c4ec0acc0 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2002-09-17 Rodrigo Moya + + Fixes #26362 + + * gui/e-itip-control.c (show current): add a default reminder if + default reminders are set in the configuration. + 2002-09-11 JP Rosevear * gui/e-day-view.c (e_day_view_on_top_canvas_button_press): keep diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index a38fd70dcf..39ac6add91 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -1224,7 +1224,7 @@ show_current (EItipControl *itip) alarm_iter = icalcomponent_begin_component (priv->ical_comp, ICAL_VALARM_COMPONENT); while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) { icalcomponent_remove_component (priv->ical_comp, alarm_comp); - + icalcompiter_next (&alarm_iter); } @@ -1236,6 +1236,45 @@ show_current (EItipControl *itip) return; }; + /* Add default reminder if the config says so */ + if (calendar_config_get_use_default_reminder ()) { + CalComponent *acomp; + int interval; + CalUnits units; + CalAlarmTrigger trigger; + + interval = calendar_config_get_default_reminder_interval (); + units = calendar_config_get_default_reminder_units (); + + acomp = cal_component_alarm_new (); + + cal_component_alarm_set_action (acomp, CAL_ALARM_DISPLAY); + + trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START; + memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration)); + + trigger.u.rel_duration.is_neg = TRUE; + + switch (units) { + case CAL_MINUTES: + trigger.u.rel_duration.minutes = interval; + break; + case CAL_HOURS: + trigger.u.rel_duration.hours = interval; + break; + case CAL_DAYS: + trigger.u.rel_duration.days = interval; + break; + default: + g_assert_not_reached (); + } + + cal_component_alarm_set_trigger (acomp, trigger); + cal_component_add_alarm (priv->comp, acomp); + + cal_component_alarm_free (acomp); + } + type = cal_component_get_vtype (priv->comp); switch (type) { -- cgit v1.2.3