diff options
author | Miguel de Icaza <miguel@nuclecu.unam.mx> | 1998-05-15 07:12:10 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-05-15 07:12:10 +0800 |
commit | 3799134926a1db309a2b46706d8a33581999f778 (patch) | |
tree | 46d2561103752aac54d3dd0430a3b0d72687a3e4 /calendar/cal-util/calobj.c | |
parent | dc9b92ba1949fc7004aec9cbc369e173e03af0a8 (diff) | |
download | gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar.gz gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar.bz2 gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar.lz gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar.xz gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.tar.zst gsoc2013-evolution-3799134926a1db309a2b46706d8a33581999f778.zip |
Do not add the spurious padding.
1998-05-14 Miguel de Icaza <miguel@nuclecu.unam.mx>
* timeutil.c (isodate_from_time_t): Do not add the spurious
padding.
* calobj.c (store_date_list): Bug fix: I was using the wrong
pointer when saving the exception date list.
(set_date_list): Bug fix: load correctly the complete exception
date list.
(set_date_list): Use ',' for the exception date separator as the
versit people can not get their standard right.
* gncal-full-day.c (unrecur_appointment): Support for making an
existing recurrent event `movable' for a day.
* calobj.c (ical_object_add_exdate): New routine, used to add
exception dates.
(ical_object_duplicate): New routine: used to do the magic
recur->no-recur event.
svn path=/trunk/; revision=214
Diffstat (limited to 'calendar/cal-util/calobj.c')
-rw-r--r-- | calendar/cal-util/calobj.c | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index f3cf23e78d..7b9b42b716 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -92,6 +92,7 @@ ical_object_destroy (iCalObject *ico) free_if_defined (ico->status); free_if_defined (ico->class); free_if_defined (ico->url); + free_if_defined (ico->recur); /* Lists */ lfree_if_defined (ico->exdate); @@ -127,15 +128,26 @@ set_date_list (char *str) GList *list = 0; char *s; - for (s = strtok (str, ";"); s; s = strtok (NULL, ";")){ + for (s = strtok (str, ";,"); s; s = strtok (NULL, ";,")){ time_t *t = g_new (time_t, 1); + while (*s && isspace (*s)) + s++; *t = time_from_isodate (s); list = g_list_prepend (list, t); } return list; } +void +ical_object_add_exdate (iCalObject *o, time_t t) +{ + time_t *pt = g_new (time_t, 1); + + *pt = t; + o->exdate = g_list_prepend (o->exdate, pt); +} + static void ignore_space(char **str) { @@ -455,6 +467,31 @@ setup_alarm_at (iCalObject *ico, CalendarAlarm *alarm, char *iso_time, VObject * } } +/* + * Duplicates an iCalObject. Implementation is a grand hack + */ +iCalObject * +ical_object_duplicate (iCalObject *o) +{ + VObject *vo; + iCalObject *new; + + vo = ical_object_to_vobject (o); + switch (o->type){ + case ICAL_EVENT: + new = ical_object_create_from_vobject (vo, VCEventProp); + break; + case ICAL_TODO: + new = ical_object_create_from_vobject (vo, VCTodoProp); + break; + default: + new = NULL; + } + + cleanVObject (vo); + return new; +} + /* FIXME: we need to load the recurrence properties */ iCalObject * ical_object_create_from_vobject (VObject *o, const char *object_name) @@ -716,7 +753,7 @@ static void store_date_list (VObject *o, char *prop, GList *values) { GList *l; - int size; + int size, len; char *s, *p; size = g_list_length (values); @@ -724,12 +761,13 @@ store_date_list (VObject *o, char *prop, GList *values) for (l = values; l; l = l->next){ strcpy (s, isodate_from_time_t (*(time_t *)l->data)); - s [16] = ';'; - s += 17; + len = strlen (s); + s [len] = ','; + s += len + 1; } s--; *s = 0; - addPropValue (o, prop, s); + addPropValue (o, prop, p); g_free (p); } |