From d1ddbc231d6e816af4e582b79da400fda8e8bd01 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Sat, 8 Dec 2001 23:18:37 +0000 Subject: if we have an alarm that can be represented on the pilot, set the 2001-12-08 JP Rosevear * conduits/calendar/calendar-conduit.c (local_record_from_comp): if we have an alarm that can be represented on the pilot, set the appointment fields appropriately, if the duration has values for minutes and/or hours and/or days, use the lowest common denominator (comp_from_remote_record): if the appointment on the pilot has an alarm, find the first alarm an item currently had that is relative to the start and with a negative duration and update it (or create a new one if no valid ones exist) * cal-util/cal-component.c (cal_component_get_alarm_uids): build list in the order they appear in the component so we get consisting order for the gui and for the pilot svn path=/trunk/; revision=14943 --- calendar/cal-util/cal-component.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'calendar/cal-util') diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index 5fc5addf19..eeb51c79f6 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -4462,19 +4462,6 @@ make_alarm (icalcomponent *subcomp) return alarm; } -/* Used from g_hash_table_foreach(); adds an alarm UID to a list */ -static void -add_alarm_uid (gpointer key, gpointer value, gpointer data) -{ - const char *auid; - GList **l; - - auid = key; - l = data; - - *l = g_list_prepend (*l, g_strdup (auid)); -} - /** * cal_component_get_alarm_uids: * @comp: A calendar component. @@ -4489,6 +4476,7 @@ GList * cal_component_get_alarm_uids (CalComponent *comp) { CalComponentPrivate *priv; + icalcompiter iter; GList *l; g_return_val_if_fail (comp != NULL, NULL); @@ -4498,7 +4486,29 @@ cal_component_get_alarm_uids (CalComponent *comp) g_return_val_if_fail (priv->icalcomp != NULL, NULL); l = NULL; - g_hash_table_foreach (priv->alarm_uid_hash, add_alarm_uid, &l); + for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_VALARM_COMPONENT); + icalcompiter_deref (&iter) != NULL; + icalcompiter_next (&iter)) { + icalcomponent *subcomp; + icalproperty *prop; + + subcomp = icalcompiter_deref (&iter); + for (prop = icalcomponent_get_first_property (subcomp, ICAL_X_PROPERTY); + prop; + prop = icalcomponent_get_next_property (subcomp, ICAL_X_PROPERTY)) { + const char *xname; + + xname = icalproperty_get_x_name (prop); + g_assert (xname != NULL); + + if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) { + const char *auid; + + auid = alarm_uid_from_prop (prop); + l = g_list_append (l, g_strdup (auid)); + } + } + } return l; } -- cgit