diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-08-03 06:15:22 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-08-03 06:15:22 +0800 |
commit | 83cbc862e6981bd06b406a0ae01e50d15a3502e7 (patch) | |
tree | 423b39c8d157608a71ab3b3aea33dd19a2582460 /calendar/cal-util | |
parent | 087e70c885bb19b3f76895a95159cd9f1d748bef (diff) | |
download | gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar.gz gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar.bz2 gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar.lz gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar.xz gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.tar.zst gsoc2013-evolution-83cbc862e6981bd06b406a0ae01e50d15a3502e7.zip |
New files for the iCalendar file backend.
2000-08-02 Federico Mena Quintero <federico@helixcode.com>
* pcs/cal-backend-file.[ch]: New files for the iCalendar file
backend.
* pcs/Makefile.am (libpcs_a_SOURCES): Added cal-backend-file.[ch].
* cal-util/cal-component.c (cal_component_set_icalcomponent):
Return an operation success code for if we are passed a component
of a type we don't support.
svn path=/trunk/; revision=4479
Diffstat (limited to 'calendar/cal-util')
-rw-r--r-- | calendar/cal-util/cal-component.c | 33 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.h | 2 |
2 files changed, 27 insertions, 8 deletions
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index e8b1adb96c..b697b60389 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -652,29 +652,48 @@ cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type) * structure. If the @comp already had an #icalcomponent set into it, it will * will be freed automatically if the #icalcomponent does not have a parent * component itself. + * + * Supported component types are VEVENT, VTODO, VJOURNAL, VFREEBUSY, and VTIMEZONE. + * + * Return value: TRUE on success, FALSE if @icalcomp is an unsupported component + * type. **/ -void +gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp) { CalComponentPrivate *priv; + icalcomponent_kind kind; - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); + g_return_val_if_fail (comp != NULL, FALSE); + g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); priv = comp->priv; if (priv->icalcomp == icalcomp) - return; + return TRUE; free_icalcomponent (comp); - priv->icalcomp = icalcomp; + if (!icalcomp) { + priv->icalcomp = NULL; + return TRUE; + } - if (!icalcomp) - return; + kind = icalcomponent_isa (icalcomp); + + if (!(kind == ICAL_VEVENT_COMPONENT + || kind == ICAL_VTODO_COMPONENT + || kind == ICAL_VJOURNAL_COMPONENT + || kind == ICAL_VFREEBUSY_COMPONENT + || kind == ICAL_VTIMEZONE_COMPONENT)) + return FALSE; + + priv->icalcomp = icalcomp; scan_icalcomponent (comp); ensure_mandatory_properties (comp); + + return TRUE; } /** diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h index c09c73d5bb..38b9e60aed 100644 --- a/calendar/cal-util/cal-component.h +++ b/calendar/cal-util/cal-component.h @@ -128,7 +128,7 @@ CalComponent *cal_component_new (void); void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type); -void cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp); +gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp); icalcomponent *cal_component_get_icalcomponent (CalComponent *comp); CalComponentVType cal_component_get_vtype (CalComponent *comp); |