aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/importers/icalendar-importer.c40
2 files changed, 18 insertions, 27 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 770a6b3235..e64e540ea5 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-19 Rodrigo Moya <rodrigo@novell.com>
+
+ * importers/icalendar-imporer.c (update_objects): use receive_objects
+ method instead of individually updating objects.
+
2005-01-18 Rodrigo Moya <rodrigo@novell.com>
Fixes #71407
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index 28318f01ba..d7fae2eb1d 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -187,39 +187,25 @@ update_objects (ECal *client, icalcomponent *icalcomp)
{
icalcomponent *subcomp;
icalcomponent_kind kind;
+ icalcomponent *vcal;
+ GError *error = NULL;
+ gboolean success = TRUE;
kind = icalcomponent_isa (icalcomp);
- if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
- return update_single_object (client, icalcomp);
- else if (kind != ICAL_VCALENDAR_COMPONENT)
+ if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) {
+ vcal = e_cal_util_new_top_level ();
+ icalcomponent_add_component (vcal, icalcomponent_new_clone (icalcomp));
+ } else if (kind == ICAL_VCALENDAR_COMPONENT) {
+ vcal = icalcomponent_new_clone (icalcomp);
+ } else
return FALSE;
- subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
- while (subcomp) {
- gboolean success;
-
- kind = icalcomponent_isa (subcomp);
- if (kind == ICAL_VTIMEZONE_COMPONENT) {
- icaltimezone *zone;
-
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, subcomp);
-
- success = e_cal_add_timezone (client, zone, NULL);
- icaltimezone_free (zone, 1);
- if (!success)
- return success;
- } else if (kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VEVENT_COMPONENT) {
- success = update_single_object (client, subcomp);
- if (!success)
- return success;
- }
+ if (!e_cal_receive_objects (client, vcal, NULL))
+ success = FALSE;
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
- }
+ icalcomponent_free (vcal);
- return TRUE;
+ return success;
}
static void