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/gui/e-itip-control.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'calendar/gui/e-itip-control.c') 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