[evolution-data-server/wip/mcrha/libical-glib] Tests and documentation changes (and an untested vala change)



commit c6a72e5fbfa998e49b256230460c54b34dc12524
Author: Milan Crha <mcrha redhat com>
Date:   Wed Mar 13 14:50:24 2019 +0100

    Tests and documentation changes (and an untested vala change)

 .../evolution-data-server-docs.sgml.in             |  18 +-
 src/calendar/libecal/e-cal-client.c                |   4 +-
 src/calendar/libecal/e-cal-component.c             |  18 +
 src/calendar/libecal/e-cal-recur.c                 |  10 +-
 src/calendar/libecal/e-cal-util.c                  |   4 -
 src/calendar/libedata-cal/e-cal-backend.c          |   8 +-
 src/calendar/libedata-cal/e-cal-cache.c            |   3 +-
 src/calendar/libedata-cal/e-cal-meta-backend.c     |  12 +-
 src/libebackend/e-server-side-source.c             |   1 +
 src/vala/ECal-2.0.metadata                         |   2 +
 tests/libecal/test-cal-client-add-timezone.c       |  60 +-
 tests/libecal/test-cal-client-bulk-methods.c       | 310 +++++++--
 tests/libecal/test-cal-client-create-object.c      | 158 +++--
 .../libecal/test-cal-client-get-attachment-uris.c  |  53 +-
 tests/libecal/test-cal-client-get-free-busy.c      |  18 +-
 tests/libecal/test-cal-client-get-object-list.c    |  54 +-
 tests/libecal/test-cal-client-get-revision.c       |  26 +-
 tests/libecal/test-cal-client-get-view.c           |  32 +-
 tests/libecal/test-cal-client-modify-object.c      |  64 +-
 tests/libecal/test-cal-client-receive-objects.c    |  44 +-
 tests/libecal/test-cal-client-refresh.c            |  25 +-
 tests/libecal/test-cal-client-remove-object.c      |  25 +-
 tests/libecal/test-cal-client-revision-view.c      |  28 +-
 tests/libecal/test-cal-client-send-objects.c       |  77 ++-
 tests/libedata-cal/test-cal-backend-sexp.c         |   2 +
 tests/libedata-cal/test-cal-cache-intervals.c      |  52 +-
 tests/libedata-cal/test-cal-cache-offline.c        |  36 +-
 tests/libedata-cal/test-cal-cache-search.c         |  12 +-
 tests/libedata-cal/test-cal-meta-backend.c         | 691 ++++++++++++---------
 tests/libedata-cal/test-intervaltree.c             |   4 +-
 tests/test-server-utils/e-test-server-utils.c      |  11 +-
 31 files changed, 1129 insertions(+), 733 deletions(-)
---
diff --git a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in 
b/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
index fe9ea179b..68d276800 100644
--- a/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
+++ b/docs/reference/evolution-data-server/evolution-data-server-docs.sgml.in
@@ -148,6 +148,18 @@
       <xi:include href="xml/e-cal-client.xml"/>
       <xi:include href="xml/e-cal-client-view.xml"/>
       <xi:include href="xml/e-cal-component.xml"/>
+      <xi:include href="xml/e-cal-component-alarm.xml"/>
+      <xi:include href="xml/e-cal-component-alarm-instance.xml"/>
+      <xi:include href="xml/e-cal-component-alarm-repeat.xml"/>
+      <xi:include href="xml/e-cal-component-alarms.xml"/>
+      <xi:include href="xml/e-cal-component-alarm-trigger.xml"/>
+      <xi:include href="xml/e-cal-component-attendee.xml"/>
+      <xi:include href="xml/e-cal-component-datetime.xml"/>
+      <xi:include href="xml/e-cal-component-id.xml"/>
+      <xi:include href="xml/e-cal-component-organizer.xml"/>
+      <xi:include href="xml/e-cal-component-period.xml"/>
+      <xi:include href="xml/e-cal-component-range.xml"/>
+      <xi:include href="xml/e-cal-component-text.xml"/>
     </chapter>
   </part>
 
@@ -284,7 +296,7 @@
       <xi:include href="xml/e-cal-check-timezones.xml"/>
       <xi:include href="xml/e-timezone-cache.xml"/>
       <xi:include href="xml/e-cal-backend-util.xml"/>
-      <xi:include href="xml/e-cal-types.xml"/>
+      <xi:include href="xml/e-cal-enums.xml"/>
       <xi:include href="xml/e-reminder-watcher.xml"/>
     </chapter>
 
@@ -343,6 +355,10 @@
     <title>Index of deprecated symbols</title>
     <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
   </index>
+  <index id="api-index-3-36" role="3.36">
+    <title>Index of new symbols in 3.36</title>
+    <xi:include href="xml/api-index-3.36.xml"><xi:fallback /></xi:include>
+  </index>
   <index id="api-index-3-32" role="3.32">
     <title>Index of new symbols in 3.32</title>
     <xi:include href="xml/api-index-3.32.xml"><xi:fallback /></xi:include>
diff --git a/src/calendar/libecal/e-cal-client.c b/src/calendar/libecal/e-cal-client.c
index 6f5a1e9b8..fe63e5316 100644
--- a/src/calendar/libecal/e-cal-client.c
+++ b/src/calendar/libecal/e-cal-client.c
@@ -1455,10 +1455,10 @@ cal_client_get_cached_timezone (ETimezoneCache *cache,
                tzid = i_cal_timezone_get_tzid (zone);
                g_hash_table_insert (priv->zone_cache, g_strdup (tzid), zone);
        } else {
-               g_object_unref (icalcomp);
                g_object_unref (zone);
                zone = NULL;
        }
+       g_object_unref (icalcomp);
 
 exit:
        g_mutex_unlock (&priv->zone_cache_lock);
@@ -6248,6 +6248,8 @@ e_cal_client_get_attachment_uris_sync (ECalClient *client,
                }
 
                *out_attachment_uris = g_slist_reverse (tmp);
+
+               g_free (uris);
        }
 
        if (local_error != NULL) {
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 2d2f129e8..5f6c1ccf5 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -428,6 +428,22 @@ ensure_mandatory_properties (ECalComponent *comp)
        }
 }
 
+static gboolean
+ensure_alarm_uid_cb (ICalComponent *icalcomp,
+                    ICalComponent *subcomp,
+                    gpointer user_data)
+{
+       if (!e_cal_util_component_has_x_property (subcomp, E_CAL_EVOLUTION_ALARM_UID_PROPERTY)) {
+               gchar *uid;
+
+               uid = e_util_generate_uid ();
+               e_cal_util_component_set_x_property (subcomp, E_CAL_EVOLUTION_ALARM_UID_PROPERTY, uid);
+               g_free (uid);
+       }
+
+       return TRUE;
+}
+
 /**
  * e_cal_component_set_new_vtype:
  * @comp: A calendar component object.
@@ -581,6 +597,8 @@ e_cal_component_set_icalcomponent (ECalComponent *comp,
 
        ensure_mandatory_properties (comp);
 
+       foreach_subcomponent (icalcomp, I_CAL_VALARM_COMPONENT, ensure_alarm_uid_cb, NULL);
+
        return TRUE;
 }
 
diff --git a/src/calendar/libecal/e-cal-recur.c b/src/calendar/libecal/e-cal-recur.c
index 77c0ec9f1..f544375ec 100644
--- a/src/calendar/libecal/e-cal-recur.c
+++ b/src/calendar/libecal/e-cal-recur.c
@@ -230,7 +230,7 @@ ensure_timezone (icalcomponent *comp,
                                if (!*pcached_zones)
                                        *pcached_zones = g_hash_table_new_full (g_str_hash, g_str_equal, 
g_free, g_object_unref);
 
-                               g_hash_table_insert (*pcached_zones, g_strdup (tzid), zone);
+                               g_hash_table_insert (*pcached_zones, g_strdup (tzid), g_object_ref (zone));
                        }
                }
 
@@ -1362,8 +1362,10 @@ e_cal_recur_generate_instances_of_rule (ECalComponent *comp,
         * TZID (i.e. floating times) we use the default timezone. */
        if (e_cal_component_datetime_get_tzid (dtstart) && !dtstarttt->is_date) {
                gstart_zone = (*tz_cb) (e_cal_component_datetime_get_tzid (dtstart), tz_cb_data, NULL, NULL);
-               if (gstart_zone)
+               if (gstart_zone) {
+                       g_object_ref (gstart_zone);
                        start_zone = i_cal_object_get_native (I_CAL_OBJECT (gstart_zone));
+               }
                if (!start_zone)
                        start_zone = default_timezone;
        } else {
@@ -1407,8 +1409,10 @@ e_cal_recur_generate_instances_of_rule (ECalComponent *comp,
 
        if (e_cal_component_datetime_get_tzid (dtend) && dtendtt && !dtendtt->is_date) {
                gend_zone = (*tz_cb) (e_cal_component_datetime_get_tzid (dtend), tz_cb_data, NULL, NULL);
-               if (gend_zone)
+               if (gend_zone) {
+                       g_object_ref (gend_zone);
                        end_zone = i_cal_object_get_native (I_CAL_OBJECT (gend_zone));
+               }
                if (!end_zone)
                        end_zone = default_timezone;
        } else {
diff --git a/src/calendar/libecal/e-cal-util.c b/src/calendar/libecal/e-cal-util.c
index 4b8914f8c..1d77fc297 100644
--- a/src/calendar/libecal/e-cal-util.c
+++ b/src/calendar/libecal/e-cal-util.c
@@ -1759,8 +1759,6 @@ componenttime_to_utc_timet (const ECalComponentDateTime *dt_time,
        ICalTimetype *value = NULL;
        time_t timet = -1;
 
-       g_return_val_if_fail (dt_time != NULL, -1);
-
        if (dt_time)
                value = e_cal_component_datetime_get_value (dt_time);
 
@@ -1772,8 +1770,6 @@ componenttime_to_utc_timet (const ECalComponentDateTime *dt_time,
                        zone = tz_cb (tzid, tz_cb_data, NULL, NULL);
 
                timet = i_cal_time_as_timet_with_zone (value, zone ? zone : (ICalTimezone *) default_zone);
-
-               g_clear_object (&zone);
        }
 
        return timet;
diff --git a/src/calendar/libedata-cal/e-cal-backend.c b/src/calendar/libedata-cal/e-cal-backend.c
index 525976d41..25e521cc0 100644
--- a/src/calendar/libedata-cal/e-cal-backend.c
+++ b/src/calendar/libedata-cal/e-cal-backend.c
@@ -194,9 +194,7 @@ static void
 signal_closure_free (SignalClosure *signal_closure)
 {
        g_weak_ref_clear (&signal_closure->backend);
-
-       /* The ICalTimezone is cached in ECalBackend's internal
-        * "zone_cache" hash table and must not be freed here. */
+       g_clear_object (&signal_closure->cached_zone);
 
        g_slice_free (SignalClosure, signal_closure);
 }
@@ -826,7 +824,7 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
                 * duration of the idle callback. */
                signal_closure = g_slice_new0 (SignalClosure);
                g_weak_ref_init (&signal_closure->backend, cache);
-               signal_closure->cached_zone = cached_zone;
+               signal_closure->cached_zone = g_object_ref (cached_zone);
 
                main_context = e_backend_ref_main_context (E_BACKEND (cache));
 
@@ -907,9 +905,9 @@ cal_backend_get_cached_timezone (ETimezoneCache *cache,
                tzid = i_cal_timezone_get_tzid (zone);
                g_hash_table_insert (priv->zone_cache, g_strdup (tzid), zone);
        } else {
-               g_clear_object (&icomp);
                g_clear_object (&zone);
        }
+       g_clear_object (&icomp);
 
  exit:
        g_mutex_unlock (&priv->zone_cache_lock);
diff --git a/src/calendar/libedata-cal/e-cal-cache.c b/src/calendar/libedata-cal/e-cal-cache.c
index 0eb190e0d..0caf051d4 100644
--- a/src/calendar/libedata-cal/e-cal-cache.c
+++ b/src/calendar/libedata-cal/e-cal-cache.c
@@ -1855,6 +1855,7 @@ ecc_timezone_from_string (const gchar *icalstring)
                        g_object_unref (component);
                        g_object_unref (zone);
                } else {
+                       g_object_unref (component);
                        return zone;
                }
        }
@@ -4243,9 +4244,9 @@ ecc_get_cached_timezone (ETimezoneCache *cache,
                tzid = i_cal_timezone_get_tzid (zone);
                g_hash_table_insert (cal_cache->priv->modified_timezones, g_strdup (tzid), zone);
        } else {
-               g_clear_object (&icomp);
                g_clear_object (&zone);
        }
+       g_clear_object (&icomp);
 
  exit:
        g_rec_mutex_unlock (&cal_cache->priv->timezones_lock);
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
index a8a548590..2846df5c8 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.c
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
@@ -1030,9 +1030,9 @@ ecmb_gather_timezones (ECalMetaBackend *meta_backend,
                if (i_cal_timezone_set_component (zone, clone)) {
                        if (i_cal_timezone_get_tzid (zone))
                                e_timezone_cache_add_timezone (timezone_cache, zone);
-               } else {
-                       g_object_unref (clone);
                }
+
+               g_object_unref (clone);
        }
 
        g_object_unref (zone);
@@ -2657,6 +2657,8 @@ ecmb_add_attachment_uris (ECalComponent *comp,
                                g_free (buf);
                        }
                }
+
+               g_clear_object (&attach);
        }
 }
 
@@ -3893,6 +3895,8 @@ add_timezone_cb (ICalParameter *param,
                }
 
                i_cal_component_take_component (f_data->vcalendar, clone);
+
+               g_object_unref (vtz_comp);
        }
 
        g_object_unref (tz);
@@ -4018,7 +4022,7 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
                ICalAttach *attach;
 
                attach = i_cal_property_get_attach (prop);
-               if (i_cal_attach_get_is_url (attach)) {
+               if (attach && i_cal_attach_get_is_url (attach)) {
                        const gchar *url;
 
                        url = i_cal_attach_get_url (attach);
@@ -4119,7 +4123,7 @@ e_cal_meta_backend_store_inline_attachments_sync (ECalMetaBackend *meta_backend,
 
                attach = i_cal_property_get_attach (prop);
 
-               if (!i_cal_attach_get_is_url (attach)) {
+               if (attach && !i_cal_attach_get_is_url (attach)) {
                        ICalParameter *param;
                        const gchar *basename;
                        gsize len = -1;
diff --git a/src/libebackend/e-server-side-source.c b/src/libebackend/e-server-side-source.c
index 961660e3f..2c92d9fbf 100644
--- a/src/libebackend/e-server-side-source.c
+++ b/src/libebackend/e-server-side-source.c
@@ -2019,6 +2019,7 @@ e_server_side_source_load (EServerSideSource *source,
                return FALSE;
 
        } else {
+               g_free (source->priv->file_contents);
                source->priv->file_contents = g_strdup (data);
        }
 
diff --git a/src/vala/ECal-2.0.metadata b/src/vala/ECal-2.0.metadata
index e69de29bb..014b2fcc6 100644
--- a/src/vala/ECal-2.0.metadata
+++ b/src/vala/ECal-2.0.metadata
@@ -0,0 +1,2 @@
+TimezoneCache.add_timezone name="add_tz"
+TimezoneCache.get_timezone name="get_tz"
diff --git a/tests/libecal/test-cal-client-add-timezone.c b/tests/libecal/test-cal-client-add-timezone.c
index 6ae44745b..7b7ecb69e 100644
--- a/tests/libecal/test-cal-client-add-timezone.c
+++ b/tests/libecal/test-cal-client-add-timezone.c
@@ -32,20 +32,21 @@ test_add_timezone_sync (ETestServerFixture *fixture,
                         gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalproperty *property;
-       icalcomponent *component;
-       icaltimezone *zone;
-       icaltimezone *zone2 = NULL;
+       ICalProperty *property;
+       ICalComponent *component;
+       ICalTimezone *zone;
+       ICalTimezone *zone2 = NULL;
        GError *error = NULL;
 
        /* Build up new timezone */
-       component = icalcomponent_new_vtimezone ();
-       property = icalproperty_new_tzid (TZID_NEW);
-       icalcomponent_add_property (component, property);
-       property = icalproperty_new_tzname (TZNAME_NEW);
-       icalcomponent_add_property (component, property);
-       zone = icaltimezone_new ();
-       icaltimezone_set_component (zone, component);
+       component = i_cal_component_new_vtimezone ();
+       property = i_cal_property_new_tzid (TZID_NEW);
+       i_cal_component_take_property (component, property);
+       property = i_cal_property_new_tzname (TZNAME_NEW);
+       i_cal_component_take_property (component, property);
+       zone = i_cal_timezone_new ();
+       g_assert (i_cal_timezone_set_component (zone, component));
+       g_object_unref (component);
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
@@ -58,14 +59,14 @@ test_add_timezone_sync (ETestServerFixture *fixture,
        if (!zone2)
                g_error ("Failure: get timezone returned NULL");
 
-       g_assert_cmpstr (icaltimezone_get_tzid (zone), ==, icaltimezone_get_tzid (zone2));
-       g_assert_cmpstr (icaltimezone_get_tznames (zone), ==, icaltimezone_get_tznames (zone2));
+       g_assert_cmpstr (i_cal_timezone_get_tzid (zone), ==, i_cal_timezone_get_tzid (zone2));
+       g_assert_cmpstr (i_cal_timezone_get_tznames (zone), ==, i_cal_timezone_get_tznames (zone2));
 
-       icaltimezone_free (zone, TRUE);
+       g_object_unref (zone);
 }
 
 typedef struct {
-       icaltimezone *zone;
+       ICalTimezone *zone;
        GMainLoop *loop;
 } AsyncData;
 
@@ -77,7 +78,7 @@ async_read_result_ready (GObject *source_object,
        ECalClient *cal_client;
        GError *error = NULL;
        AsyncData *data = (AsyncData *) user_data;
-       icaltimezone *zone1 = data->zone, *zone2 = NULL;
+       ICalTimezone *zone1 = data->zone, *zone2 = NULL;
 
        cal_client = E_CAL_CLIENT (source_object);
 
@@ -87,8 +88,8 @@ async_read_result_ready (GObject *source_object,
        if (!zone2)
                g_error ("Failure: get timezone returned NULL");
 
-       g_assert_cmpstr (icaltimezone_get_tzid (zone1), ==, icaltimezone_get_tzid (zone2));
-       g_assert_cmpstr (icaltimezone_get_tznames (zone1), ==, icaltimezone_get_tznames (zone2));
+       g_assert_cmpstr (i_cal_timezone_get_tzid (zone1), ==, i_cal_timezone_get_tzid (zone2));
+       g_assert_cmpstr (i_cal_timezone_get_tznames (zone1), ==, i_cal_timezone_get_tznames (zone2));
 
        g_main_loop_quit (data->loop);
 }
@@ -115,19 +116,20 @@ test_add_timezone_async (ETestServerFixture *fixture,
                          gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalproperty *property;
-       icalcomponent *component;
-       icaltimezone *zone;
+       ICalProperty *property;
+       ICalComponent *component;
+       ICalTimezone *zone;
        AsyncData data;
 
        /* Build up new timezone */
-       component = icalcomponent_new_vtimezone ();
-       property = icalproperty_new_tzid (TZID_NEW);
-       icalcomponent_add_property (component, property);
-       property = icalproperty_new_tzname (TZNAME_NEW);
-       icalcomponent_add_property (component, property);
-       zone = icaltimezone_new ();
-       icaltimezone_set_component (zone, component);
+       component = i_cal_component_new_vtimezone ();
+       property = i_cal_property_new_tzid (TZID_NEW);
+       i_cal_component_take_property (component, property);
+       property = i_cal_property_new_tzname (TZNAME_NEW);
+       i_cal_component_take_property (component, property);
+       zone = i_cal_timezone_new ();
+       g_assert (i_cal_timezone_set_component (zone, component));
+       g_object_unref (component);
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
@@ -136,7 +138,7 @@ test_add_timezone_async (ETestServerFixture *fixture,
        e_cal_client_add_timezone (cal_client, zone, NULL, async_write_result_ready, &data);
        g_main_loop_run (fixture->loop);
 
-       icaltimezone_free (zone, TRUE);
+       g_object_unref (zone);
 }
 
 gint
diff --git a/tests/libecal/test-cal-client-bulk-methods.c b/tests/libecal/test-cal-client-bulk-methods.c
index c481f8ab2..e80719b08 100644
--- a/tests/libecal/test-cal-client-bulk-methods.c
+++ b/tests/libecal/test-cal-client-bulk-methods.c
@@ -25,32 +25,52 @@ static ETestServerClosure cal_closure =
 #define NB_COMPONENTS 5
 
 static void
-test_icalcomps (icalcomponent *icalcomp1,
-                icalcomponent *icalcomp2)
+test_icomps (ICalComponent *icomp1,
+            ICalComponent *icomp2)
 {
-       struct icaltimetype t1, t2;
+       ICalTimetype *t1, *t2;
 
-       if (!icalcomp2)
+       if (!icomp2)
                g_error ("Failure: get object returned NULL");
 
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp1), ==, icalcomponent_get_uid (icalcomp2));
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp1), ==, icalcomponent_get_summary (icalcomp2));
+       g_assert_cmpstr (i_cal_component_get_uid (icomp1), ==, i_cal_component_get_uid (icomp2));
+       g_assert_cmpstr (i_cal_component_get_summary (icomp1), ==, i_cal_component_get_summary (icomp2));
 
-       t1 = icalcomponent_get_dtstart (icalcomp1);
-       t2 = icalcomponent_get_dtstart (icalcomp2);
+       t1 = i_cal_component_get_dtstart (icomp1);
+       t2 = i_cal_component_get_dtstart (icomp2);
 
-       if (icaltime_compare (t1, t2) != 0)
-               g_error (
-                       "Failure: dtend doesn't match, expected '%s', got '%s'\n",
-                       icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+       if (i_cal_time_compare (t1, t2) != 0) {
+               gchar *str1, *str2;
 
-       t1 = icalcomponent_get_dtend (icalcomp1);
-       t2 = icalcomponent_get_dtend (icalcomp2);
+               str1 = i_cal_time_as_ical_string_r (t1);
+               str2 = i_cal_time_as_ical_string_r (t2);
 
-       if (icaltime_compare (t1, t2) != 0)
-               g_error (
-                       "Failure: dtend doesn't match, expected '%s', got '%s'\n",
-                       icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+               g_error ("Failure: dtend doesn't match, expected '%s', got '%s'\n", str1, str2);
+
+               g_free (str1);
+               g_free (str2);
+       }
+
+       g_clear_object (&t1);
+       g_clear_object (&t2);
+
+       t1 = i_cal_component_get_dtend (icomp1);
+       t2 = i_cal_component_get_dtend (icomp2);
+
+       if (i_cal_time_compare (t1, t2) != 0) {
+               gchar *str1, *str2;
+
+               str1 = i_cal_time_as_ical_string_r (t1);
+               str2 = i_cal_time_as_ical_string_r (t2);
+
+               g_error ("Failure: dtend doesn't match, expected '%s', got '%s'\n", str1, str2);
+
+               g_free (str1);
+               g_free (str2);
+       }
+
+       g_clear_object (&t1);
+       g_clear_object (&t2);
 }
 
 static void
@@ -62,13 +82,19 @@ check_removed (ECalClient *cal_client,
 
        while (uids) {
                GError *error = NULL;
-               icalcomponent *icalcomp = NULL;
+               ICalComponent *icomp = NULL;
 
-               if (!e_cal_client_get_object_sync (cal_client, uids->data, NULL, &icalcomp, NULL, &error) &&
-                               g_error_matches (error, E_CAL_CLIENT_ERROR, 
E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND)) {
+               if (!e_cal_client_get_object_sync (cal_client, uids->data, NULL, &icomp, NULL, &error) &&
+                   g_error_matches (error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND)) {
                        g_clear_error (&error);
-               } else
+               } else if (error) {
                        g_error ("check objects removed sync: %s", error->message);
+                       g_clear_error (&error);
+               } else {
+                       g_clear_object (&icomp);
+
+                       g_error ("check objects removed sync: object found in the backend");
+               }
 
                uids = uids->next;
        }
@@ -88,75 +114,76 @@ uid_slist_to_ecalcomponentid_slist (GSList *uids)
 }
 
 static void
-check_icalcomps_exist (ECalClient *cal_client,
-                       GSList *icalcomps)
+check_icomps_exist (ECalClient *cal_client,
+                   GSList *icomps)
 {
-       const GSList *l;
+       GSList *link;
 
-       for (l = icalcomps; l; l = l->next) {
+       for (link = icomps; link; link = g_slist_next (link)) {
                GError *error = NULL;
-               icalcomponent *icalcomp = l->data;
-               icalcomponent *icalcomp2 = NULL;
-               const gchar *uid = icalcomponent_get_uid (icalcomp);
+               ICalComponent *icomp = link->data;
+               ICalComponent *icomp2 = NULL;
+               const gchar *uid = i_cal_component_get_uid (icomp);
 
-               if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp2, NULL, &error))
+               if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp2, NULL, &error))
                        g_error ("get object sync: %s", error->message);
 
-               g_assert (icalcomp2 != NULL);
+               g_assert_nonnull (icomp2);
 
-               test_icalcomps (icalcomp, icalcomp2);
-               icalcomponent_free (icalcomp2);
+               test_icomps (icomp, icomp2);
+
+               g_object_unref (icomp2);
        }
 }
 
 static void
-test_bulk_methods (ECalClient *cal_client,
-                   GSList *icalcomps)
+test_bulk_methods_sync (ECalClient *cal_client,
+                       GSList *icomps)
 {
        GError *error = NULL;
        GSList *uids = NULL, *ids = NULL;
        const GSList *lcomp, *luid;
        gint i = 0;
 
-       g_assert (icalcomps != NULL);
+       g_assert_nonnull (icomps);
 
        /* Create all the objects in bulk */
-       if (!e_cal_client_create_objects_sync (cal_client, icalcomps, &uids, NULL, &error))
+       if (!e_cal_client_create_objects_sync (cal_client, icomps, &uids, NULL, &error))
                g_error ("create objects sync: %s", error->message);
 
        g_assert (uids != NULL);
        g_assert_cmpint (g_slist_length (uids), ==, NB_COMPONENTS);
 
-       /* Update icalcomponents uids */
+       /* Update ICalComponents uids */
        luid = uids;
-       lcomp = icalcomps;
+       lcomp = icomps;
        while (luid && lcomp) {
-               icalcomponent_set_uid (lcomp->data, luid->data);
+               i_cal_component_set_uid (lcomp->data, luid->data);
                luid = luid->next;
                lcomp = lcomp->next;
        }
 
        /* Retrieve all the objects and check that they are the same */
-       check_icalcomps_exist (cal_client, icalcomps);
+       check_icomps_exist (cal_client, icomps);
 
        /* Modify the objects */
-       for (lcomp = icalcomps; lcomp; lcomp = lcomp->next) {
+       for (lcomp = icomps; lcomp; lcomp = lcomp->next) {
                gchar *summary;
-               icalcomponent *icalcomp = lcomp->data;
+               ICalComponent *icomp = lcomp->data;
 
                summary = g_strdup_printf ("Edited test summary %d", i);
-               icalcomponent_set_summary (icalcomp, summary);
+               i_cal_component_set_summary (icomp, summary);
 
                g_free (summary);
                ++i;
        }
 
        /* Save the modified objects in bulk */
-       if (!e_cal_client_modify_objects_sync (cal_client, icalcomps, E_CAL_OBJ_MOD_ALL, NULL, &error))
+       if (!e_cal_client_modify_objects_sync (cal_client, icomps, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("modify objects sync: %s", error->message);
 
        /* Retrieve all the objects and check that they have been modified */
-       check_icalcomps_exist (cal_client, icalcomps);
+       check_icomps_exist (cal_client, icomps);
 
        /* Remove all the objects in bulk */
        ids = uid_slist_to_ecalcomponentid_slist (uids);
@@ -172,38 +199,186 @@ test_bulk_methods (ECalClient *cal_client,
        g_slist_free_full (uids, g_free);
 }
 
+typedef struct _AsyncContext {
+       ECalClient *cal_client;
+       GSList *icomps; /* ICalComponent * */
+       GSList *ids; /* ECalComponentId * */
+       GSList *uids; /* gchar * */
+       GMainLoop *main_loop;
+} AsyncContext;
+
+static void
+bulk_async_remove_objects_cb (GObject *source_object,
+                             GAsyncResult *result,
+                             gpointer user_data)
+{
+       AsyncContext *async_context = user_data;
+       gboolean success;
+       GError *error = NULL;
+
+       g_assert_nonnull (async_context);
+       g_assert (E_IS_CAL_CLIENT (source_object));
+       g_assert (async_context->cal_client == E_CAL_CLIENT (source_object));
+
+       success = e_cal_client_remove_objects_finish (async_context->cal_client, result, &error);
+       g_assert_no_error (error);
+       g_assert (success);
+
+       /* Check that the objects don't exist anymore */
+       check_removed (async_context->cal_client, async_context->uids);
+
+       g_main_loop_quit (async_context->main_loop);
+}
+
+static void
+bulk_async_modify_objects_cb (GObject *source_object,
+                             GAsyncResult *result,
+                             gpointer user_data)
+{
+       AsyncContext *async_context = user_data;
+       gboolean success;
+       GError *error = NULL;
+
+       g_assert_nonnull (async_context);
+       g_assert (E_IS_CAL_CLIENT (source_object));
+       g_assert (async_context->cal_client == E_CAL_CLIENT (source_object));
+
+       success = e_cal_client_modify_objects_finish (async_context->cal_client, result, &error);
+       g_assert_no_error (error);
+       g_assert (success);
+
+       /* Retrieve all the objects and check that they have been modified */
+       check_icomps_exist (async_context->cal_client, async_context->icomps);
+
+       /* Remove all the objects in bulk */
+       async_context->ids = uid_slist_to_ecalcomponentid_slist (async_context->uids);
+
+       e_cal_client_remove_objects (async_context->cal_client, async_context->ids, E_CAL_OBJ_MOD_ALL, NULL,
+               bulk_async_remove_objects_cb, async_context);
+}
+
+static void
+bulk_async_create_objects_cb (GObject *source_object,
+                             GAsyncResult *result,
+                             gpointer user_data)
+{
+       AsyncContext *async_context = user_data;
+       GSList *luid, *lcomp;
+       gboolean success;
+       gint ii;
+       GError *error = NULL;
+
+       g_assert_nonnull (async_context);
+       g_assert (E_IS_CAL_CLIENT (source_object));
+       g_assert (async_context->cal_client == E_CAL_CLIENT (source_object));
+
+       success = e_cal_client_create_objects_finish (async_context->cal_client, result, 
&async_context->uids, &error);
+       g_assert_no_error (error);
+       g_assert (success);
+       g_assert_nonnull (async_context->uids);
+       g_assert_cmpint (g_slist_length (async_context->uids), ==, NB_COMPONENTS);
+
+       /* Update ICalComponents uids */
+       for (luid = async_context->uids, lcomp = async_context->icomps;
+            luid && lcomp;
+            luid = g_slist_next (luid), lcomp = g_slist_next (lcomp)) {
+               i_cal_component_set_uid (lcomp->data, luid->data);
+       }
+
+       /* Retrieve all the objects and check that they are the same */
+       check_icomps_exist (async_context->cal_client, async_context->icomps);
+
+       /* Modify the objects */
+       for (ii = 0, lcomp = async_context->icomps; lcomp; ii++, lcomp = g_slist_next (lcomp)) {
+               gchar *summary;
+               ICalComponent *icomp = lcomp->data;
+
+               summary = g_strdup_printf ("Edited test summary %d", ii);
+               i_cal_component_set_summary (icomp, summary);
+
+               g_free (summary);
+       }
+
+       e_cal_client_modify_objects (async_context->cal_client, async_context->icomps, E_CAL_OBJ_MOD_ALL, 
NULL,
+               bulk_async_modify_objects_cb, async_context);
+}
+
 static void
-run_test_bulk_methods (ETestServerFixture *fixture,
-                       gconstpointer user_data)
+test_bulk_methods_async (ECalClient *cal_client,
+                        GSList *icomps)
+{
+       AsyncContext async_context;
+
+       g_assert_nonnull (icomps);
+
+       async_context.cal_client = cal_client;
+       async_context.icomps = icomps;
+       async_context.ids = NULL;
+       async_context.uids = NULL;
+       async_context.main_loop = g_main_loop_new (NULL, FALSE);
+
+       e_cal_client_create_objects (async_context.cal_client, async_context.icomps, NULL,
+               bulk_async_create_objects_cb, &async_context);
+
+       g_main_loop_run (async_context.main_loop);
+
+       g_slist_free_full (async_context.ids, e_cal_component_id_free);
+       g_slist_free_full (async_context.uids, g_free);
+       g_main_loop_unref (async_context.main_loop);
+}
+
+static void
+run_test_bulk_methods_wrapper (ETestServerFixture *fixture,
+                              void (* func)(ECalClient *cal_client,
+                                            GSList *icomps))
 {
        ECalClient *cal_client;
-       GSList *icalcomps = NULL;
-       struct icaltimetype now;
-       gint i;
+       GSList *icomps = NULL;
+       ICalTimetype *dtstart, *dtend;
+       gint ii;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
        /* Build up new components */
-       for (i = 0; i < NB_COMPONENTS; ++i) {
-               icalcomponent *icalcomp;
+       for (ii = 0; ii < NB_COMPONENTS; ++ii) {
+               ICalComponent *icomp;
                gchar *summary;
 
-               icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-               summary = g_strdup_printf ("Test summary %d", i);
-               icalcomponent_set_summary (icalcomp, summary);
-               icalcomponent_set_dtstart (icalcomp, now);
-               icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 
60 * 60 * 60, 0, NULL));
+               icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+               summary = g_strdup_printf ("Test summary %d", ii);
+               i_cal_component_set_summary (icomp, summary);
+               i_cal_component_set_dtstart (icomp, dtstart);
+               i_cal_component_set_dtend (icomp, dtend);
 
-               icalcomps = g_slist_append (icalcomps, icalcomp);
+               icomps = g_slist_append (icomps, icomp);
                g_free (summary);
        }
 
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
        /* Test synchronous bulk methods */
-       test_bulk_methods (cal_client, icalcomps);
+       func (cal_client, icomps);
+
+       g_slist_free_full (icomps, g_object_unref);
+}
 
-       g_slist_free_full (icalcomps, (GDestroyNotify) icalcomponent_free);
+static void
+run_test_bulk_methods_sync (ETestServerFixture *fixture,
+                           gconstpointer user_data)
+{
+       run_test_bulk_methods_wrapper (fixture, test_bulk_methods_sync);
+}
+
+static void
+run_test_bulk_methods_async (ETestServerFixture *fixture,
+                            gconstpointer user_data)
+{
+       run_test_bulk_methods_wrapper (fixture, test_bulk_methods_async);
 }
 
 gint
@@ -214,11 +389,18 @@ main (gint argc,
        g_test_bug_base ("http://bugzilla.gnome.org/";);
 
        g_test_add (
-               "/ECalClient/BulkMethods",
+               "/ECalClient/BulkMethods/Sync",
+               ETestServerFixture,
+               &cal_closure,
+               e_test_server_utils_setup,
+               run_test_bulk_methods_sync,
+               e_test_server_utils_teardown);
+       g_test_add (
+               "/ECalClient/BulkMethods/Async",
                ETestServerFixture,
                &cal_closure,
                e_test_server_utils_setup,
-               run_test_bulk_methods,
+               run_test_bulk_methods_async,
                e_test_server_utils_teardown);
 
        return e_test_server_utils_run ();
diff --git a/tests/libecal/test-cal-client-create-object.c b/tests/libecal/test-cal-client-create-object.c
index 0d5bbd8f3..4d297fb47 100644
--- a/tests/libecal/test-cal-client-create-object.c
+++ b/tests/libecal/test-cal-client-create-object.c
@@ -25,32 +25,52 @@ static ETestServerClosure cal_closure_async =
        { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, TRUE };
 
 static void
-test_icalcomps (icalcomponent *icalcomp1,
-                icalcomponent *icalcomp2)
+test_icomps (ICalComponent *icomp1,
+            ICalComponent *icomp2)
 {
-       struct icaltimetype t1, t2;
+       ICalTimetype *t1, *t2;
 
-       if (!icalcomp2)
+       if (!icomp2)
                g_error ("Failure: get object returned NULL");
 
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp1), ==, icalcomponent_get_uid (icalcomp2));
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp1), ==, icalcomponent_get_summary (icalcomp2));
+       g_assert_cmpstr (i_cal_component_get_uid (icomp1), ==, i_cal_component_get_uid (icomp2));
+       g_assert_cmpstr (i_cal_component_get_summary (icomp1), ==, i_cal_component_get_summary (icomp2));
 
-       t1 = icalcomponent_get_dtstart (icalcomp1);
-       t2 = icalcomponent_get_dtstart (icalcomp2);
+       t1 = i_cal_component_get_dtstart (icomp1);
+       t2 = i_cal_component_get_dtstart (icomp2);
 
-       if (icaltime_compare (t1, t2) != 0)
-               g_error (
-                       "Failure: dtend doesn't match, expected '%s', got '%s'\n",
-                       icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+       if (i_cal_time_compare (t1, t2) != 0) {
+               gchar *str1, *str2;
 
-       t1 = icalcomponent_get_dtend (icalcomp1);
-       t2 = icalcomponent_get_dtend (icalcomp2);
+               str1 = i_cal_time_as_ical_string_r (t1);
+               str2 = i_cal_time_as_ical_string_r (t2);
 
-       if (icaltime_compare (t1, t2) != 0)
-               g_error (
-                       "Failure: dtend doesn't match, expected '%s', got '%s'\n",
-                       icaltime_as_ical_string (t1), icaltime_as_ical_string (t2));
+               g_error ("Failure: dtend doesn't match, expected '%s', got '%s'\n", str1, str2);
+
+               g_free (str1);
+               g_free (str2);
+       }
+
+       g_clear_object (&t1);
+       g_clear_object (&t2);
+
+       t1 = i_cal_component_get_dtend (icomp1);
+       t2 = i_cal_component_get_dtend (icomp2);
+
+       if (i_cal_time_compare (t1, t2) != 0) {
+               gchar *str1, *str2;
+
+               str1 = i_cal_time_as_ical_string_r (t1);
+               str2 = i_cal_time_as_ical_string_r (t2);
+
+               g_error ("Failure: dtend doesn't match, expected '%s', got '%s'\n", str1, str2);
+
+               g_free (str1);
+               g_free (str2);
+       }
+
+       g_clear_object (&t1);
+       g_clear_object (&t2);
 }
 
 static void
@@ -58,9 +78,9 @@ test_create_object_sync (ETestServerFixture *fixture,
                          gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalcomponent *icalcomp;
-       icalcomponent *icalcomp2 = NULL, *clone;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalComponent *icomp2 = NULL, *clone;
+       ICalTimetype *dtstart, *dtend;
        GError *error = NULL;
        GSList *ecalcomps = NULL;
        gchar *uid = NULL;
@@ -68,24 +88,30 @@ test_create_object_sync (ETestServerFixture *fixture,
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
        /* Build up new component */
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Test event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
+
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Test event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp2, NULL, &error))
+       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp2, NULL, &error))
                g_error ("get object sync: %s", error->message);
 
-       clone = icalcomponent_new_clone (icalcomp);
-       icalcomponent_set_uid (clone, uid);
+       clone = i_cal_component_new_clone (icomp);
+       i_cal_component_set_uid (clone, uid);
 
-       test_icalcomps (clone, icalcomp2);
+       test_icomps (clone, icomp2);
 
-       icalcomponent_free (icalcomp2);
+       g_object_unref (icomp2);
 
        if (!e_cal_client_get_objects_for_uid_sync (cal_client, uid, &ecalcomps, NULL, &error))
                g_error ("get objects for uid sync: %s", error->message);
@@ -95,18 +121,18 @@ test_create_object_sync (ETestServerFixture *fixture,
        else {
                ECalComponent *ecalcomp = ecalcomps->data;
 
-               test_icalcomps (clone, e_cal_component_get_icalcomponent (ecalcomp));
+               test_icomps (clone, e_cal_component_get_icalcomponent (ecalcomp));
        }
-       e_cal_client_free_ecalcomp_slist (ecalcomps);
+       e_util_free_nullable_object_slist (ecalcomps);
 
-       icalcomponent_free (clone);
+       g_object_unref (clone);
+       g_object_unref (icomp);
        g_free (uid);
-       icalcomponent_free (icalcomp);
 }
 
 typedef struct {
-       icalcomponent *icalcomp;
-       icalcomponent *clone;
+       ICalComponent *icomp;
+       ICalComponent *clone;
        GMainLoop *loop;
 } AsyncData;
 
@@ -118,10 +144,10 @@ async_read2_result_ready (GObject *source_object,
        ECalClient *cal_client;
        GError *error = NULL;
        AsyncData *data = (AsyncData *) user_data;
-       icalcomponent *icalcomp1 = data->clone;
+       ICalComponent *icomp1 = data->clone;
        GSList *ecalcomps = NULL;
 
-       g_return_if_fail (icalcomp1 != NULL);
+       g_return_if_fail (icomp1 != NULL);
 
        cal_client = E_CAL_CLIENT (source_object);
 
@@ -133,11 +159,11 @@ async_read2_result_ready (GObject *source_object,
        else {
                ECalComponent *ecalcomp = ecalcomps->data;
 
-               test_icalcomps (icalcomp1, e_cal_component_get_icalcomponent (ecalcomp));
+               test_icomps (icomp1, e_cal_component_get_icalcomponent (ecalcomp));
        }
-       e_cal_client_free_ecalcomp_slist (ecalcomps);
+       e_util_free_nullable_object_slist (ecalcomps);
 
-       icalcomponent_free (icalcomp1);
+       g_object_unref (icomp1);
        g_main_loop_quit (data->loop);
 }
 
@@ -149,19 +175,19 @@ async_read_result_ready (GObject *source_object,
        ECalClient *cal_client;
        GError *error = NULL;
        AsyncData *data = (AsyncData *) user_data;
-       icalcomponent *icalcomp1 = data->clone, *icalcomp2 = NULL;
+       ICalComponent *icomp1 = data->clone, *icomp2 = NULL;
 
-       g_return_if_fail (icalcomp1 != NULL);
+       g_return_if_fail (icomp1 != NULL);
 
        cal_client = E_CAL_CLIENT (source_object);
-       if (!e_cal_client_get_object_finish (cal_client, result, &icalcomp2, &error))
+       if (!e_cal_client_get_object_finish (cal_client, result, &icomp2, &error))
                g_error ("get object finish: %s", error->message);
 
-       test_icalcomps (icalcomp1, icalcomp2);
-       icalcomponent_free (icalcomp2);
+       test_icomps (icomp1, icomp2);
+       g_object_unref (icomp2);
 
        e_cal_client_get_objects_for_uid (cal_client,
-                                         icalcomponent_get_uid (icalcomp1), NULL,
+                                         i_cal_component_get_uid (icomp1), NULL,
                                          async_read2_result_ready, data);
 }
 
@@ -174,17 +200,17 @@ async_write_result_ready (GObject *source_object,
        GError *error = NULL;
        gchar *uid = NULL;
        AsyncData *data = (AsyncData *) user_data;
-       icalcomponent *clone, *icalcomp = data->icalcomp;
+       ICalComponent *clone, *icomp = data->icomp;
 
-       g_return_if_fail (icalcomp != NULL);
+       g_return_if_fail (icomp != NULL);
 
        cal_client = E_CAL_CLIENT (source_object);
 
        if (!e_cal_client_create_object_finish (cal_client, result, &uid, &error))
                g_error ("create object finish: %s", error->message);
 
-       clone = icalcomponent_new_clone (icalcomp);
-       icalcomponent_set_uid (clone, uid);
+       clone = i_cal_component_new_clone (icomp);
+       i_cal_component_set_uid (clone, uid);
 
        data->clone = clone;
        e_cal_client_get_object (cal_client, uid, NULL, NULL, async_read_result_ready, data);
@@ -196,25 +222,31 @@ test_create_object_async (ETestServerFixture *fixture,
                           gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
        AsyncData data = { 0, };
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
        /* Build up new component */
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Test event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
+
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Test event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
 
-       data.icalcomp = icalcomp;
+       data.icomp = icomp;
        data.loop = fixture->loop;
-       e_cal_client_create_object (cal_client, icalcomp, NULL, async_write_result_ready, &data);
+       e_cal_client_create_object (cal_client, icomp, NULL, async_write_result_ready, &data);
        g_main_loop_run (fixture->loop);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
 }
 
 gint
diff --git a/tests/libecal/test-cal-client-get-attachment-uris.c 
b/tests/libecal/test-cal-client-get-attachment-uris.c
index 48dd415f3..815f2bfa7 100644
--- a/tests/libecal/test-cal-client-get-attachment-uris.c
+++ b/tests/libecal/test-cal-client-get-attachment-uris.c
@@ -30,48 +30,53 @@ static ETestServerClosure cal_closure_async =
        { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, TRUE };
 
 static void
-add_attach (icalcomponent *icalcomp,
+add_attach (ICalComponent *icomp,
             const gchar *uri)
 {
-       gsize buf_size;
        gchar *buf;
-       icalproperty *prop;
-       icalattach *attach;
+       ICalProperty *prop;
+       ICalAttach *attach;
 
-       g_return_if_fail (icalcomp != NULL);
+       g_return_if_fail (icomp != NULL);
        g_return_if_fail (uri != NULL);
 
-       buf_size = 2 * strlen (uri);
-       buf = g_malloc0 (buf_size);
-       icalvalue_encode_ical_string (uri, buf, buf_size);
-       attach = icalattach_new_from_url (uri);
-       prop = icalproperty_new_attach (attach);
-       icalcomponent_add_property (icalcomp, prop);
-       icalattach_unref (attach);
+       buf = i_cal_value_encode_ical_string (uri);
+       attach = i_cal_attach_new_from_url (buf);
+       prop = i_cal_property_new_attach (attach);
+       i_cal_component_take_property (icomp, prop);
+       g_object_unref (attach);
        g_free (buf);
 }
 
 static const gchar *
 setup_cal (ECalClient *cal_client)
 {
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
        gchar *uid = NULL;
        GError *error = NULL;
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Test event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
-       add_attach (icalcomp, ATTACH1);
-       add_attach (icalcomp, ATTACH2);
-       add_attach (icalcomp, ATTACH3);
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Test event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       add_attach (icomp, ATTACH1);
+       add_attach (icomp, ATTACH2);
+       add_attach (icomp, ATTACH3);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
+
        g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free);
 
        return uid;
diff --git a/tests/libecal/test-cal-client-get-free-busy.c b/tests/libecal/test-cal-client-get-free-busy.c
index 12ebbc610..41abd46b3 100644
--- a/tests/libecal/test-cal-client-get-free-busy.c
+++ b/tests/libecal/test-cal-client-get-free-busy.c
@@ -107,16 +107,16 @@ add_component_sync (ECalClient *cal_client)
                "CREATED:20040211T080000Z\r\n"
                "LAST-MODIFIED:20040211T080000Z\r\n"
                "END:VEVENT\r\n";
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        GError *error = NULL;
 
-       icalcomp = icalcomponent_new_from_string (comp_str);
-       g_assert_nonnull (icalcomp);
+       icomp = i_cal_component_new_from_string (comp_str);
+       g_assert_nonnull (icomp);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, NULL, NULL, &error))
+       if (!e_cal_client_create_object_sync (cal_client, icomp, NULL, NULL, &error))
                g_error ("Failed to add component: %s", error ? error->message : "Unknown error");
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_clear_error (&error);
 }
 
@@ -150,7 +150,7 @@ test_get_free_busy_sync (ETestServerFixture *fixture,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icaltimezone *utc;
+       ICalTimezone *utc;
        GSList *users = NULL, *freebusy_data = NULL;
        time_t start, end;
 
@@ -163,7 +163,7 @@ test_get_free_busy_sync (ETestServerFixture *fixture,
 
        g_signal_connect (cal_client, "free-busy-data", G_CALLBACK (free_busy_data_cb), (gpointer) G_STRFUNC);
 
-       utc = icaltimezone_get_utc_timezone ();
+       utc = i_cal_timezone_get_utc_timezone ();
        start = time_from_isodate ("20040212T000000Z");
        end = time_add_day_with_zone (start, 2, utc);
        users = g_slist_append (users, (gpointer) USER_EMAIL);
@@ -211,7 +211,7 @@ test_get_free_busy_async (ETestServerFixture *fixture,
                           gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icaltimezone *utc;
+       ICalTimezone *utc;
        GSList *users = NULL;
        time_t start, end;
 
@@ -222,7 +222,7 @@ test_get_free_busy_async (ETestServerFixture *fixture,
        /* This is set by the free-busy-data callback */
        received_free_busy_data = FALSE;
 
-       utc = icaltimezone_get_utc_timezone ();
+       utc = i_cal_timezone_get_utc_timezone ();
        start = time_from_isodate ("20040212T000000Z");
        end = time_add_day_with_zone (start, 2, utc);
        users = g_slist_append (users, (gpointer) USER_EMAIL);
diff --git a/tests/libecal/test-cal-client-get-object-list.c b/tests/libecal/test-cal-client-get-object-list.c
index 45e333ae5..0e19c7925 100644
--- a/tests/libecal/test-cal-client-get-object-list.c
+++ b/tests/libecal/test-cal-client-get-object-list.c
@@ -30,29 +30,35 @@ static ETestServerClosure cal_closure_async =
 static void
 setup_cal (ECalClient *cal_client)
 {
-       struct icaltimetype now;
-       icalcomponent *icalcomp;
+       ICalTimetype *dtstart, *dtend;
+       ICalComponent *icomp;
        gchar *uid = NULL;
        GError *error = NULL;
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, EVENT_SUMMARY);
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_free (uid);
 }
 
 static void
-test_result (icalcomponent *icalcomp)
+test_result (ICalComponent *icomp)
 {
-       g_assert (icalcomp != NULL);
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, EVENT_SUMMARY);
+       g_assert_nonnull (icomp);
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, EVENT_SUMMARY);
 }
 
 static void
@@ -60,19 +66,19 @@ test_get_object_list_sync (ETestServerFixture *fixture,
                            gconstpointer user_data)
 {
        ECalClient *cal_client;
-       GSList *icalcomps = NULL, *ecalcomps = NULL;
+       GSList *icomps = NULL, *ecalcomps = NULL;
        GError *error = NULL;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
        setup_cal (cal_client);
 
-       if (!e_cal_client_get_object_list_sync (cal_client, EVENT_QUERY, &icalcomps, NULL, &error))
+       if (!e_cal_client_get_object_list_sync (cal_client, EVENT_QUERY, &icomps, NULL, &error))
                g_error ("get object list sync: %s", error->message);
 
-       g_assert_cmpint (g_slist_length (icalcomps), ==, 1);
-       test_result (icalcomps->data);
+       g_assert_cmpint (g_slist_length (icomps), ==, 1);
+       test_result (icomps->data);
 
-       e_cal_client_free_icalcomp_slist (icalcomps);
+       e_util_free_nullable_object_slist (icomps);
 
        if (!e_cal_client_get_object_list_as_comps_sync (cal_client, EVENT_QUERY, &ecalcomps, NULL, &error))
                g_error ("get object list as comps sync: %s", error->message);
@@ -80,7 +86,7 @@ test_get_object_list_sync (ETestServerFixture *fixture,
        g_assert_cmpint (g_slist_length (ecalcomps), ==, 1);
        test_result (e_cal_component_get_icalcomponent (ecalcomps->data));
 
-       e_cal_client_free_ecalcomp_slist (ecalcomps);
+       e_util_free_nullable_object_slist (ecalcomps);
 }
 
 static void
@@ -101,7 +107,7 @@ async_get_object_list_as_comps_result_ready (GObject *source_object,
        g_assert_cmpint (g_slist_length (ecalcomps), ==, 1);
        test_result (e_cal_component_get_icalcomponent (ecalcomps->data));
 
-       e_cal_client_free_ecalcomp_slist (ecalcomps);
+       e_util_free_nullable_object_slist (ecalcomps);
        g_main_loop_quit (loop);
 }
 
@@ -112,16 +118,16 @@ async_get_object_list_result_ready (GObject *source_object,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       GSList *icalcomps = NULL;
+       GSList *icomps = NULL;
 
        cal_client = E_CAL_CLIENT (source_object);
 
-       if (!e_cal_client_get_object_list_finish (cal_client, result, &icalcomps, &error))
+       if (!e_cal_client_get_object_list_finish (cal_client, result, &icomps, &error))
                g_error ("get object list finish: %s", error->message);
 
-       g_assert_cmpint (g_slist_length (icalcomps), ==, 1);
-       test_result (icalcomps->data);
-       e_cal_client_free_icalcomp_slist (icalcomps);
+       g_assert_cmpint (g_slist_length (icomps), ==, 1);
+       test_result (icomps->data);
+       e_util_free_nullable_object_slist (icomps);
 
        e_cal_client_get_object_list_as_comps (
                cal_client, EVENT_QUERY, NULL,
diff --git a/tests/libecal/test-cal-client-get-revision.c b/tests/libecal/test-cal-client-get-revision.c
index 96887a360..5b99ccf3b 100644
--- a/tests/libecal/test-cal-client-get-revision.c
+++ b/tests/libecal/test-cal-client-get-revision.c
@@ -28,23 +28,29 @@ static ETestServerClosure cal_closure =
 static void
 get_revision_compare_cycle (ECalClient *client)
 {
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
-       gchar    *revision_before = NULL, *revision_after = NULL, *uid = NULL;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
+       gchar *revision_before = NULL, *revision_after = NULL, *uid = NULL;
        GError   *error = NULL;
 
        /* Build up new component */
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Test event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
+
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Test event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
 
        if (!e_client_get_backend_property_sync (E_CLIENT (client), CLIENT_BACKEND_PROPERTY_REVISION,
                                                &revision_before, NULL, &error))
                g_error ("Error getting calendar revision: %s", error->message);
 
-       if (!e_cal_client_create_object_sync (client, icalcomp, &uid, NULL, &error))
+       if (!e_cal_client_create_object_sync (client, icomp, &uid, NULL, &error))
                g_error ("Error creating object: %s", error->message);
 
        if (!e_cal_client_remove_object_sync (client, uid, NULL, E_CAL_OBJ_MOD_ALL, NULL, &error))
@@ -66,7 +72,7 @@ get_revision_compare_cycle (ECalClient *client)
        g_free (revision_after);
        g_free (uid);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
 }
 
 static void
diff --git a/tests/libecal/test-cal-client-get-view.c b/tests/libecal/test-cal-client-get-view.c
index 220dcd32b..4af213c59 100644
--- a/tests/libecal/test-cal-client-get-view.c
+++ b/tests/libecal/test-cal-client-get-view.c
@@ -112,35 +112,37 @@ alter_cal_client (gpointer user_data)
 {
        ECalClient *cal_client = user_data;
        GError *error = NULL;
-       ICalComponent *comp;
-       ICalTimetype *now, *itt;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
        gchar *uid = NULL;
 
        g_return_val_if_fail (cal_client != NULL, NULL);
 
-       now = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
-       itt = i_cal_time_from_timet_with_zone (i_cal_time_as_timet (now) + 60 * 60 * 60, 0, NULL);
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       comp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
-       i_cal_component_set_summary (comp, "Initial event summary");
-       i_cal_component_set_dtstart (comp, now);
-       i_cal_component_set_dtend (comp, itt);
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Initial event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
 
-       if (!e_cal_client_create_object_sync (cal_client, comp, &uid, NULL, &error))
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       i_cal_component_set_uid (comp, uid);
-       i_cal_component_set_summary (comp, "Modified event summary");
+       i_cal_component_set_uid (icomp, uid);
+       i_cal_component_set_summary (icomp, "Modified event summary");
 
-       if (!e_cal_client_modify_object_sync (cal_client, comp, E_CAL_OBJ_MOD_ALL, NULL, &error))
+       if (!e_cal_client_modify_object_sync (cal_client, icomp, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("modify object sync: %s", error->message);
 
        if (!e_cal_client_remove_object_sync (cal_client, uid, NULL, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("remove object sync: %s", error->message);
 
-       g_object_unref (comp);
-       g_object_unref (itt);
-       g_object_unref (now);
+       g_object_unref (icomp);
        g_free (uid);
 
        return FALSE;
diff --git a/tests/libecal/test-cal-client-modify-object.c b/tests/libecal/test-cal-client-modify-object.c
index 7bc0ef579..09218a248 100644
--- a/tests/libecal/test-cal-client-modify-object.c
+++ b/tests/libecal/test-cal-client-modify-object.c
@@ -29,29 +29,35 @@ static ETestServerClosure cal_closure_async =
 static void
 setup_cal (ECalClient *cal_client)
 {
-       struct icaltimetype now;
-       icalcomponent *icalcomp;
+       ICalTimetype *dtstart, *dtend;
+       ICalComponent *icomp;
        gchar *uid = NULL;
        GError *error = NULL;
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Initial" EVENT_SUMMARY);
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Initial" EVENT_SUMMARY);
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free);
 }
 
 static void
-test_result (icalcomponent *icalcomp)
+test_result (ICalComponent *icomp)
 {
-       g_assert (icalcomp != NULL);
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, EVENT_SUMMARY);
+       g_assert_nonnull (icomp);
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, EVENT_SUMMARY);
 }
 
 static void
@@ -60,7 +66,7 @@ test_modify_object_sync (ETestServerFixture *fixture,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icalcomponent *icalcomp = NULL;
+       ICalComponent *icomp = NULL;
        const gchar *uid;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
@@ -69,21 +75,21 @@ test_modify_object_sync (ETestServerFixture *fixture,
        uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
        g_assert (uid != NULL);
 
-       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error))
+       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, &error))
                g_error ("get object sync: %s", error->message);
 
-       icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
+       i_cal_component_set_summary (icomp, EVENT_SUMMARY);
 
-       if (!e_cal_client_modify_object_sync (cal_client, icalcomp, E_CAL_OBJ_MOD_ALL, NULL, &error))
+       if (!e_cal_client_modify_object_sync (cal_client, icomp, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("modify object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
 
-       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error))
+       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, &error))
                g_error ("get object sync after modification: %s", error->message);
 
-       test_result (icalcomp);
-       icalcomponent_free (icalcomp);
+       test_result (icomp);
+       g_object_unref (icomp);
 }
 
 static void
@@ -93,7 +99,7 @@ async_modify_result_ready (GObject *source_object,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icalcomponent *icalcomp = NULL;
+       ICalComponent *icomp = NULL;
        const gchar *uid;
        GMainLoop *loop = (GMainLoop *) user_data;
 
@@ -103,11 +109,11 @@ async_modify_result_ready (GObject *source_object,
        if (!e_cal_client_modify_object_finish (cal_client, result, &error))
                g_error ("modify object finish: %s", error->message);
 
-       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error))
+       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, &error))
                g_error ("get object sync after async modification: %s", error->message);
 
-       test_result (icalcomp);
-       icalcomponent_free (icalcomp);
+       test_result (icomp);
+       g_object_unref (icomp);
 
        g_main_loop_quit (loop);
 }
@@ -118,7 +124,7 @@ test_modify_object_async (ETestServerFixture *fixture,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icalcomponent *icalcomp = NULL;
+       ICalComponent *icomp = NULL;
        const gchar *uid;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
@@ -127,13 +133,13 @@ test_modify_object_async (ETestServerFixture *fixture,
        uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
        g_assert (uid != NULL);
 
-       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL, &error))
+       if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, &error))
                g_error ("get object sync: %s", error->message);
 
-       icalcomponent_set_summary (icalcomp, EVENT_SUMMARY);
+       i_cal_component_set_summary (icomp, EVENT_SUMMARY);
 
-       e_cal_client_modify_object (cal_client, icalcomp, E_CAL_OBJ_MOD_ALL, NULL, async_modify_result_ready, 
fixture->loop);
-       icalcomponent_free (icalcomp);
+       e_cal_client_modify_object (cal_client, icomp, E_CAL_OBJ_MOD_ALL, NULL, async_modify_result_ready, 
fixture->loop);
+       g_object_unref (icomp);
 
        g_main_loop_run (fixture->loop);
 }
diff --git a/tests/libecal/test-cal-client-receive-objects.c b/tests/libecal/test-cal-client-receive-objects.c
index afc656a19..074e4be99 100644
--- a/tests/libecal/test-cal-client-receive-objects.c
+++ b/tests/libecal/test-cal-client-receive-objects.c
@@ -24,19 +24,25 @@ static ETestServerClosure cal_closure_sync =
 static ETestServerClosure cal_closure_async =
        { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, NULL, TRUE };
 
-static icalcomponent *
+static ICalComponent *
 create_object (void)
 {
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalTimetype *dtstart, *dtend;
+       ICalComponent *icomp;
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "To-be-received event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       return icalcomp;
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "To-be-received event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       return icomp;
 }
 
 static void
@@ -45,17 +51,17 @@ test_receive_objects_sync (ETestServerFixture *fixture,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       icalcomp = create_object ();
-       g_assert (icalcomp != NULL);
+       icomp = create_object ();
+       g_assert_nonnull (icomp);
 
-       if (!e_cal_client_receive_objects_sync (cal_client, icalcomp, NULL, &error))
+       if (!e_cal_client_receive_objects_sync (cal_client, icomp, NULL, &error))
                g_error ("receive objects sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
 }
 
 static void
@@ -80,15 +86,15 @@ test_receive_objects_async (ETestServerFixture *fixture,
                             gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       icalcomp = create_object ();
-       g_assert (icalcomp != NULL);
+       icomp = create_object ();
+       g_assert_nonnull (icomp);
 
-       e_cal_client_receive_objects (cal_client, icalcomp, NULL, async_receive_result_ready, fixture->loop);
-       icalcomponent_free (icalcomp);
+       e_cal_client_receive_objects (cal_client, icomp, NULL, async_receive_result_ready, fixture->loop);
+       g_object_unref (icomp);
 
        g_main_loop_run (fixture->loop);
 }
diff --git a/tests/libecal/test-cal-client-refresh.c b/tests/libecal/test-cal-client-refresh.c
index a17892cd8..3da09fe7b 100644
--- a/tests/libecal/test-cal-client-refresh.c
+++ b/tests/libecal/test-cal-client-refresh.c
@@ -29,20 +29,26 @@ static void
 setup_cal (ECalClient *cal_client)
 {
        GError *error = NULL;
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
        gchar *uid = NULL;
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "Test event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Test event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_free (uid);
 }
 
@@ -126,4 +132,3 @@ main (gint argc,
 
        return e_test_server_utils_run ();
 }
-
diff --git a/tests/libecal/test-cal-client-remove-object.c b/tests/libecal/test-cal-client-remove-object.c
index 200eaad2d..9ce54e1f2 100644
--- a/tests/libecal/test-cal-client-remove-object.c
+++ b/tests/libecal/test-cal-client-remove-object.c
@@ -27,23 +27,29 @@ static ETestServerClosure cal_closure_async =
 static gchar *
 create_object (ECalClient *cal_client)
 {
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
        gchar *uid = NULL;
        GError *error = NULL;
 
        g_return_val_if_fail (cal_client != NULL, NULL);
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "To-be-removed event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
 
-       if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, &error))
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "To-be-removed event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
+
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
+
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
 
        return uid;
 }
@@ -117,6 +123,7 @@ test_remove_object_empty_uid (ETestServerFixture *fixture,
        g_assert_error (
                error, E_CAL_CLIENT_ERROR,
                E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND);
+       g_clear_error (&error);
 }
 
 gint
diff --git a/tests/libecal/test-cal-client-revision-view.c b/tests/libecal/test-cal-client-revision-view.c
index a108d3221..804fe3528 100644
--- a/tests/libecal/test-cal-client-revision-view.c
+++ b/tests/libecal/test-cal-client-revision-view.c
@@ -69,7 +69,7 @@ get_last_modified (ICalComponent *component)
                res = i_cal_time_null_time ();
        }
 
-       g_clear_object (&innter);
+       g_clear_object (&inner);
 
        return res;
 }
@@ -88,7 +88,7 @@ objects_added_cb (GObject *object,
                ICalTimetype *last_modified = get_last_modified (component);
                gchar *str_recurrence, *str_last_modified;
 
-               str_recurrence = i_cal_time_as_ical_string (recurrence);
+               str_recurrence = i_cal_time_as_ical_string_r (recurrence);
                str_last_modified = i_cal_time_as_ical_string_r (last_modified);
 
                g_print (
@@ -122,7 +122,7 @@ objects_modified_cb (GObject *object,
                ICalTimetype *last_modified = get_last_modified (component);
                gchar *str_recurrence, *str_last_modified;
 
-               str_recurrence = i_cal_time_as_ical_string (recurrence);
+               str_recurrence = i_cal_time_as_ical_string_r (recurrence);
                str_last_modified = i_cal_time_as_ical_string_r (last_modified);
 
                g_print (
@@ -136,7 +136,7 @@ objects_modified_cb (GObject *object,
                g_free (str_recurrence);
                g_free (str_last_modified);
 
-               g_assert (icalcomponent_get_summary (component) == NULL);
+               g_assert (i_cal_component_get_summary (component) == NULL);
        }
 
        subtest_passed (SUBTEST_OBJECTS_MODIFIED, loop);
@@ -176,7 +176,7 @@ alter_cal_client (gpointer user_data)
 {
        ECalClient *cal_client = user_data;
        GError *error = NULL;
-       ICalComponent *comp;
+       ICalComponent *icomp;
        ICalTimetype *now, *itt;
        gchar *uid = NULL;
 
@@ -185,24 +185,24 @@ alter_cal_client (gpointer user_data)
        now = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
        itt = i_cal_time_from_timet_with_zone (i_cal_time_as_timet (now) + 60 * 60 * 60, 0, NULL);
 
-       comp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
-       i_cal_component_set_summary (comp, "Initial event summary");
-       i_cal_component_set_dtstart (comp, now);
-       i_cal_component_set_dtend   (comp, itt);
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "Initial event summary");
+       i_cal_component_set_dtstart (icomp, now);
+       i_cal_component_set_dtend   (icomp, itt);
 
-       if (!e_cal_client_create_object_sync (cal_client, comp, &uid, NULL, &error))
+       if (!e_cal_client_create_object_sync (cal_client, icomp, &uid, NULL, &error))
                g_error ("create object sync: %s", error->message);
 
-       i_cal_component_set_uid (comp, uid);
-       i_cal_component_set_summary (comp, "Modified event summary");
+       i_cal_component_set_uid (icomp, uid);
+       i_cal_component_set_summary (icomp, "Modified event summary");
 
-       if (!e_cal_client_modify_object_sync (cal_client, comp, E_CAL_OBJ_MOD_ALL, NULL, &error))
+       if (!e_cal_client_modify_object_sync (cal_client, icomp, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("modify object sync: %s", error->message);
 
        if (!e_cal_client_remove_object_sync (cal_client, uid, NULL, E_CAL_OBJ_MOD_ALL, NULL, &error))
                g_error ("remove object sync: %s", error->message);
 
-       g_object_urnef (comp);
+       g_object_unref (icomp);
        g_object_unref (now);
        g_object_unref (itt);
        g_free (uid);
diff --git a/tests/libecal/test-cal-client-send-objects.c b/tests/libecal/test-cal-client-send-objects.c
index b7bd98d83..0ece68ad6 100644
--- a/tests/libecal/test-cal-client-send-objects.c
+++ b/tests/libecal/test-cal-client-send-objects.c
@@ -43,46 +43,44 @@ print_ecomp (ECalComponent *ecalcomp)
 }
 
 static void
-print_icomp (icalcomponent *icalcomp)
+print_icomp (ICalComponent *icomp)
 {
        ECalComponent *ecomp;
 
-       g_return_if_fail (icalcomp != NULL);
+       g_assert_nonnull (icomp);
 
-       ecomp = e_cal_component_new ();
-       icalcomp = icalcomponent_new_clone (icalcomp);
-
-       if (!e_cal_component_set_icalcomponent (ecomp, icalcomp)) {
-               icalcomponent_free (icalcomp);
-               g_object_unref (ecomp);
-               g_printerr ("%s: Failed to assing icalcomp to ECalComponent\n", G_STRFUNC);
-               g_print ("\n");
-               return;
-       }
+       ecomp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
+       g_assert_nonnull (ecomp);
 
        print_ecomp (ecomp);
 
        g_object_unref (ecomp);
 }
 
-static icalcomponent *
+static ICalComponent *
 create_object (void)
 {
-       icalcomponent *icalcomp;
-       struct icaltimetype now;
+       ICalComponent *icomp;
+       ICalTimetype *dtstart, *dtend;
+
+       dtstart = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+       dtend = i_cal_timetype_new_clone (dtstart);
+       i_cal_time_adjust (dtend, 0, 1, 0, 0);
+
+       icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
+       i_cal_component_set_summary (icomp, "To-be-sent event summary");
+       i_cal_component_set_dtstart (icomp, dtstart);
+       i_cal_component_set_dtend (icomp, dtend);
 
-       now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
-       icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT);
-       icalcomponent_set_summary (icalcomp, "To-be-sent event summary");
-       icalcomponent_set_dtstart (icalcomp, now);
-       icalcomponent_set_dtend   (icalcomp, icaltime_from_timet_with_zone (icaltime_as_timet (now) + 60 * 60 
* 60, 0, NULL));
+       g_clear_object (&dtstart);
+       g_clear_object (&dtend);
 
-       return icalcomp;
+       return icomp;
 }
 
 static void
 manage_result (GSList *users,
-               icalcomponent *modified_icalcomp)
+              ICalComponent *modified_icomp)
 {
        g_print ("Wishes to send to %d users", g_slist_length (users));
        if (users) {
@@ -95,14 +93,13 @@ manage_result (GSList *users,
        }
        g_print ("\n");
 
-       if (!modified_icalcomp)
-               g_print ("No modified icalcomp, would send the same\n");
+       if (!modified_icomp)
+               g_print ("No modified iCalendar component, would send the same\n");
        else
-               print_icomp (modified_icalcomp);
+               print_icomp (modified_icomp);
 
        e_client_util_free_string_slist (users);
-       if (modified_icalcomp)
-               icalcomponent_free (modified_icalcomp);
+       g_clear_object (&modified_icomp);
 }
 
 static void
@@ -111,17 +108,17 @@ test_send_objects_sync (ETestServerFixture *fixture,
 {
        ECalClient *cal_client;
        GError *error = NULL;
-       icalcomponent *icalcomp, *modified_icalcomp = NULL;
+       ICalComponent *icomp, *modified_icomp = NULL;
        GSList *users = NULL;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       icalcomp = create_object ();
-       if (!e_cal_client_send_objects_sync (cal_client, icalcomp, &users, &modified_icalcomp, NULL, &error))
+       icomp = create_object ();
+       if (!e_cal_client_send_objects_sync (cal_client, icomp, &users, &modified_icomp, NULL, &error))
                g_error ("send objects sync: %s", error->message);
 
-       icalcomponent_free (icalcomp);
-       manage_result (users, modified_icalcomp);
+       g_object_unref (icomp);
+       manage_result (users, modified_icomp);
 }
 
 static void
@@ -132,15 +129,15 @@ async_send_result_ready (GObject *source_object,
        ECalClient *cal_client;
        GError *error = NULL;
        GSList *users = NULL;
-       icalcomponent *modified_icalcomp = NULL;
+       ICalComponent *modified_icomp = NULL;
        GMainLoop *loop = (GMainLoop *) user_data;
 
        cal_client = E_CAL_CLIENT (source_object);
 
-       if (!e_cal_client_send_objects_finish (cal_client, result, &users, &modified_icalcomp, &error))
+       if (!e_cal_client_send_objects_finish (cal_client, result, &users, &modified_icomp, &error))
                g_error ("send objects finish: %s", error->message);
 
-       manage_result (users, modified_icalcomp);
+       manage_result (users, modified_icomp);
        g_main_loop_quit (loop);
 }
 
@@ -149,15 +146,15 @@ test_send_objects_async (ETestServerFixture *fixture,
                         gconstpointer user_data)
 {
        ECalClient *cal_client;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
 
-       icalcomp = create_object ();
-       g_assert (icalcomp);
+       icomp = create_object ();
+       g_assert_nonnull (icomp);
 
-       e_cal_client_send_objects (cal_client, icalcomp, NULL, async_send_result_ready, fixture->loop);
-       icalcomponent_free (icalcomp);
+       e_cal_client_send_objects (cal_client, icomp, NULL, async_send_result_ready, fixture->loop);
+       g_object_unref (icomp);
 
        g_main_loop_run (fixture->loop);
 }
diff --git a/tests/libedata-cal/test-cal-backend-sexp.c b/tests/libedata-cal/test-cal-backend-sexp.c
index db0d7a941..8e798f9be 100644
--- a/tests/libedata-cal/test-cal-backend-sexp.c
+++ b/tests/libedata-cal/test-cal-backend-sexp.c
@@ -28,6 +28,8 @@ test_query (const gchar *query)
        } else {
                printf ("%s: no time prunning possible\n", query);
        }
+
+       g_object_unref (sexp);
 }
 
 gint
diff --git a/tests/libedata-cal/test-cal-cache-intervals.c b/tests/libedata-cal/test-cal-cache-intervals.c
index ba1962c73..a72a6cf29 100644
--- a/tests/libedata-cal/test-cal-cache-intervals.c
+++ b/tests/libedata-cal/test-cal-cache-intervals.c
@@ -73,20 +73,24 @@ search_in_intervals (ETimezoneCache *zone_cache,
                     time_t end)
 {
        ECalBackendSExp *sexp;
-       struct icaltimetype itt_start, itt_end;
+       ICalTimetype *itt_start, *itt_end;
        gchar *expr;
        GSList *link;
        GHashTable *res;
 
-       itt_start = icaltime_from_timet_with_zone (start, FALSE, NULL);
-       itt_end = icaltime_from_timet_with_zone (end, FALSE, NULL);
+       itt_start = i_cal_time_from_timet_with_zone (start, FALSE, NULL);
+       itt_end = i_cal_time_from_timet_with_zone (end, FALSE, NULL);
 
        expr = g_strdup_printf ("(occur-in-time-range? (make-time \"%04d%02d%02dT%02d%02d%02dZ\") (make-time 
\"%04d%02d%02dT%02d%02d%02dZ\"))",
-               itt_start.year, itt_start.month, itt_start.day, itt_start.hour, itt_start.minute, 
itt_start.second,
-               itt_end.year, itt_end.month, itt_end.day, itt_end.hour, itt_end.minute, itt_end.second);
+               i_cal_timetype_get_year (itt_start), i_cal_timetype_get_month (itt_start), 
i_cal_timetype_get_day (itt_start),
+               i_cal_timetype_get_hour (itt_start), i_cal_timetype_get_minute (itt_start), 
i_cal_timetype_get_second (itt_start),
+               i_cal_timetype_get_year (itt_end), i_cal_timetype_get_month (itt_end), i_cal_timetype_get_day 
(itt_end),
+               i_cal_timetype_get_hour (itt_end), i_cal_timetype_get_minute (itt_end), 
i_cal_timetype_get_second (itt_end));
 
        sexp = e_cal_backend_sexp_new (expr);
 
+       g_clear_object (&itt_start);
+       g_clear_object (&itt_end);
        g_free (expr);
 
        g_assert_nonnull (sexp);
@@ -139,32 +143,40 @@ create_test_component (time_t start,
                       time_t end)
 {
        ECalComponent *comp;
-       ECalComponentText summary;
-       struct icaltimetype current, ittstart, ittend;
+       ECalComponentText *summary;
+       ICalTimetype *current, *ittstart, *ittend;
+       gchar *startstr, *endstr, *tmp;
 
        comp = e_cal_component_new ();
 
        e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
 
-       ittstart = icaltime_from_timet_with_zone (start, 0, NULL);
-       ittend = icaltime_from_timet_with_zone (end, 0, NULL);
+       ittstart = i_cal_time_from_timet_with_zone (start, 0, NULL);
+       ittend = i_cal_time_from_timet_with_zone (end, 0, NULL);
 
-       icalcomponent_set_dtstart (e_cal_component_get_icalcomponent (comp), ittstart);
-       if (end != _TIME_MAX)
-               icalcomponent_set_dtend (e_cal_component_get_icalcomponent (comp), ittend);
+       i_cal_component_set_dtstart (e_cal_component_get_icalcomponent (comp), ittstart);
+       i_cal_component_set_dtend (e_cal_component_get_icalcomponent (comp), ittend);
 
-       summary.value = g_strdup_printf ("%s - %s", icaltime_as_ical_string (ittstart), 
icaltime_as_ical_string (ittend));
-       summary.altrep = NULL;
+       startstr = i_cal_time_as_ical_string_r (ittstart);
+       endstr = i_cal_time_as_ical_string_r (ittend);
 
-       e_cal_component_set_summary (comp, &summary);
+       tmp = g_strdup_printf ("%s - %s", startstr, endstr);
+       summary = e_cal_component_text_new (tmp, NULL);
+       g_free (tmp);
 
-       g_free ((gchar *) summary.value);
+       g_object_unref (ittstart);
+       g_object_unref (ittend);
+       g_free (startstr);
+       g_free (endstr);
 
-       current = icaltime_from_timet_with_zone (time (NULL), 0, NULL);
-       e_cal_component_set_created (comp, &current);
-       e_cal_component_set_last_modified (comp, &current);
+       e_cal_component_set_summary (comp, summary);
 
-       e_cal_component_rescan (comp);
+       e_cal_component_text_free (summary);
+
+       current = i_cal_time_from_timet_with_zone (time (NULL), 0, NULL);
+       e_cal_component_set_created (comp, current);
+       e_cal_component_set_last_modified (comp, current);
+       g_object_unref (current);
 
        return comp;
 }
diff --git a/tests/libedata-cal/test-cal-cache-offline.c b/tests/libedata-cal/test-cal-cache-offline.c
index e6aed5f92..8e247157a 100644
--- a/tests/libedata-cal/test-cal-cache-offline.c
+++ b/tests/libedata-cal/test-cal-cache-offline.c
@@ -71,8 +71,8 @@ test_check_search_result (const GSList *list,
 
                        component = e_cal_component_new_from_string (sd->object);
                        g_assert (E_IS_CAL_COMPONENT (component));
-                       g_assert_cmpstr (uid, ==, icalcomponent_get_uid (e_cal_component_get_icalcomponent 
(component)));
-                       g_assert_nonnull (icalcomponent_get_summary (e_cal_component_get_icalcomponent 
(component)));
+                       g_assert_cmpstr (uid, ==, e_cal_component_get_uid (component));
+                       g_assert_nonnull (i_cal_component_get_summary (e_cal_component_get_icalcomponent 
(component)));
 
                        g_clear_object (&component);
                } else {
@@ -272,7 +272,7 @@ test_check_edit_saved (TCUFixture *fixture,
        g_assert (e_cal_cache_get_component (fixture->cal_cache, uid, NULL, &component, NULL, &error));
        g_assert_no_error (error);
        g_assert_nonnull (component);
-       g_assert_cmpstr (icalcomponent_get_summary (e_cal_component_get_icalcomponent (component)), ==, 
summ_value);
+       g_assert_cmpstr (i_cal_component_get_summary (e_cal_component_get_icalcomponent (component)), ==, 
summ_value);
 
        g_clear_object (&component);
 }
@@ -315,7 +315,7 @@ test_verify_storage (TCUFixture *fixture,
        g_assert_no_error (error);
 
        g_assert_cmpstr (saved_extra, ==, expect_extra);
-       g_assert_cmpstr (icalcomponent_get_summary (e_cal_component_get_icalcomponent (component)), ==, 
expect_summ);
+       g_assert_cmpstr (i_cal_component_get_summary (e_cal_component_get_icalcomponent (component)), ==, 
expect_summ);
 
        g_clear_object (&component);
        g_free (saved_extra);
@@ -372,7 +372,7 @@ test_offline_basics (TCUFixture *fixture,
        test_fill_cache (fixture, &component);
        g_assert_nonnull (component);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (fixture->cal_cache), E_CACHE_EXCLUDE_DELETED, NULL, 
&error), ==, 3);
@@ -397,7 +397,7 @@ test_offline_basics (TCUFixture *fixture,
        g_slist_free_full (ids, e_cal_component_id_free);
        ids = NULL;
 
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-0");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-0");
 
        test_check_offline_state (fixture, uid, E_OFFLINE_STATE_SYNCED);
 
@@ -450,7 +450,7 @@ test_offline_basics (TCUFixture *fixture,
        test_check_offline_changes (fixture, NULL);
 
        /* Edit in online */
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-1");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-1");
 
        g_assert (e_cal_cache_put_component (fixture->cal_cache, component, NULL, E_CACHE_IS_ONLINE, NULL, 
&error));
        g_assert_no_error (error);
@@ -458,7 +458,7 @@ test_offline_basics (TCUFixture *fixture,
        test_verify_storage (fixture, uid, "summ-1", NULL, E_OFFLINE_STATE_SYNCED);
        test_check_offline_changes (fixture, NULL);
 
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
 
        g_assert (e_cal_cache_put_component (fixture->cal_cache, component, "extra-2", E_CACHE_IS_ONLINE, 
NULL, &error));
        g_assert_no_error (error);
@@ -531,7 +531,7 @@ test_offline_add_one (TCUFixture *fixture,
                component = tcu_new_component_from_test_case (case_name);
                g_assert_nonnull (component);
 
-               uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+               uid = e_cal_component_get_uid (component);
                g_assert_nonnull (uid);
 
                test_check_offline_state (fixture, uid, E_OFFLINE_STATE_UNKNOWN);
@@ -614,7 +614,7 @@ test_offline_add_edit (TCUFixture *fixture,
                NULL);
 
        /* Modify added in offline */
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
 
        g_assert (e_cal_cache_put_component (fixture->cal_cache, component, NULL, E_CACHE_IS_OFFLINE, NULL, 
&error));
        g_assert_no_error (error);
@@ -654,7 +654,7 @@ test_offline_add_delete (TCUFixture *fixture,
                "event-3", E_OFFLINE_STATE_LOCALLY_CREATED,
                NULL);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        /* Delete added in offline */
@@ -693,7 +693,7 @@ test_offline_add_delete_add (TCUFixture *fixture,
                "event-3", E_OFFLINE_STATE_LOCALLY_CREATED,
                NULL);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        /* Delete added in offline */
@@ -759,7 +759,7 @@ test_offline_edit_common (TCUFixture *fixture,
        test_fill_cache (fixture, &component);
        g_assert_nonnull (component);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (fixture->cal_cache), E_CACHE_EXCLUDE_DELETED, NULL, 
&error), ==, 3);
@@ -769,7 +769,7 @@ test_offline_edit_common (TCUFixture *fixture,
        test_check_offline_state (fixture, uid, E_OFFLINE_STATE_SYNCED);
 
        /* Modify in offline */
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-2");
 
        g_assert (e_cal_cache_put_component (fixture->cal_cache, component, NULL, E_CACHE_IS_OFFLINE, NULL, 
&error));
        g_assert_no_error (error);
@@ -865,7 +865,7 @@ test_offline_delete (TCUFixture *fixture,
        test_fill_cache (fixture, &component);
        g_assert_nonnull (component);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (fixture->cal_cache), E_CACHE_EXCLUDE_DELETED, NULL, 
&error), ==, 3);
@@ -903,7 +903,7 @@ test_offline_delete_add (TCUFixture *fixture,
        test_fill_cache (fixture, &component);
        g_assert_nonnull (component);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (fixture->cal_cache), E_CACHE_EXCLUDE_DELETED, NULL, 
&error), ==, 3);
@@ -952,7 +952,7 @@ test_offline_delete_add (TCUFixture *fixture,
        test_check_offline_state (fixture, "event-3", E_OFFLINE_STATE_LOCALLY_CREATED);
 
        /* Modify the previous component and add it again */
-       icalcomponent_set_summary (e_cal_component_get_icalcomponent (component), "summ-3");
+       i_cal_component_set_summary (e_cal_component_get_icalcomponent (component), "summ-3");
 
        g_assert (e_cal_cache_put_component (fixture->cal_cache, component, NULL, E_CACHE_IS_OFFLINE, NULL, 
&error));
        g_assert_no_error (error);
@@ -986,7 +986,7 @@ test_offline_delete_resync (TCUFixture *fixture,
        test_fill_cache (fixture, &component);
        g_assert_nonnull (component);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (component));
+       uid = e_cal_component_get_uid (component);
        g_assert_nonnull (uid);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (fixture->cal_cache), E_CACHE_EXCLUDE_DELETED, NULL, 
&error), ==, 3);
diff --git a/tests/libedata-cal/test-cal-cache-search.c b/tests/libedata-cal/test-cal-cache-search.c
index 43e644128..500b81a53 100644
--- a/tests/libedata-cal/test-cal-cache-search.c
+++ b/tests/libedata-cal/test-cal-cache-search.c
@@ -121,15 +121,19 @@ search_data_check_cb (GHashTable *should_be,
                      gpointer item_data)
 {
        ECalCacheSearchData *sd = item_data;
-       ECalComponentId id;
+       ECalComponentId *id;
+       gboolean contains;
 
        g_assert (sd != NULL);
        g_assert (sd->uid != NULL);
 
-       id.uid = sd->uid;
-       id.rid = sd->rid;
+       id = e_cal_component_id_new (sd->uid, sd->rid);
+
+       contains = g_hash_table_contains (should_be, id);
 
-       return g_hash_table_contains (should_be, &id);
+       e_cal_component_id_free (id);
+
+       return contains;
 }
 
 static gboolean
diff --git a/tests/libedata-cal/test-cal-meta-backend.c b/tests/libedata-cal/test-cal-meta-backend.c
index a4fe11359..6a528a45b 100644
--- a/tests/libedata-cal/test-cal-meta-backend.c
+++ b/tests/libedata-cal/test-cal-meta-backend.c
@@ -37,7 +37,7 @@ void _e_cal_backend_remove_cached_timezones (ECalBackend *cal_backend); /* e-cal
 typedef struct _ECalMetaBackendTest {
        ECalMetaBackend parent;
 
-       icalcomponent *vcalendar;
+       ICalComponent *vcalendar;
 
        gint sync_tag_index;
        gboolean can_connect;
@@ -70,7 +70,7 @@ ecmb_test_add_test_case (ECalMetaBackendTest *test_backend,
                         const gchar *case_name)
 {
        gchar *icalstr;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_assert_nonnull (test_backend);
        g_assert_nonnull (case_name);
@@ -78,11 +78,29 @@ ecmb_test_add_test_case (ECalMetaBackendTest *test_backend,
        icalstr = tcu_new_icalstring_from_test_case (case_name);
        g_assert_nonnull (icalstr);
 
-       icalcomp = icalcomponent_new_from_string (icalstr);
-       g_assert_nonnull (icalcomp);
+       icomp = i_cal_component_new_from_string (icalstr);
+       g_assert_nonnull (icomp);
        g_free (icalstr);
 
-       icalcomponent_add_component (test_backend->vcalendar, icalcomp);
+       i_cal_component_take_component (test_backend->vcalendar, icomp);
+}
+
+static gchar *
+ecmb_test_get_rid_as_string (ICalComponent *icomp)
+{
+       gchar *rid = NULL;
+
+       g_assert_nonnull (icomp);
+
+       if (e_cal_util_component_has_property (icomp, I_CAL_RECURRENCEID_PROPERTY)) {
+               ICalTimetype *itt;
+
+               itt = i_cal_component_get_recurrenceid (icomp);
+               rid = i_cal_time_as_ical_string_r (itt);
+               g_clear_object (&itt);
+       }
+
+       return rid;
 }
 
 static void
@@ -90,7 +108,7 @@ ecmb_test_remove_component (ECalMetaBackendTest *test_backend,
                            const gchar *uid,
                            const gchar *rid)
 {
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_assert_nonnull (test_backend);
        g_assert_nonnull (uid);
@@ -98,22 +116,27 @@ ecmb_test_remove_component (ECalMetaBackendTest *test_backend,
        if (rid && !*rid)
                rid = NULL;
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;) {
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;) {
                const gchar *server_uid;
+               gchar *server_rid;
 
-               server_uid = icalcomponent_get_uid (icalcomp);
+               server_uid = i_cal_component_get_uid (icomp);
                g_assert_nonnull (server_uid);
 
-               if (g_str_equal (server_uid, uid) && (!rid || !*rid ||
-                   (icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY) &&
-                   g_str_equal (rid, icaltime_as_ical_string (icalcomponent_get_recurrenceid (icalcomp)))))) 
{
-                       icalcomponent_remove_component (test_backend->vcalendar, icalcomp);
-                       icalcomponent_free (icalcomp);
+               server_rid = ecmb_test_get_rid_as_string (icomp);
+
+               if (g_str_equal (server_uid, uid) && (!rid || !*rid || (server_rid && g_str_equal (rid, 
server_rid)))) {
+                       i_cal_component_remove_component (test_backend->vcalendar, icomp);
+                       g_object_unref (icomp);
+                       g_free (server_rid);
 
-                       icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       icomp = i_cal_component_get_first_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                } else {
-                       icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       g_object_unref (icomp);
+                       g_free (server_rid);
+
+                       icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                }
        }
 }
@@ -139,18 +162,18 @@ ecmb_test_gather_ids (va_list args)
 }
 
 static void
-ecmb_test_vcalendar_contains (icalcomponent *vcalendar,
+ecmb_test_vcalendar_contains (ICalComponent *vcalendar,
                              gboolean negate,
                              gboolean exact,
                              ...) /* <uid, rid> pairs, ended with NULL */
 {
        va_list args;
        GHashTable *expects;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        guint ntotal;
 
        g_return_if_fail (vcalendar != NULL);
-       g_return_if_fail (icalcomponent_isa (vcalendar) == ICAL_VCALENDAR_COMPONENT);
+       g_return_if_fail (i_cal_component_isa (vcalendar) == I_CAL_VCALENDAR_COMPONENT);
 
        va_start (args, exact);
        expects = ecmb_test_gather_ids (args);
@@ -158,25 +181,23 @@ ecmb_test_vcalendar_contains (icalcomponent *vcalendar,
 
        ntotal = g_hash_table_size (expects);
 
-       for (icalcomp = icalcomponent_get_first_component (vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (vcalendar, ICAL_VEVENT_COMPONENT)) {
-               ECalComponentId id;
+       for (icomp = i_cal_component_get_first_component (vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
+               ECalComponentId *id;
 
-               id.uid = (gpointer) icalcomponent_get_uid (icalcomp);
-               if (icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))
-                       id.rid = (gpointer) icaltime_as_ical_string (icalcomponent_get_recurrenceid 
(icalcomp));
-               else
-                       id.rid = NULL;
+               id = e_cal_component_id_new_take (g_strdup (i_cal_component_get_uid (icomp)), 
ecmb_test_get_rid_as_string (icomp));
 
                if (exact) {
                        if (negate)
-                               g_assert (!g_hash_table_remove (expects, &id));
+                               g_assert (!g_hash_table_remove (expects, id));
                        else
-                               g_assert (g_hash_table_remove (expects, &id));
+                               g_assert (g_hash_table_remove (expects, id));
                } else {
-                       g_hash_table_remove (expects, &id);
+                       g_hash_table_remove (expects, id);
                }
+
+               e_cal_component_id_free (id);
        }
 
        if (negate)
@@ -228,27 +249,29 @@ ecmb_test_cache_contains (ECalCache *cal_cache,
 
 static void
 ecmb_test_cache_and_server_equal (ECalCache *cal_cache,
-                                 icalcomponent *vcalendar,
+                                 ICalComponent *vcalendar,
                                  ECacheDeletedFlag deleted_flag)
 {
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_return_if_fail (E_IS_CAL_CACHE (cal_cache));
        g_return_if_fail (vcalendar != NULL);
 
        g_assert_cmpint (e_cache_get_count (E_CACHE (cal_cache), deleted_flag, NULL, NULL), ==,
-               icalcomponent_count_components (vcalendar, ICAL_VEVENT_COMPONENT));
+               i_cal_component_count_components (vcalendar, I_CAL_VEVENT_COMPONENT));
 
-       for (icalcomp = icalcomponent_get_first_component (vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (vcalendar, ICAL_VEVENT_COMPONENT)) {
-               const gchar *uid, *rid = NULL;
+       for (icomp = i_cal_component_get_first_component (vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
+               const gchar *uid;
+               gchar *rid = NULL;
 
-               uid = icalcomponent_get_uid (icalcomp);
-               if (icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))
-                       rid = icaltime_as_ical_string (icalcomponent_get_recurrenceid (icalcomp));
+               uid = i_cal_component_get_uid (icomp);
+               rid = ecmb_test_get_rid_as_string (icomp);
 
                g_assert (e_cal_cache_contains (cal_cache, uid, rid, deleted_flag));
+
+               g_free (rid);
        }
 }
 
@@ -369,7 +392,7 @@ e_cal_meta_backend_test_list_existing_sync (ECalMetaBackend *meta_backend,
 {
        ECalMetaBackendTest *test_backend;
        ECalCache *cal_cache;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_return_val_if_fail (E_IS_CAL_META_BACKEND_TEST (meta_backend), FALSE);
        g_return_val_if_fail (out_new_sync_tag, FALSE);
@@ -385,19 +408,19 @@ e_cal_meta_backend_test_list_existing_sync (ECalMetaBackend *meta_backend,
 
        *out_existing_objects = NULL;
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT)) {
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
                const gchar *uid;
                gchar *revision;
                ECalMetaBackendInfo *nfo;
 
                /* Detached instances are stored together with the master object */
-               if (icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY))
+               if (e_cal_util_component_has_property (icomp, I_CAL_RECURRENCEID_PROPERTY))
                        continue;
 
-               uid = icalcomponent_get_uid (icalcomp);
-               revision = e_cal_cache_dup_component_revision (cal_cache, icalcomp);
+               uid = i_cal_component_get_uid (icomp);
+               revision = e_cal_cache_dup_component_revision (cal_cache, icomp);
 
                nfo = e_cal_meta_backend_info_new (uid, revision, NULL, NULL);
                *out_existing_objects = g_slist_prepend (*out_existing_objects, nfo);
@@ -422,7 +445,7 @@ e_cal_meta_backend_test_save_component_sync (ECalMetaBackend *meta_backend,
                                             GError **error)
 {
        ECalMetaBackendTest *test_backend;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        const gchar *uid;
        GSList *link;
 
@@ -435,14 +458,14 @@ e_cal_meta_backend_test_save_component_sync (ECalMetaBackend *meta_backend,
 
        g_assert (test_backend->is_connected);
 
-       uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (instances->data));
+       uid = e_cal_component_get_uid (instances->data);
        g_assert_nonnull (uid);
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;) {
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;) {
                const gchar *server_uid;
 
-               server_uid = icalcomponent_get_uid (icalcomp);
+               server_uid = i_cal_component_get_uid (icomp);
                g_assert_nonnull (server_uid);
 
                if (g_str_equal (server_uid, uid)) {
@@ -451,12 +474,13 @@ e_cal_meta_backend_test_save_component_sync (ECalMetaBackend *meta_backend,
                                return FALSE;
                        }
 
-                       icalcomponent_remove_component (test_backend->vcalendar, icalcomp);
-                       icalcomponent_free (icalcomp);
+                       i_cal_component_remove_component (test_backend->vcalendar, icomp);
+                       g_object_unref (icomp);
 
-                       icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       icomp = i_cal_component_get_first_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                } else {
-                       icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       g_object_unref (icomp);
+                       icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                }
        }
 
@@ -464,13 +488,13 @@ e_cal_meta_backend_test_save_component_sync (ECalMetaBackend *meta_backend,
                ECalComponent *comp = link->data;
                const gchar *comp_uid;
 
-               icalcomp = e_cal_component_get_icalcomponent (comp);
-               g_assert_nonnull (icalcomp);
+               icomp = e_cal_component_get_icalcomponent (comp);
+               g_assert_nonnull (icomp);
 
-               comp_uid = icalcomponent_get_uid (icalcomp);
+               comp_uid = i_cal_component_get_uid (icomp);
                g_assert_cmpstr (uid, ==, comp_uid);
 
-               icalcomponent_add_component (test_backend->vcalendar, icalcomponent_new_clone (icalcomp));
+               i_cal_component_take_component (test_backend->vcalendar, i_cal_component_new_clone (icomp));
        }
 
        *out_new_uid = g_strdup (uid);
@@ -482,13 +506,13 @@ static gboolean
 e_cal_meta_backend_test_load_component_sync (ECalMetaBackend *meta_backend,
                                             const gchar *uid,
                                             const gchar *extra,
-                                            icalcomponent **out_instances,
+                                            ICalComponent **out_instances,
                                             gchar **out_extra,
                                             GCancellable *cancellable,
                                             GError **error)
 {
        ECalMetaBackendTest *test_backend;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_return_val_if_fail (E_IS_CAL_META_BACKEND_TEST (meta_backend), FALSE);
        g_return_val_if_fail (uid != NULL, FALSE);
@@ -502,19 +526,19 @@ e_cal_meta_backend_test_load_component_sync (ECalMetaBackend *meta_backend,
 
        *out_instances = NULL;
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT)) {
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
                const gchar *server_uid;
 
-               server_uid = icalcomponent_get_uid (icalcomp);
+               server_uid = i_cal_component_get_uid (icomp);
                g_assert_nonnull (server_uid);
 
                if (g_str_equal (server_uid, uid)) {
                        if (!*out_instances)
                                *out_instances = e_cal_util_new_top_level ();
 
-                       icalcomponent_add_component (*out_instances, icalcomponent_new_clone (icalcomp));
+                       i_cal_component_take_component (*out_instances, i_cal_component_new_clone (icomp));
                }
        }
 
@@ -538,7 +562,7 @@ e_cal_meta_backend_test_remove_component_sync (ECalMetaBackend *meta_backend,
                                               GError **error)
 {
        ECalMetaBackendTest *test_backend;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        gboolean success = FALSE;
 
        g_return_val_if_fail (E_IS_CAL_META_BACKEND_TEST (meta_backend), FALSE);
@@ -550,11 +574,11 @@ e_cal_meta_backend_test_remove_component_sync (ECalMetaBackend *meta_backend,
 
        g_assert (test_backend->is_connected);
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;) {
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;) {
                const gchar *server_uid;
 
-               server_uid = icalcomponent_get_uid (icalcomp);
+               server_uid = i_cal_component_get_uid (icomp);
                g_assert_nonnull (server_uid);
 
                if (g_str_equal (server_uid, uid)) {
@@ -568,12 +592,13 @@ e_cal_meta_backend_test_remove_component_sync (ECalMetaBackend *meta_backend,
 
                        success = TRUE;
 
-                       icalcomponent_remove_component (test_backend->vcalendar, icalcomp);
-                       icalcomponent_free (icalcomp);
+                       i_cal_component_remove_component (test_backend->vcalendar, icomp);
+                       g_object_unref (icomp);
 
-                       icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       icomp = i_cal_component_get_first_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                } else {
-                       icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, 
ICAL_VEVENT_COMPONENT);
+                       g_object_unref (icomp);
+                       icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT);
                }
        }
 
@@ -618,7 +643,7 @@ e_cal_meta_backend_test_finalize (GObject *object)
 
        g_assert_nonnull (test_backend->vcalendar);
 
-       icalcomponent_free (test_backend->vcalendar);
+       g_object_unref (test_backend->vcalendar);
 
        /* Chain up to parent's method. */
        G_OBJECT_CLASS (e_cal_meta_backend_test_parent_class)->finalize (object);
@@ -788,12 +813,12 @@ e_cal_meta_backend_test_call_refresh (ECalMetaBackend *meta_backend)
 }
 
 static void
-assert_tzid_matches_cb (icalparameter *param,
+assert_tzid_matches_cb (ICalParameter *param,
                        gpointer user_data)
 {
        const gchar *expected_tzid = user_data;
 
-       g_assert_cmpstr (icalparameter_get_tzid (param), ==, expected_tzid);
+       g_assert_cmpstr (i_cal_parameter_get_tzid (param), ==, expected_tzid);
 }
 
 static void
@@ -802,8 +827,8 @@ test_merge_instances (TCUFixture *fixture,
 {
        ECalMetaBackend *meta_backend;
        GSList *instances = NULL;
-       icalcomponent *icalcomp, *subcomp;
-       icalproperty *prop;
+       ICalComponent *icomp, *subcomp;
+       ICalProperty *prop;
        gboolean success;
        GError *error = NULL;
 
@@ -817,28 +842,30 @@ test_merge_instances (TCUFixture *fixture,
        g_assert_nonnull (instances);
 
        /* TZID as is */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 1);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 1);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_ANY_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VEVENT_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VEVENT_COMPONENT);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (subcomp);
+       g_object_unref (icomp);
 
        /* TZID as location */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 1);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 1);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_ANY_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VEVENT_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VEVENT_COMPONENT);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (subcomp);
+       g_object_unref (icomp);
 
        g_slist_free_full (instances, g_object_unref);
        instances = NULL;
@@ -850,48 +877,56 @@ test_merge_instances (TCUFixture *fixture,
        g_assert_nonnull (instances);
 
        /* TZID as is */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 2);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VTIMEZONE_COMPONENT), ==, 1);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VEVENT_COMPONENT), ==, 1);
-
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 2);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VTIMEZONE_COMPONENT), ==, 1);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VEVENT_COMPONENT), ==, 1);
+
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VTIMEZONE_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VTIMEZONE_COMPONENT);
 
-       prop = icalcomponent_get_first_property (subcomp, ICAL_TZID_PROPERTY);
+       prop = i_cal_component_get_first_property (subcomp, I_CAL_TZID_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_cmpstr (icalproperty_get_tzid (prop), ==, EXPECTED_TZID);
+       g_assert_cmpstr (i_cal_property_get_tzid (prop), ==, EXPECTED_TZID);
+
+       g_object_unref (prop);
+       g_object_unref (subcomp);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_TZID);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (subcomp);
+       g_object_unref (icomp);
 
        /* TZID to location */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 2);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VTIMEZONE_COMPONENT), ==, 1);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VEVENT_COMPONENT), ==, 1);
-
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 2);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VTIMEZONE_COMPONENT), ==, 1);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VEVENT_COMPONENT), ==, 1);
+
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VTIMEZONE_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VTIMEZONE_COMPONENT);
 
-       prop = icalcomponent_get_first_property (subcomp, ICAL_TZID_PROPERTY);
+       prop = i_cal_component_get_first_property (subcomp, I_CAL_TZID_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_cmpstr (icalproperty_get_tzid (prop), ==, EXPECTED_LOCATION);
+       g_assert_cmpstr (i_cal_property_get_tzid (prop), ==, EXPECTED_LOCATION);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       g_object_unref (prop);
+       g_object_unref (subcomp);
+
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_LOCATION);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (subcomp);
+       g_object_unref (icomp);
        g_slist_free_full (instances, g_object_unref);
        instances = NULL;
 
@@ -902,63 +937,74 @@ test_merge_instances (TCUFixture *fixture,
        g_assert_nonnull (instances);
 
        /* TZID as is */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 3);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VTIMEZONE_COMPONENT), ==, 1);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VEVENT_COMPONENT), ==, 2);
-
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, FALSE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 3);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VTIMEZONE_COMPONENT), ==, 1);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VEVENT_COMPONENT), ==, 2);
+
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VTIMEZONE_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VTIMEZONE_COMPONENT);
 
-       prop = icalcomponent_get_first_property (subcomp, ICAL_TZID_PROPERTY);
+       prop = i_cal_component_get_first_property (subcomp, I_CAL_TZID_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_cmpstr (icalproperty_get_tzid (prop), ==, EXPECTED_LOCATION);
+       g_assert_cmpstr (i_cal_property_get_tzid (prop), ==, EXPECTED_LOCATION);
+
+       g_object_unref (subcomp);
+       g_object_unref (prop);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_LOCATION);
 
-       subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       g_object_unref (subcomp);
+
+       subcomp = i_cal_component_get_next_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_LOCATION);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (subcomp);
+       g_object_unref (icomp);
 
        /* TZID to location */
-       icalcomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_ANY_COMPONENT), ==, 3);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VTIMEZONE_COMPONENT), ==, 1);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VEVENT_COMPONENT), ==, 2);
-
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+       icomp = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_ANY_COMPONENT), ==, 3);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VTIMEZONE_COMPONENT), ==, 1);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VEVENT_COMPONENT), ==, 2);
+
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
        g_assert_nonnull (subcomp);
-       g_assert_cmpint (icalcomponent_isa (subcomp), ==, ICAL_VTIMEZONE_COMPONENT);
+       g_assert_cmpint (i_cal_component_isa (subcomp), ==, I_CAL_VTIMEZONE_COMPONENT);
 
-       prop = icalcomponent_get_first_property (subcomp, ICAL_TZID_PROPERTY);
+       prop = i_cal_component_get_first_property (subcomp, I_CAL_TZID_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_cmpstr (icalproperty_get_tzid (prop), ==, EXPECTED_LOCATION);
+       g_assert_cmpstr (i_cal_property_get_tzid (prop), ==, EXPECTED_LOCATION);
+       g_object_unref (prop);
+
+       g_object_unref (subcomp);
 
-       subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       subcomp = i_cal_component_get_first_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_LOCATION);
+       g_object_unref (subcomp);
 
-       subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VEVENT_COMPONENT);
+       subcomp = i_cal_component_get_next_component (icomp, I_CAL_VEVENT_COMPONENT);
        g_assert_nonnull (subcomp);
-       icalcomponent_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) icalproperty_get_tzid (prop));
+       i_cal_component_foreach_tzid (subcomp, assert_tzid_matches_cb, (gpointer) EXPECTED_LOCATION);
+       g_object_unref (subcomp);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_slist_free_full (instances, g_object_unref);
 
        g_object_unref (meta_backend);
 }
 
 static void
-check_attachment_content (icalattach *attach,
+check_attachment_content (ICalAttach *attach,
                          const gchar *expected_content,
                          gsize expected_content_len)
 {
@@ -966,7 +1012,7 @@ check_attachment_content (icalattach *attach,
        g_assert_nonnull (expected_content);
        g_assert_cmpint (expected_content_len, >, 0);
 
-       if (icalattach_get_is_url (attach)) {
+       if (i_cal_attach_get_is_url (attach)) {
                const gchar *url;
                gboolean success;
                gchar *filename;
@@ -974,11 +1020,11 @@ check_attachment_content (icalattach *attach,
                gsize content_len = -1;
                GError *error = NULL;
 
-               url = icalattach_get_url (attach);
+               url = i_cal_attach_get_url (attach);
                g_assert_nonnull (url);
                g_assert (g_str_has_prefix (url, "file://"));
 
-               filename = g_filename_from_uri (icalattach_get_url (attach), NULL, &error);
+               filename = g_filename_from_uri (url, NULL, &error);
                g_assert_no_error (error);
                g_assert_nonnull (filename);
 
@@ -996,7 +1042,7 @@ check_attachment_content (icalattach *attach,
                guchar *base64;
                gsize base64_len;
 
-               base64 = g_base64_decode ((const gchar *) icalattach_get_data (attach), &base64_len);
+               base64 = g_base64_decode (i_cal_attach_get_data (attach), &base64_len);
                g_assert_nonnull (base64);
                g_assert_cmpmem (base64, base64_len, expected_content, expected_content_len);
 
@@ -1012,10 +1058,10 @@ test_attachments (TCUFixture *fixture,
        gchar *content = NULL;
        gsize content_len = 0;
        ECalComponent *comp = NULL;
-       icalcomponent *icalcomp;
-       icalproperty *prop;
-       icalparameter *param;
-       icalattach *attach;
+       ICalComponent *icomp;
+       ICalProperty *prop;
+       ICalParameter *param;
+       ICalAttach *attach;
        gchar *filename;
        const gchar *basename;
        gboolean success;
@@ -1030,19 +1076,19 @@ test_attachments (TCUFixture *fixture,
        g_assert (success);
        g_assert_nonnull (comp);
 
-       icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 1);
+       icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 1);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (icalattach_get_is_url (attach));
+       g_assert (i_cal_attach_get_is_url (attach));
 
-       filename = g_filename_from_uri (icalattach_get_url (attach), NULL, &error);
+       filename = g_filename_from_uri (i_cal_attach_get_url (attach), NULL, &error);
        g_assert_no_error (error);
        g_assert_nonnull (filename);
 
@@ -1056,115 +1102,139 @@ test_attachments (TCUFixture *fixture,
        g_assert_nonnull (content);
        g_assert_cmpint (content_len, >, 0);
 
-       success = e_cal_meta_backend_inline_local_attachments_sync (meta_backend, icalcomp, NULL, &error);
+       success = e_cal_meta_backend_inline_local_attachments_sync (meta_backend, icomp, NULL, &error);
        g_assert_no_error (error);
        g_assert (success);
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 1);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 1);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       g_object_unref (attach);
+       g_object_unref (prop);
+
+       prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER));
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_ENCODING_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_VALUE_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_ENCODING_PARAMETER));
 
-       param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
-       g_assert_cmpstr (icalparameter_get_filename (param), ==, basename);
+       param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
+       g_assert_cmpstr (i_cal_parameter_get_filename (param), ==, basename);
+       g_object_unref (param);
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (!icalattach_get_is_url (attach));
+       g_assert (!i_cal_attach_get_is_url (attach));
 
        check_attachment_content (attach, content, content_len);
 
-       success = e_cal_meta_backend_store_inline_attachments_sync (meta_backend, icalcomp, NULL, &error);
+       g_object_unref (attach);
+       g_object_unref (prop);
+
+       success = e_cal_meta_backend_store_inline_attachments_sync (meta_backend, icomp, NULL, &error);
        g_assert_no_error (error);
        g_assert (success);
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 1);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 1);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER));
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_ENCODING_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_VALUE_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_ENCODING_PARAMETER));
 
-       param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
-       g_assert_cmpstr (icalparameter_get_filename (param), ==, basename);
+       param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
+       g_assert_cmpstr (i_cal_parameter_get_filename (param), ==, basename);
+       g_object_unref (param);
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (icalattach_get_is_url (attach));
+       g_assert (i_cal_attach_get_is_url (attach));
 
        check_attachment_content (attach, content, content_len);
 
+       g_object_unref (attach);
+       g_object_unref (prop);
+
        /* Add a URL attachment which is not pointing to a local file */
-       attach = icalattach_new_from_url (REMOTE_URL);
-       prop = icalproperty_new_attach (attach);
-       icalattach_unref (attach);
-       icalcomponent_add_property (icalcomp, prop);
+       attach = i_cal_attach_new_from_url (REMOTE_URL);
+       prop = i_cal_property_new_attach (attach);
+       g_object_unref (attach);
+       i_cal_component_take_property (icomp, prop);
 
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 2);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 2);
 
-       success = e_cal_meta_backend_inline_local_attachments_sync (meta_backend, icalcomp, NULL, &error);
+       success = e_cal_meta_backend_inline_local_attachments_sync (meta_backend, icomp, NULL, &error);
        g_assert_no_error (error);
        g_assert (success);
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 2);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 2);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER));
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_ENCODING_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_VALUE_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_ENCODING_PARAMETER));
 
-       param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
-       g_assert_cmpstr (icalparameter_get_filename (param), ==, basename);
+       param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
+       g_assert_cmpstr (i_cal_parameter_get_filename (param), ==, basename);
+       g_object_unref (param);
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (!icalattach_get_is_url (attach));
+       g_assert (!i_cal_attach_get_is_url (attach));
 
        check_attachment_content (attach, content, content_len);
 
+       g_object_unref (attach);
+       g_object_unref (prop);
+
        /* Verify the remote URL did not change */
-       prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_next_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (icalattach_get_is_url (attach));
-       g_assert_cmpstr (icalattach_get_url (attach), ==, REMOTE_URL);
+       g_assert (i_cal_attach_get_is_url (attach));
+       g_assert_cmpstr (i_cal_attach_get_url (attach), ==, REMOTE_URL);
 
-       success = e_cal_meta_backend_store_inline_attachments_sync (meta_backend, icalcomp, NULL, &error);
+       g_object_unref (attach);
+       g_object_unref (prop);
+
+       success = e_cal_meta_backend_store_inline_attachments_sync (meta_backend, icomp, NULL, &error);
        g_assert_no_error (error);
        g_assert (success);
-       g_assert_cmpint (icalcomponent_count_properties (icalcomp, ICAL_ATTACH_PROPERTY), ==, 2);
+       g_assert_cmpint (i_cal_component_count_properties (icomp, I_CAL_ATTACH_PROPERTY), ==, 2);
 
-       prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_nonnull (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER));
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_ENCODING_PARAMETER));
+       g_assert (e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_VALUE_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_ENCODING_PARAMETER));
 
-       param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
-       g_assert_cmpstr (icalparameter_get_filename (param), ==, basename);
+       param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
+       g_assert_cmpstr (i_cal_parameter_get_filename (param), ==, basename);
+       g_object_unref (param);
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (icalattach_get_is_url (attach));
+       g_assert (i_cal_attach_get_is_url (attach));
 
        check_attachment_content (attach, content, content_len);
 
+       g_object_unref (attach);
+       g_object_unref (prop);
+
        /* Verify the remote URL did not change */
-       prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTACH_PROPERTY);
+       prop = i_cal_component_get_next_property (icomp, I_CAL_ATTACH_PROPERTY);
        g_assert_nonnull (prop);
-       g_assert_null (icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER));
+       g_assert (!e_cal_util_property_has_parameter (prop, I_CAL_FILENAME_PARAMETER));
 
-       attach = icalproperty_get_attach (prop);
+       attach = i_cal_property_get_attach (prop);
        g_assert_nonnull (attach);
-       g_assert (icalattach_get_is_url (attach));
-       g_assert_cmpstr (icalattach_get_url (attach), ==, REMOTE_URL);
+       g_assert (i_cal_attach_get_is_url (attach));
+       g_assert_cmpstr (i_cal_attach_get_url (attach), ==, REMOTE_URL);
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (attach);
+       g_object_unref (prop);
+       g_object_unref (icomp);
        g_object_unref (meta_backend);
        g_object_unref (comp);
        g_free (filename);
@@ -1426,7 +1496,7 @@ test_timezones (ECalMetaBackend *meta_backend)
        const gchar *in_tz2obj = TZSTRDEF (TZID2, TZLOC2);
        ECalBackendSyncClass *backend_class;
        ECalCache *cal_cache;
-       icalcomponent *vcalendar;
+       ICalComponent *vcalendar;
        ECalComponent *comp;
        gchar *tzobj = NULL;
        GList *zones;
@@ -1486,7 +1556,7 @@ test_timezones (ECalMetaBackend *meta_backend)
        cal_cache = e_cal_meta_backend_ref_cache (meta_backend);
        g_assert_nonnull (cal_cache);
 
-       vcalendar = icalcomponent_new_from_string (
+       vcalendar = i_cal_component_new_from_string (
                "BEGIN:VCALENDAR\r\n"
                "BEGIN:VTIMEZONE\r\n"
                "TZID:tzid1\r\n"
@@ -1593,7 +1663,7 @@ test_timezones (ECalMetaBackend *meta_backend)
        zones = e_timezone_cache_list_timezones (E_TIMEZONE_CACHE (meta_backend));
        g_assert_cmpint (g_list_length (zones), ==, 0);
 
-       icalcomponent_free (vcalendar);
+       g_object_unref (vcalendar);
 
        /* And now when the timezones are actually referenced, thus should be part of the persistent cache */
 
@@ -1772,6 +1842,7 @@ test_get_free_busy (ECalMetaBackend *meta_backend)
                "END:VFREEBUSY\r\n";
        ECalBackendSyncClass *backend_class;
        GSList *users, *objects = NULL;
+       ICalTimetype *itt;
        time_t start, end;
        GError *error = NULL;
 
@@ -1784,8 +1855,13 @@ test_get_free_busy (ECalMetaBackend *meta_backend)
        users = g_slist_prepend (NULL, (gpointer) "user@no.where");
        users = g_slist_prepend (users, (gpointer) "unknown@no.where");
 
-       start = icaltime_as_timet (icaltime_from_string ("20170102T080000Z"));
-       end = icaltime_as_timet (icaltime_from_string ("20170102T200000Z"));
+       itt = i_cal_time_from_string ("20170102T080000Z");
+       start = i_cal_time_as_timet (itt);
+       g_object_unref (itt);
+
+       itt = i_cal_time_from_string ("20170102T200000Z");
+       end = i_cal_time_as_timet (itt);
+       g_object_unref (itt);
 
        backend_class->get_free_busy_sync (E_CAL_BACKEND_SYNC (meta_backend),
                NULL, NULL, users, start, end, &objects, &error);
@@ -1964,24 +2040,29 @@ ecmb_test_modify_case (const gchar *case_name,
                       const gchar *ridstr)
 {
        gchar *calobj;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
 
        g_assert_nonnull (case_name);
 
        calobj = tcu_new_icalstring_from_test_case (case_name);
        g_assert_nonnull (calobj);
-       icalcomp = icalcomponent_new_from_string (calobj);
-       g_assert_nonnull (icalcomp);
+       icomp = i_cal_component_new_from_string (calobj);
+       g_assert_nonnull (icomp);
        g_free (calobj);
 
-       icalcomponent_set_summary (icalcomp, MODIFIED_SUMMARY_STR);
-       icalcomponent_set_sequence (icalcomp, icalcomponent_get_sequence (icalcomp) + 1);
+       i_cal_component_set_summary (icomp, MODIFIED_SUMMARY_STR);
+       i_cal_component_set_sequence (icomp, i_cal_component_get_sequence (icomp) + 1);
 
-       if (ridstr)
-               icalcomponent_set_recurrenceid (icalcomp, icaltime_from_string (ridstr));
+       if (ridstr) {
+               ICalTimetype *itt;
 
-       calobj = icalcomponent_as_ical_string_r (icalcomp);
-       icalcomponent_free (icalcomp);
+               itt = i_cal_time_from_string (ridstr);
+               i_cal_component_set_recurrenceid (icomp, itt);
+               g_object_unref (itt);
+       }
+
+       calobj = i_cal_component_as_ical_string_r (icomp);
+       g_object_unref (icomp);
 
        return calobj;
 }
@@ -1994,7 +2075,7 @@ test_modify_objects (ECalMetaBackend *meta_backend)
        ECalCache *cal_cache;
        GSList *objects, *old_components = NULL, *new_components = NULL, *offline_changes;
        gchar *calobj, *tmp;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        gint old_sequence;
        GError *error = NULL;
 
@@ -2036,15 +2117,15 @@ test_modify_objects (ECalMetaBackend *meta_backend)
        g_assert_cmpint (test_backend->load_count, ==, 1);
        g_assert_cmpint (test_backend->save_count, ==, 1);
 
-       icalcomp = e_cal_component_get_icalcomponent (old_components->data);
-       old_sequence = icalcomponent_get_sequence (icalcomp);
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), !=, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-1");
+       icomp = e_cal_component_get_icalcomponent (old_components->data);
+       old_sequence = i_cal_component_get_sequence (icomp);
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), !=, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-1");
 
-       icalcomp = e_cal_component_get_icalcomponent (new_components->data);
-       g_assert_cmpint (old_sequence + 1, ==, icalcomponent_get_sequence (icalcomp));
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-1");
+       icomp = e_cal_component_get_icalcomponent (new_components->data);
+       g_assert_cmpint (old_sequence + 1, ==, i_cal_component_get_sequence (icomp));
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-1");
 
        g_slist_free_full (old_components, g_object_unref);
        g_slist_free_full (new_components, g_object_unref);
@@ -2068,15 +2149,15 @@ test_modify_objects (ECalMetaBackend *meta_backend)
        g_assert_cmpint (test_backend->load_count, ==, 0);
        g_assert_cmpint (test_backend->save_count, ==, 0);
 
-       icalcomp = e_cal_component_get_icalcomponent (old_components->data);
-       old_sequence = icalcomponent_get_sequence (icalcomp);
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), !=, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-2");
+       icomp = e_cal_component_get_icalcomponent (old_components->data);
+       old_sequence = i_cal_component_get_sequence (icomp);
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), !=, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-2");
 
-       icalcomp = e_cal_component_get_icalcomponent (new_components->data);
-       g_assert_cmpint (old_sequence + 1, ==, icalcomponent_get_sequence (icalcomp));
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-2");
+       icomp = e_cal_component_get_icalcomponent (new_components->data);
+       g_assert_cmpint (old_sequence + 1, ==, i_cal_component_get_sequence (icomp));
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-2");
 
        g_slist_free_full (old_components, g_object_unref);
        g_slist_free_full (new_components, g_object_unref);
@@ -2107,15 +2188,15 @@ test_modify_objects (ECalMetaBackend *meta_backend)
        g_assert_cmpint (test_backend->load_count, ==, 2);
        g_assert_cmpint (test_backend->save_count, ==, 2);
 
-       icalcomp = e_cal_component_get_icalcomponent (old_components->data);
-       old_sequence = icalcomponent_get_sequence (icalcomp);
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), !=, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-4");
+       icomp = e_cal_component_get_icalcomponent (old_components->data);
+       old_sequence = i_cal_component_get_sequence (icomp);
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), !=, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-4");
 
-       icalcomp = e_cal_component_get_icalcomponent (new_components->data);
-       g_assert_cmpint (old_sequence + 1, ==, icalcomponent_get_sequence (icalcomp));
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, MODIFIED_SUMMARY_STR);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-4");
+       icomp = e_cal_component_get_icalcomponent (new_components->data);
+       g_assert_cmpint (old_sequence + 1, ==, i_cal_component_get_sequence (icomp));
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, MODIFIED_SUMMARY_STR);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-4");
 
        g_slist_free_full (old_components, g_object_unref);
        g_slist_free_full (new_components, g_object_unref);
@@ -2147,15 +2228,15 @@ test_modify_objects (ECalMetaBackend *meta_backend)
        g_assert_cmpint (test_backend->load_count, ==, 3);
        g_assert_cmpint (test_backend->save_count, ==, 3);
 
-       icalcomp = e_cal_component_get_icalcomponent (old_components->data);
-       old_sequence = icalcomponent_get_sequence (icalcomp);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-6");
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), !=, MODIFIED_SUMMARY_STR);
+       icomp = e_cal_component_get_icalcomponent (old_components->data);
+       old_sequence = i_cal_component_get_sequence (icomp);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-6");
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), !=, MODIFIED_SUMMARY_STR);
 
-       icalcomp = e_cal_component_get_icalcomponent (new_components->data);
-       g_assert_cmpstr (icalcomponent_get_uid (icalcomp), ==, "event-6");
-       g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, MODIFIED_SUMMARY_STR);
-       g_assert_cmpint (old_sequence + 1, ==, icalcomponent_get_sequence (icalcomp));
+       icomp = e_cal_component_get_icalcomponent (new_components->data);
+       g_assert_cmpstr (i_cal_component_get_uid (icomp), ==, "event-6");
+       g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, MODIFIED_SUMMARY_STR);
+       g_assert_cmpint (old_sequence + 1, ==, i_cal_component_get_sequence (icomp));
 
        g_slist_free_full (old_components, g_object_unref);
        g_slist_free_full (new_components, g_object_unref);
@@ -2355,7 +2436,7 @@ test_receive_objects (ECalMetaBackend *meta_backend)
        ECalBackendSyncClass *backend_class;
        ECalCache *cal_cache;
        gchar *calobj;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp, *firsticomp;
        GSList *ids, *old_components = NULL, *new_components = NULL;
        GError *error = NULL;
 
@@ -2375,14 +2456,18 @@ test_receive_objects (ECalMetaBackend *meta_backend)
        calobj = tcu_new_icalstring_from_test_case ("invite-1");
        g_assert_nonnull (calobj);
 
-       icalcomp = icalcomponent_new_from_string (calobj);
-       g_assert_nonnull (icalcomp);
-       g_assert_nonnull (icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT));
+       icomp = i_cal_component_new_from_string (calobj);
+       g_assert_nonnull (icomp);
+
+       firsticomp = i_cal_component_get_first_component (icomp, ICAL_VEVENT_COMPONENT);
+       g_assert_nonnull (firsticomp);
+
        g_free (calobj);
 
-       icalcomponent_add_component (test_backend->vcalendar, icalcomponent_new_clone 
(icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT)));
+       i_cal_component_take_component (test_backend->vcalendar, i_cal_component_new_clone (firsticomp));
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (firsticomp);
+       g_object_unref (icomp);
 
        /* To get the 'invite' component into local cache */
        e_cal_meta_backend_test_call_refresh (meta_backend);
@@ -3240,7 +3325,7 @@ test_get_object (ECalMetaBackend *meta_backend)
        ECalMetaBackendTest *test_backend;
        ECalBackendSyncClass *backend_class;
        ECalCache *cal_cache;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        gchar *calobj = NULL;
        GError *error = NULL;
 
@@ -3270,11 +3355,11 @@ test_get_object (ECalMetaBackend *meta_backend)
        g_assert (strstr (calobj, "UID:event-6"));
        g_assert (strstr (calobj, "RECURRENCE-ID;TZID=America/New_York:20170225T134900"));
 
-       icalcomp = icalcomponent_new_from_string (calobj);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VCALENDAR_COMPONENT);
-       g_assert_cmpint (icalcomponent_count_components (icalcomp, ICAL_VEVENT_COMPONENT), ==, 2);
-       icalcomponent_free (icalcomp);
+       icomp = i_cal_component_new_from_string (calobj);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VCALENDAR_COMPONENT);
+       g_assert_cmpint (i_cal_component_count_components (icomp, I_CAL_VEVENT_COMPONENT), ==, 2);
+       g_object_unref (icomp);
 
        g_free (calobj);
        calobj = NULL;
@@ -3288,10 +3373,10 @@ test_get_object (ECalMetaBackend *meta_backend)
        g_assert (strstr (calobj, "UID:event-6"));
        g_assert (strstr (calobj, "RECURRENCE-ID;TZID=America/New_York:20170225T134900"));
 
-       icalcomp = icalcomponent_new_from_string (calobj);
-       g_assert_nonnull (icalcomp);
-       g_assert_cmpint (icalcomponent_isa (icalcomp), ==, ICAL_VEVENT_COMPONENT);
-       icalcomponent_free (icalcomp);
+       icomp = i_cal_component_new_from_string (calobj);
+       g_assert_nonnull (icomp);
+       g_assert_cmpint (i_cal_component_isa (icomp), ==, I_CAL_VEVENT_COMPONENT);
+       g_object_unref (icomp);
 
        g_free (calobj);
        calobj = NULL;
@@ -3385,7 +3470,7 @@ test_refresh (ECalMetaBackend *meta_backend)
        ECalCache *cal_cache;
        ECache *cache;
        guint count;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        gchar *sync_tag;
        GError *error = NULL;
 
@@ -3466,11 +3551,11 @@ test_refresh (ECalMetaBackend *meta_backend)
                NULL);
 
        /* Modify the master object, thus the detached instance will be recognized */
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT)) {
-               if (g_strcmp0 ("event-6", icalcomponent_get_uid (icalcomp)) == 0) {
-                       icalcomponent_set_sequence (icalcomp, icalcomponent_get_sequence (icalcomp) + 1);
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
+               if (g_strcmp0 ("event-6", i_cal_component_get_uid (icomp)) == 0) {
+                       i_cal_component_set_sequence (icomp, i_cal_component_get_sequence (icomp) + 1);
                }
        }
 
@@ -3531,12 +3616,12 @@ test_refresh (ECalMetaBackend *meta_backend)
        ecmb_test_remove_component (test_backend, "event-6", NULL);
        ecmb_test_remove_component (test_backend, "event-6", "20170225T134900");
 
-       for (icalcomp = icalcomponent_get_first_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT);
-            icalcomp;
-            icalcomp = icalcomponent_get_next_component (test_backend->vcalendar, ICAL_VEVENT_COMPONENT)) {
-               if (g_strcmp0 ("event-5", icalcomponent_get_uid (icalcomp)) == 0 ||
-                   g_strcmp0 ("event-9", icalcomponent_get_uid (icalcomp)) == 0) {
-                       icalcomponent_set_sequence (icalcomp, icalcomponent_get_sequence (icalcomp) + 1);
+       for (icomp = i_cal_component_get_first_component (test_backend->vcalendar, I_CAL_VEVENT_COMPONENT);
+            icomp;
+            g_object_unref (icomp), icomp = i_cal_component_get_next_component (test_backend->vcalendar, 
I_CAL_VEVENT_COMPONENT)) {
+               if (g_strcmp0 ("event-5", i_cal_component_get_uid (icomp)) == 0 ||
+                   g_strcmp0 ("event-9", i_cal_component_get_uid (icomp)) == 0) {
+                       i_cal_component_set_sequence (icomp, i_cal_component_get_sequence (icomp) + 1);
                }
        }
 
diff --git a/tests/libedata-cal/test-intervaltree.c b/tests/libedata-cal/test-intervaltree.c
index e0c102557..f1f65a9f6 100644
--- a/tests/libedata-cal/test-intervaltree.c
+++ b/tests/libedata-cal/test-intervaltree.c
@@ -158,7 +158,7 @@ create_test_component (time_t start,
 
        txt = g_strdup_printf ("%" G_GINT64_FORMAT "- %" G_GINT64_FORMAT, (gint64) start, (gint64) end);
 
-       summary = e_cal_component_new (txt, NULL);
+       summary = e_cal_component_text_new (txt, NULL);
        e_cal_component_set_summary (comp, summary);
        e_cal_component_text_free (summary);
 
@@ -416,7 +416,7 @@ mem_test (void)
        e_intervaltree_insert (tree, start, end, comp);
        g_assert (((GObject *) comp)->ref_count == 2);
 
-       e_cal_component_get_uid (comp, &uid);
+       uid = e_cal_component_get_uid (comp);
        rid = e_cal_component_get_recurid_as_string (comp);
        e_intervaltree_remove (tree, uid, rid);
        g_free (rid);
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index 13da331d0..37ca5fbb6 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -816,14 +816,9 @@ e_test_server_utils_finish_run (void)
 {
 #if GLOBAL_DBUS_DAEMON
        if (!test_installed_services ()) {
-               /* Teardown the D-Bus Daemon
-                *
-                * Note that we intentionally leak the TestDBus daemon
-                * in this case, presumably this is due to some leaked
-                * GDBusConnection reference counting
-                */
-               g_test_dbus_stop (global_test_dbus);
-               /* g_object_unref (global_test_dbus); */
+               /* Teardown the D-Bus Daemon */
+               g_test_dbus_down (global_test_dbus);
+               g_object_unref (global_test_dbus);
                global_test_dbus = NULL;
        }
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]