[evolution-data-server/wip/mcrha/libical-glib] CalDAV backend changes



commit ecd04bf41148c2296484af46e629edeef92987aa
Author: Milan Crha <mcrha redhat com>
Date:   Tue Feb 12 18:59:56 2019 +0100

    CalDAV backend changes

 .../backends/caldav/e-cal-backend-caldav.c         | 222 ++++++++++-----------
 1 file changed, 110 insertions(+), 112 deletions(-)
---
diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c 
b/src/calendar/backends/caldav/e-cal-backend-caldav.c
index fe12171e8..3039a4413 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -325,37 +325,39 @@ ecb_caldav_disconnect_sync (ECalMetaBackend *meta_backend,
 }
 
 static const gchar *
-ecb_caldav_get_vcalendar_uid (icalcomponent *vcalendar)
+ecb_caldav_get_vcalendar_uid (ICalComponent *vcalendar)
 {
        const gchar *uid = NULL;
-       icalcomponent *subcomp;
+       ICalComponent *subcomp;
 
        g_return_val_if_fail (vcalendar != NULL, NULL);
-       g_return_val_if_fail (icalcomponent_isa (vcalendar) == ICAL_VCALENDAR_COMPONENT, NULL);
+       g_return_val_if_fail (i_cal_component_isa (vcalendar) == I_CAL_VCALENDAR_COMPONENT, NULL);
 
-       for (subcomp = icalcomponent_get_first_component (vcalendar, ICAL_ANY_COMPONENT);
+       for (subcomp = i_cal_component_get_first_component (vcalendar, I_CAL_ANY_COMPONENT);
             subcomp && !uid;
-            subcomp = icalcomponent_get_next_component (vcalendar, ICAL_ANY_COMPONENT)) {
-               icalcomponent_kind kind = icalcomponent_isa (subcomp);
+            g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (vcalendar, 
I_CAL_ANY_COMPONENT)) {
+               ICalComponentKind kind = i_cal_component_isa (subcomp);
 
-               if (kind == ICAL_VEVENT_COMPONENT ||
-                   kind == ICAL_VJOURNAL_COMPONENT ||
-                   kind == ICAL_VTODO_COMPONENT) {
-                       uid = icalcomponent_get_uid (subcomp);
+               if (kind == I_CAL_VEVENT_COMPONENT ||
+                   kind == I_CAL_VJOURNAL_COMPONENT ||
+                   kind == I_CAL_VTODO_COMPONENT) {
+                       uid = i_cal_component_get_uid (subcomp);
                        if (uid && !*uid)
                                uid = NULL;
                }
        }
 
+       g_clear_object (&subcomp);
+
        return uid;
 }
 
 static void
 ecb_caldav_update_nfo_with_vcalendar (ECalMetaBackendInfo *nfo,
-                                     icalcomponent *vcalendar,
+                                     ICalComponent *vcalendar,
                                      const gchar *etag)
 {
-       icalcomponent *subcomp;
+       ICalComponent *subcomp;
        const gchar *uid;
 
        g_return_if_fail (nfo != NULL);
@@ -366,20 +368,20 @@ ecb_caldav_update_nfo_with_vcalendar (ECalMetaBackendInfo *nfo,
        if (!etag || !*etag)
                etag = nfo->revision;
 
-       for (subcomp = icalcomponent_get_first_component (vcalendar, ICAL_ANY_COMPONENT);
+       for (subcomp = i_cal_component_get_first_component (vcalendar, I_CAL_ANY_COMPONENT);
             subcomp;
-            subcomp = icalcomponent_get_next_component (vcalendar, ICAL_ANY_COMPONENT)) {
-               icalcomponent_kind kind = icalcomponent_isa (subcomp);
+            g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (vcalendar, 
I_CAL_ANY_COMPONENT)) {
+               ICalComponentKind kind = i_cal_component_isa (subcomp);
 
-               if (kind == ICAL_VEVENT_COMPONENT ||
-                   kind == ICAL_VJOURNAL_COMPONENT ||
-                   kind == ICAL_VTODO_COMPONENT) {
-                       e_cal_util_set_x_property (subcomp, E_CALDAV_X_ETAG, etag);
+               if (kind == I_CAL_VEVENT_COMPONENT ||
+                   kind == I_CAL_VJOURNAL_COMPONENT ||
+                   kind == I_CAL_VTODO_COMPONENT) {
+                       e_cal_util_component_set_x_property (subcomp, E_CALDAV_X_ETAG, etag);
                }
        }
 
        g_warn_if_fail (nfo->object == NULL);
-       nfo->object = icalcomponent_as_ical_string_r (vcalendar);
+       nfo->object = i_cal_component_as_ical_string_r (vcalendar);
 
        if (!nfo->uid || !*(nfo->uid)) {
                g_free (nfo->uid);
@@ -418,9 +420,9 @@ ecb_caldav_multiget_response_cb (EWebDAVSession *webdav,
                etag = e_webdav_session_util_maybe_dequote (e_xml_xpath_eval_as_string (xpath_ctx, 
"%s/D:getetag", xpath_prop_prefix));
 
                if (calendar_data) {
-                       icalcomponent *vcalendar;
+                       ICalComponent *vcalendar;
 
-                       vcalendar = icalcomponent_new_from_string (calendar_data);
+                       vcalendar = i_cal_component_new_from_string (calendar_data);
                        if (vcalendar) {
                                const gchar *uid;
 
@@ -447,7 +449,7 @@ ecb_caldav_multiget_response_cb (EWebDAVSession *webdav,
                                        }
                                }
 
-                               icalcomponent_free (vcalendar);
+                               g_object_unref (vcalendar);
                        }
                }
 
@@ -511,12 +513,12 @@ ecb_caldav_multiget_from_sets_sync (ECalBackendCalDAV *cbdav,
                                nfo->extra, NULL, &etag, &calendar_data, NULL, cancellable, error);
 
                        if (success && calendar_data) {
-                               icalcomponent *vcalendar;
+                               ICalComponent *vcalendar;
 
-                               vcalendar = icalcomponent_new_from_string (calendar_data);
+                               vcalendar = i_cal_component_new_from_string (calendar_data);
                                if (vcalendar) {
                                        ecb_caldav_update_nfo_with_vcalendar (nfo, vcalendar, etag);
-                                       icalcomponent_free (vcalendar);
+                                       g_object_unref (vcalendar);
                                }
                        }
 
@@ -766,7 +768,7 @@ ecb_caldav_get_changes_sync (ECalMetaBackend *meta_backend,
        }
 
        if (!is_repeat) {
-               icaltimezone *utc = icaltimezone_get_utc_timezone ();
+               ICalTimezone *utc = i_cal_timezone_get_utc_timezone ();
                time_t now;
                gchar *tmp;
 
@@ -875,9 +877,9 @@ ecb_caldav_extract_existing_cb (EWebDAVSession *webdav,
                calendar_data = e_xml_xpath_eval_as_string (xpath_ctx, "%s/C:calendar-data", 
xpath_prop_prefix);
 
                if (calendar_data) {
-                       icalcomponent *vcalendar;
+                       ICalComponent *vcalendar;
 
-                       vcalendar = icalcomponent_new_from_string (calendar_data);
+                       vcalendar = i_cal_component_new_from_string (calendar_data);
                        if (vcalendar) {
                                const gchar *uid;
 
@@ -889,7 +891,7 @@ ecb_caldav_extract_existing_cb (EWebDAVSession *webdav,
                                                e_cal_meta_backend_info_new (uid, etag, NULL, href));
                                }
 
-                               icalcomponent_free (vcalendar);
+                               g_object_unref (vcalendar);
                        }
                }
 
@@ -909,7 +911,7 @@ ecb_caldav_list_existing_sync (ECalMetaBackend *meta_backend,
 {
        ECalBackendCalDAV *cbdav;
        EWebDAVSession *webdav;
-       icalcomponent_kind kind;
+       ICalComponentKind kind;
        EXmlDocument *xml;
        GError *local_error = NULL;
        gboolean success;
@@ -920,7 +922,6 @@ ecb_caldav_list_existing_sync (ECalMetaBackend *meta_backend,
        *out_existing_objects = NULL;
 
        cbdav = E_CAL_BACKEND_CALDAV (meta_backend);
-
        kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbdav));
 
        xml = e_xml_document_new (E_WEBDAV_NS_CALDAV, "calendar-query");
@@ -934,11 +935,11 @@ ecb_caldav_list_existing_sync (ECalMetaBackend *meta_backend,
        e_xml_document_start_element (xml, E_WEBDAV_NS_CALDAV, "comp");
        e_xml_document_add_attribute (xml, NULL, "name", "VCALENDAR");
        e_xml_document_start_element (xml, E_WEBDAV_NS_CALDAV, "comp");
-       if (kind == ICAL_VEVENT_COMPONENT)
+       if (kind == I_CAL_VEVENT_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VEVENT");
-       else if (kind == ICAL_VJOURNAL_COMPONENT)
+       else if (kind == I_CAL_VJOURNAL_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VJOURNAL");
-       else if (kind == ICAL_VTODO_COMPONENT)
+       else if (kind == I_CAL_VTODO_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VTODO");
        else
                g_warn_if_reached ();
@@ -954,11 +955,11 @@ ecb_caldav_list_existing_sync (ECalMetaBackend *meta_backend,
        e_xml_document_start_element (xml, E_WEBDAV_NS_CALDAV, "comp-filter");
        e_xml_document_add_attribute (xml, NULL, "name", "VCALENDAR");
        e_xml_document_start_element (xml, E_WEBDAV_NS_CALDAV, "comp-filter");
-       if (kind == ICAL_VEVENT_COMPONENT)
+       if (kind == I_CAL_VEVENT_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VEVENT");
-       else if (kind == ICAL_VJOURNAL_COMPONENT)
+       else if (kind == I_CAL_VJOURNAL_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VJOURNAL");
-       else if (kind == ICAL_VTODO_COMPONENT)
+       else if (kind == I_CAL_VTODO_COMPONENT)
                e_xml_document_add_attribute (xml, NULL, "name", "VTODO");
        e_xml_document_end_element (xml); /* comp-filter / VEVENT|VJOURNAL|VTODO */
        e_xml_document_end_element (xml); /* comp-filter / VCALENDAR */
@@ -1042,25 +1043,25 @@ ecb_caldav_uid_to_uri (ECalBackendCalDAV *cbdav,
 }
 
 static void
-ecb_caldav_store_component_etag (icalcomponent *icalcomp,
+ecb_caldav_store_component_etag (ICalComponent *icomp,
                                 const gchar *etag)
 {
-       icalcomponent *subcomp;
+       ICalComponent *subcomp;
 
-       g_return_if_fail (icalcomp != NULL);
+       g_return_if_fail (icomp != NULL);
        g_return_if_fail (etag != NULL);
 
-       e_cal_util_set_x_property (icalcomp, E_CALDAV_X_ETAG, etag);
+       e_cal_util_component_set_x_property (icomp, E_CALDAV_X_ETAG, etag);
 
-       for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+       for (subcomp = i_cal_component_get_first_component (icomp, I_CAL_ANY_COMPONENT);
             subcomp;
-            subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT)) {
-               icalcomponent_kind kind = icalcomponent_isa (subcomp);
+            g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp, 
I_CAL_ANY_COMPONENT)) {
+               ICalComponentKind kind = i_cal_component_isa (subcomp);
 
-               if (kind == ICAL_VEVENT_COMPONENT ||
-                   kind == ICAL_VJOURNAL_COMPONENT ||
-                   kind == ICAL_VTODO_COMPONENT) {
-                       e_cal_util_set_x_property (subcomp, E_CALDAV_X_ETAG, etag);
+               if (kind == I_CAL_VEVENT_COMPONENT ||
+                   kind == I_CAL_VJOURNAL_COMPONENT ||
+                   kind == I_CAL_VTODO_COMPONENT) {
+                       e_cal_util_component_set_x_property (subcomp, E_CALDAV_X_ETAG, etag);
                }
        }
 }
@@ -1069,7 +1070,7 @@ static gboolean
 ecb_caldav_load_component_sync (ECalMetaBackend *meta_backend,
                                const gchar *uid,
                                const gchar *extra,
-                               icalcomponent **out_component,
+                               ICalComponent **out_component,
                                gchar **out_extra,
                                GCancellable *cancellable,
                                GError **error)
@@ -1096,9 +1097,9 @@ ecb_caldav_load_component_sync (ECalMetaBackend *meta_backend,
 
                newline = strchr (extra, '\n');
                if (newline && newline[1] && newline != extra) {
-                       icalcomponent *vcalendar;
+                       ICalComponent *vcalendar;
 
-                       vcalendar = icalcomponent_new_from_string (newline + 1);
+                       vcalendar = i_cal_component_new_from_string (newline + 1);
                        if (vcalendar) {
                                *out_extra = g_strndup (extra, newline - extra);
                                *out_component = vcalendar;
@@ -1174,14 +1175,14 @@ ecb_caldav_load_component_sync (ECalMetaBackend *meta_backend,
                *out_component = NULL;
 
                if (href && etag && bytes && length != ((gsize) -1)) {
-                       icalcomponent *icalcomp;
+                       ICalComponent *icomp;
 
-                       icalcomp = icalcomponent_new_from_string (bytes);
+                       icomp = i_cal_component_new_from_string (bytes);
 
-                       if (icalcomp) {
-                               ecb_caldav_store_component_etag (icalcomp, etag);
+                       if (icomp) {
+                               ecb_caldav_store_component_etag (icomp, etag);
 
-                               *out_component = icalcomp;
+                               *out_component = icomp;
                        }
                }
 
@@ -1227,7 +1228,7 @@ ecb_caldav_save_component_sync (ECalMetaBackend *meta_backend,
 {
        ECalBackendCalDAV *cbdav;
        EWebDAVSession *webdav;
-       icalcomponent *vcalendar, *subcomp;
+       ICalComponent *vcalendar, *subcomp;
        gchar *href = NULL, *etag = NULL, *uid = NULL;
        gchar *ical_string = NULL;
        gboolean success;
@@ -1243,24 +1244,24 @@ ecb_caldav_save_component_sync (ECalMetaBackend *meta_backend,
        vcalendar = e_cal_meta_backend_merge_instances (meta_backend, instances, TRUE);
        g_return_val_if_fail (vcalendar != NULL, FALSE);
 
-       for (subcomp = icalcomponent_get_first_component (vcalendar, ICAL_ANY_COMPONENT);
+       for (subcomp = i_cal_component_get_first_component (vcalendar, I_CAL_ANY_COMPONENT);
             subcomp;
-            subcomp = icalcomponent_get_next_component (vcalendar, ICAL_ANY_COMPONENT)) {
-               icalcomponent_kind kind = icalcomponent_isa (subcomp);
+            g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (vcalendar, 
I_CAL_ANY_COMPONENT)) {
+               ICalComponentKind kind = i_cal_component_isa (subcomp);
 
-               if (kind == ICAL_VEVENT_COMPONENT ||
-                   kind == ICAL_VJOURNAL_COMPONENT ||
-                   kind == ICAL_VTODO_COMPONENT) {
+               if (kind == I_CAL_VEVENT_COMPONENT ||
+                   kind == I_CAL_VJOURNAL_COMPONENT ||
+                   kind == I_CAL_VTODO_COMPONENT) {
                        if (!etag)
-                               etag = e_cal_util_dup_x_property (subcomp, E_CALDAV_X_ETAG);
+                               etag = e_cal_util_component_dup_x_property (subcomp, E_CALDAV_X_ETAG);
                        if (!uid)
-                               uid = g_strdup (icalcomponent_get_uid (subcomp));
+                               uid = g_strdup (i_cal_component_get_uid (subcomp));
 
-                       e_cal_util_remove_x_property (subcomp, E_CALDAV_X_ETAG);
+                       e_cal_util_component_remove_x_property (subcomp, E_CALDAV_X_ETAG);
                }
        }
 
-       ical_string = icalcomponent_as_ical_string_r (vcalendar);
+       ical_string = i_cal_component_as_ical_string_r (vcalendar);
 
        webdav = ecb_caldav_ref_session (cbdav);
 
@@ -1297,7 +1298,7 @@ ecb_caldav_save_component_sync (ECalMetaBackend *meta_backend,
                                ecb_caldav_store_component_etag (vcalendar, new_etag);
 
                                g_free (ical_string);
-                               ical_string = icalcomponent_as_ical_string_r (vcalendar);
+                               ical_string = i_cal_component_as_ical_string_r (vcalendar);
 
                                /* Encodes the href and the component into one string, which
                                   will be decoded in the load function */
@@ -1325,7 +1326,7 @@ ecb_caldav_save_component_sync (ECalMetaBackend *meta_backend,
                g_propagate_error (error, EDC_ERROR (InvalidObject));
        }
 
-       icalcomponent_free (vcalendar);
+       g_object_unref (vcalendar);
        g_free (ical_string);
        g_free (href);
        g_free (etag);
@@ -1352,7 +1353,7 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
 {
        ECalBackendCalDAV *cbdav;
        EWebDAVSession *webdav;
-       icalcomponent *icalcomp;
+       ICalComponent *icomp;
        gchar *etag = NULL;
        gboolean success;
        GError *local_error = NULL;
@@ -1368,14 +1369,14 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
                return FALSE;
        }
 
-       icalcomp = icalcomponent_new_from_string (object);
-       if (!icalcomp) {
+       icomp = i_cal_component_new_from_string (object);
+       if (!icomp) {
                g_propagate_error (error, EDC_ERROR (InvalidObject));
                return FALSE;
        }
 
        if (conflict_resolution == E_CONFLICT_RESOLUTION_FAIL)
-               etag = e_cal_util_dup_x_property (icalcomp, E_CALDAV_X_ETAG);
+               etag = e_cal_util_component_dup_x_property (icomp, E_CALDAV_X_ETAG);
 
        webdav = ecb_caldav_ref_session (cbdav);
 
@@ -1406,7 +1407,7 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
                }
        }
 
-       icalcomponent_free (icalcomp);
+       g_object_unref (icomp);
        g_free (etag);
 
        /* Ignore not found errors, this was a delete and the resource is gone.
@@ -1576,42 +1577,40 @@ ecb_caldav_receive_schedule_outbox_url_sync (ECalBackendCalDAV *cbdav,
 }
 
 static void
-ecb_caldav_extract_objects (icalcomponent *icomp,
-                           icalcomponent_kind ekind,
+ecb_caldav_extract_objects (ICalComponent *icomp,
+                           ICalComponentKind ekind,
                            GSList **out_objects,
                            GError **error)
 {
-       icalcomponent *scomp;
-       icalcomponent_kind kind;
+       ICalComponent *scomp;
+       ICalComponentKind kind;
        GSList *link;
 
        g_return_if_fail (icomp != NULL);
        g_return_if_fail (out_objects != NULL);
 
-       kind = icalcomponent_isa (icomp);
+       kind = i_cal_component_isa (icomp);
 
        if (kind == ekind) {
-               *out_objects = g_slist_prepend (NULL, icalcomponent_new_clone (icomp));
+               *out_objects = g_slist_prepend (NULL, i_cal_component_new_clone (icomp));
                return;
        }
 
-       if (kind != ICAL_VCALENDAR_COMPONENT) {
+       if (kind != I_CAL_VCALENDAR_COMPONENT) {
                g_propagate_error (error, EDC_ERROR (InvalidObject));
                return;
        }
 
        *out_objects = NULL;
-       scomp = icalcomponent_get_first_component (icomp, ekind);
-
-       while (scomp) {
-               *out_objects = g_slist_prepend (*out_objects, scomp);
-
-               scomp = icalcomponent_get_next_component (icomp, ekind);
+       for (scomp = i_cal_component_get_first_component (icomp, ekind);
+            scomp;
+            g_object_unref (scomp), scomp = i_cal_component_get_next_component (icomp, ekind)) {
+               *out_objects = g_slist_prepend (*out_objects, g_object_ref (scomp));
        }
 
        for (link = *out_objects; link; link = g_slist_next (link)) {
                /* Remove components from toplevel here */
-               icalcomponent_remove_component (icomp, link->data);
+               i_cal_component_remove_component (icomp, link->data);
        }
 
        *out_objects = g_slist_reverse (*out_objects);
@@ -1686,7 +1685,6 @@ ecb_caldav_get_free_busy_from_schedule_outbox_sync (ECalBackendCalDAV *cbdav,
        ESourceAuthentication *auth_extension;
        ESource *source;
        EWebDAVSession *webdav;
-       ICalTimetype *dtvalue;
        ICalTimezone *utc;
        gchar *str;
        GSList *link;
@@ -1717,7 +1715,7 @@ ecb_caldav_get_free_busy_from_schedule_outbox_sync (ECalBackendCalDAV *cbdav,
        g_free (str);
 
        utc = i_cal_timezone_get_utc_timezone ();
-       dt = e_cal_component_datetime_new_take (i_cal_time_current_time_with_zone (utc), 
i_cal_timezone_get_tzid (utc));
+       dt = e_cal_component_datetime_new_take (i_cal_time_current_time_with_zone (utc), g_strdup 
(i_cal_timezone_get_tzid (utc)));
 
        e_cal_component_set_dtstamp (comp, e_cal_component_datetime_get_value (dt));
 
@@ -1821,12 +1819,12 @@ ecb_caldav_get_free_busy_from_schedule_outbox_sync (ECalBackendCalDAV *cbdav,
                                        if (tmp && *tmp) {
                                                GSList *objects = NULL;
 
-                                               icalcomp = icalparser_parse_string (tmp);
-                                               if (icalcomp)
-                                                       ecb_caldav_extract_objects (icalcomp, 
ICAL_VFREEBUSY_COMPONENT, &objects, &local_error);
-                                               if (icalcomp && !local_error) {
+                                               icomp = i_cal_parser_parse_string (tmp);
+                                               if (icomp)
+                                                       ecb_caldav_extract_objects (icomp, 
I_CAL_VFREEBUSY_COMPONENT, &objects, &local_error);
+                                               if (icomp && !local_error) {
                                                        for (link = objects; link; link = g_slist_next 
(link)) {
-                                                               gchar *obj_str = 
icalcomponent_as_ical_string_r (link->data);
+                                                               gchar *obj_str = 
i_cal_component_as_ical_string_r (link->data);
 
                                                                if (obj_str && *obj_str)
                                                                        *out_freebusy = g_slist_prepend 
(*out_freebusy, obj_str);
@@ -1835,10 +1833,9 @@ ecb_caldav_get_free_busy_from_schedule_outbox_sync (ECalBackendCalDAV *cbdav,
                                                        }
                                                }
 
-                                               g_slist_free_full (objects, (GDestroyNotify) 
icalcomponent_free);
+                                               g_slist_free_full (objects, g_object_unref);
 
-                                               if (icalcomp)
-                                                       icalcomponent_free (icalcomp);
+                                               g_clear_object (&icomp);
                                                g_clear_error (&local_error);
                                        }
 
@@ -1927,30 +1924,30 @@ ecb_caldav_get_free_busy_from_principal_sync (ECalBackendCalDAV *cbdav,
 
        if (success && content_type && content && content->data && content->len &&
            g_ascii_strcasecmp (content_type, "text/calendar") == 0) {
-               icalcomponent *vcalendar;
+               ICalComponent *vcalendar;
 
-               vcalendar = icalcomponent_new_from_string ((const gchar *) content->data);
+               vcalendar = i_cal_component_new_from_string ((const gchar *) content->data);
                if (vcalendar) {
                        GSList *comps = NULL, *link;
 
-                       ecb_caldav_extract_objects (vcalendar, ICAL_VFREEBUSY_COMPONENT, &comps, NULL);
+                       ecb_caldav_extract_objects (vcalendar, I_CAL_VFREEBUSY_COMPONENT, &comps, NULL);
 
                        for (link = comps; link; link = g_slist_next (link)) {
-                               icalcomponent *subcomp = link->data;
+                               ICalComponent *subcomp = link->data;
                                gchar *obj_str;
 
-                               if (!icalcomponent_get_first_property (subcomp, ICAL_ATTENDEE_PROPERTY)) {
-                                       icalproperty *prop;
+                               if (!e_cal_util_component_has_property (subcomp, I_CAL_ATTENDEE_PROPERTY)) {
+                                       ICalProperty *prop;
                                        gchar *mailto;
 
                                        mailto = g_strconcat ("mailto:";, usermail, NULL);
-                                       prop = icalproperty_new_attendee (mailto);
+                                       prop = i_cal_property_new_attendee (mailto);
                                        g_free (mailto);
 
-                                       icalcomponent_add_property (subcomp, prop);
+                                       i_cal_component_take_property (subcomp, prop);
                                }
 
-                               obj_str = icalcomponent_as_ical_string_r (subcomp);
+                               obj_str = i_cal_component_as_ical_string_r (subcomp);
 
                                if (obj_str && *obj_str)
                                        *out_freebusy = g_slist_prepend (*out_freebusy, obj_str);
@@ -1960,7 +1957,8 @@ ecb_caldav_get_free_busy_from_principal_sync (ECalBackendCalDAV *cbdav,
 
                        success = comps != NULL;
 
-                       g_slist_free_full (comps, (GDestroyNotify) icalcomponent_free);
+                       g_slist_free_full (comps, g_object_unref);
+                       g_object_unref (vcalendar);
                } else {
                        success = FALSE;
                }
@@ -2111,11 +2109,11 @@ ecb_caldav_notify_property_changed_cb (GObject *object,
 
 static gchar *
 ecb_caldav_dup_component_revision_cb (ECalCache *cal_cache,
-                                     icalcomponent *icalcomp)
+                                     ICalComponent *icomp)
 {
-       g_return_val_if_fail (icalcomp != NULL, NULL);
+       g_return_val_if_fail (icomp != NULL, NULL);
 
-       return e_cal_util_dup_x_property (icalcomp, E_CALDAV_X_ETAG);
+       return e_cal_util_component_dup_x_property (icomp, E_CALDAV_X_ETAG);
 }
 
 static void


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