[evolution-data-server/wip/mcrha/libical-glib] Changes in libedata-cal
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/mcrha/libical-glib] Changes in libedata-cal
- Date: Tue, 12 Feb 2019 17:08:54 +0000 (UTC)
commit fec4e0cb572fe8e9d8be824e2e073f1d2fa15839
Author: Milan Crha <mcrha redhat com>
Date: Tue Feb 12 18:06:27 2019 +0100
Changes in libedata-cal
src/calendar/libecal/e-cal-util.c | 29 +
src/calendar/libecal/e-cal-util.h | 3 +
src/calendar/libedata-cal/e-cal-backend-factory.h | 2 +-
.../libedata-cal/e-cal-backend-intervaltree.c | 2 +-
src/calendar/libedata-cal/e-cal-backend-sexp.c | 91 +--
src/calendar/libedata-cal/e-cal-backend-sync.c | 53 +-
src/calendar/libedata-cal/e-cal-backend-util.c | 18 +-
src/calendar/libedata-cal/e-cal-backend-util.h | 2 +-
src/calendar/libedata-cal/e-cal-backend.c | 127 ++---
src/calendar/libedata-cal/e-cal-backend.h | 22 +-
src/calendar/libedata-cal/e-cal-cache.c | 244 ++++----
src/calendar/libedata-cal/e-cal-meta-backend.c | 630 +++++++++++----------
src/calendar/libedata-cal/e-cal-meta-backend.h | 12 +-
src/calendar/libedata-cal/e-data-cal-factory.c | 2 +-
src/calendar/libedata-cal/e-data-cal-view.c | 54 +-
src/calendar/libedata-cal/e-data-cal.c | 3 +-
.../libedata-cal/e-subprocess-cal-factory.c | 2 +-
.../evolution-alarm-notify/e-alarm-notify.c | 44 +-
18 files changed, 727 insertions(+), 613 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-util.c b/src/calendar/libecal/e-cal-util.c
index b6f3897ac..4b8914f8c 100644
--- a/src/calendar/libecal/e-cal-util.c
+++ b/src/calendar/libecal/e-cal-util.c
@@ -971,6 +971,35 @@ e_cal_util_add_timezones_from_component (ICalComponent *vcal_comp,
i_cal_component_foreach_tzid (icalcomp, add_timezone_cb, &f_data);
}
+/**
+ * e_cal_util_property_has_parameter:
+ * @prop: an #ICalProperty
+ * @param_kind: a parameter kind to look for, as an %ICalParameterKind
+ *
+ * Returns, whether the @prop has a parameter of @param_kind.
+ *
+ * Returns: whether the @prop has a parameter of @prop_kind
+ *
+ * Since: 3.36
+ **/
+gboolean
+e_cal_util_property_has_parameter (ICalProperty *prop,
+ ICalParameterKind param_kind)
+{
+ ICalParameter *param;
+
+ g_return_val_if_fail (I_CAL_IS_PROPERTY (prop), FALSE);
+
+ param = i_cal_property_get_first_parameter (prop, param_kind);
+
+ if (!param)
+ return FALSE;
+
+ g_object_unref (param);
+
+ return TRUE;
+}
+
/**
* e_cal_util_component_has_property:
* @icalcomp: an #ICalComponent
diff --git a/src/calendar/libecal/e-cal-util.h b/src/calendar/libecal/e-cal-util.h
index 6ca93cf3f..ef5b4d151 100644
--- a/src/calendar/libecal/e-cal-util.h
+++ b/src/calendar/libecal/e-cal-util.h
@@ -225,6 +225,9 @@ void e_cal_util_add_timezones_from_component
(ICalComponent *vcal_comp,
ICalComponent *icalcomp);
+gboolean e_cal_util_property_has_parameter
+ (ICalProperty *prop,
+ ICalParameterKind param_kind);
gboolean e_cal_util_component_has_property
(ICalComponent *icalcomp,
ICalPropertyKind prop_kind);
diff --git a/src/calendar/libedata-cal/e-cal-backend-factory.h
b/src/calendar/libedata-cal/e-cal-backend-factory.h
index b41752e64..7a2b06ed4 100644
--- a/src/calendar/libedata-cal/e-cal-backend-factory.h
+++ b/src/calendar/libedata-cal/e-cal-backend-factory.h
@@ -85,7 +85,7 @@ struct _ECalBackendFactoryClass {
/* Subclasses just need to set these
* class members, we handle the rest. */
const gchar *factory_name;
- icalcomponent_kind component_kind;
+ ICalComponentKind component_kind;
GType backend_type;
};
diff --git a/src/calendar/libedata-cal/e-cal-backend-intervaltree.c
b/src/calendar/libedata-cal/e-cal-backend-intervaltree.c
index 0615d44f2..2a8355669 100644
--- a/src/calendar/libedata-cal/e-cal-backend-intervaltree.c
+++ b/src/calendar/libedata-cal/e-cal-backend-intervaltree.c
@@ -380,7 +380,7 @@ intervaltree_fixup_deletion (EIntervalTree *tree,
x->red = 0;
}
-/** Caller should hold the lock. **/
+/* * Caller should hold the lock. * */
static EIntervalNode *
intervaltree_search_component (EIntervalTree *tree,
const gchar *searched_uid,
diff --git a/src/calendar/libedata-cal/e-cal-backend-sexp.c b/src/calendar/libedata-cal/e-cal-backend-sexp.c
index ca08cbbd1..1e87dae32 100644
--- a/src/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/src/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -112,12 +112,14 @@ func_uid (ESExp *esexp,
}
static gboolean
-check_instance_time_range_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+check_instance_time_range_cb (ICalComponent *comp,
+ ICalTimetype *instance_start,
+ ICalTimetype *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- SearchContext *ctx = data;
+ SearchContext *ctx = user_data;
/* if we get called, the event has an occurrence in the given time range */
ctx->occurs = TRUE;
@@ -127,7 +129,9 @@ check_instance_time_range_cb (ECalComponent *comp,
static ICalTimezone *
resolve_tzid (const gchar *tzid,
- gpointer user_data)
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
SearchContext *ctx = user_data;
@@ -156,7 +160,8 @@ func_occur_in_time_range (ESExp *esexp,
SearchContext *ctx = data;
time_t start, end;
ESExpResult *result;
- icaltimezone *default_zone = NULL;
+ ICalTimezone *default_zone = NULL, *utc_zone;
+ ICalTimetype *starttt, *endtt;
/* Check argument types */
@@ -194,19 +199,28 @@ func_occur_in_time_range (ESExp *esexp,
return NULL;
}
- default_zone = resolve_tzid (argv[2]->value.string, ctx);
+ default_zone = resolve_tzid (argv[2]->value.string, ctx, NULL, NULL);
}
+ utc_zone = i_cal_timezone_get_utc_timezone ();
+
if (!default_zone)
- default_zone = icaltimezone_get_utc_timezone ();
+ default_zone = utc_zone;
/* See if the object occurs in the specified time range */
ctx->occurs = FALSE;
- e_cal_recur_generate_instances (
- ctx->comp, start, end,
- (ECalRecurInstanceFn) check_instance_time_range_cb,
+
+ starttt = i_cal_time_from_timet_with_zone (start, FALSE, utc_zone);
+ endtt = i_cal_time_from_timet_with_zone (end, FALSE, utc_zone);
+
+ e_cal_recur_generate_instances_sync (
+ e_cal_component_get_icalcomponent (ctx->comp), starttt, endtt,
+ check_instance_time_range_cb,
ctx, resolve_tzid, ctx,
- default_zone);
+ default_zone, NULL, NULL);
+
+ g_clear_object (&starttt);
+ g_clear_object (&endtt);
result = e_sexp_result_new (esexp, ESEXP_RES_BOOL);
result->value.boolean = ctx->occurs;
@@ -215,12 +229,14 @@ func_occur_in_time_range (ESExp *esexp,
}
static gboolean
-count_instances_time_range_cb (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+count_instances_time_range_cb (ICalComponent *comp,
+ ICalTimetype *instance_start,
+ ICalTimetype *instance_end,
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
- SearchContext *ctx = data;
+ SearchContext *ctx = user_data;
ctx->occurrences_count++;
@@ -244,7 +260,8 @@ func_occurrences_count (ESExp *esexp,
SearchContext *ctx = data;
time_t start, end;
ESExpResult *result;
- icaltimezone *default_zone;
+ ICalTimezone *default_zone;
+ ICalTimetype *starttt, *endtt;
/* Check argument types */
@@ -281,13 +298,19 @@ func_occurrences_count (ESExp *esexp,
return result;
}
- default_zone = icaltimezone_get_utc_timezone ();
+ default_zone = i_cal_timezone_get_utc_timezone ();
+
+ starttt = i_cal_time_from_timet_with_zone (start, FALSE, default_zone);
+ endtt = i_cal_time_from_timet_with_zone (end, FALSE, default_zone);
ctx->occurrences_count = 0;
- e_cal_recur_generate_instances (
- ctx->comp, start, end,
+ e_cal_recur_generate_instances_sync (
+ e_cal_component_get_icalcomponent (ctx->comp), starttt, endtt,
count_instances_time_range_cb, ctx,
- resolve_tzid, ctx, default_zone);
+ resolve_tzid, ctx, default_zone, NULL, NULL);
+
+ g_clear_object (&starttt);
+ g_clear_object (&endtt);
result = e_sexp_result_new (esexp, ESEXP_RES_INT);
result->value.number = ctx->occurrences_count;
@@ -340,7 +363,7 @@ func_due_in_time_range (ESExp *esexp,
dt = e_cal_component_get_due (ctx->comp);
if (dt && e_cal_component_datetime_get_value (dt)) {
- zone = resolve_tzid (e_cal_component_datetime_get_tzid (dt), ctx);
+ zone = resolve_tzid (e_cal_component_datetime_get_tzid (dt), ctx, NULL, NULL);
if (zone)
due_t = i_cal_time_as_timet_with_zone (e_cal_component_datetime_get_value (dt), zone);
else
@@ -372,7 +395,7 @@ matches_text_list (GSList *text_list,
ECalComponentText *text = l->data;
if (text && e_cal_component_text_get_value (text) &&
- e_util_utf8_strstrcasedecomp (e_cal_component_tet_get_value (text), str) != NULL) {
+ e_util_utf8_strstrcasedecomp (e_cal_component_text_get_value (text), str) != NULL) {
matches = TRUE;
break;
}
@@ -545,7 +568,7 @@ static gboolean
matches_priority (ECalComponent *comp ,const gchar *pr)
{
gboolean res = FALSE;
- gint *priority = NULL;
+ gint priority;
priority = e_cal_component_get_priority (comp);
@@ -645,7 +668,7 @@ func_percent_complete (ESExp *esexp,
return NULL;
}
- percent = e_cal_component_get_percent (ctx->comp);
+ percent = e_cal_component_get_percent_complete (ctx->comp);
result = e_sexp_result_new (esexp, ESEXP_RES_INT);
result->value.number = percent;
@@ -819,7 +842,7 @@ func_has_alarms_in_range (ESExp *esexp,
{
time_t start, end;
ESExpResult *result;
- icaltimezone *default_zone;
+ ICalTimezone *default_zone;
ECalComponentAlarms *alarms;
ECalComponentAlarmAction omit[] = {-1};
SearchContext *ctx = data;
@@ -852,7 +875,7 @@ func_has_alarms_in_range (ESExp *esexp,
end = argv[1]->value.time;
/* See if the object has alarms in the given time range */
- default_zone = icaltimezone_get_utc_timezone ();
+ default_zone = i_cal_timezone_get_utc_timezone ();
alarms = e_cal_util_generate_alarms_for_comp (
ctx->comp, start, end,
@@ -1042,7 +1065,7 @@ func_is_completed (ESExp *esexp,
itt = e_cal_component_get_completed (ctx->comp);
if (itt) {
complete = TRUE;
- g_obejct_unref (itt);
+ g_object_unref (itt);
} else {
ICalPropertyStatus status;
@@ -1313,20 +1336,16 @@ e_cal_backend_sexp_match_object (ECalBackendSExp *sexp,
ETimezoneCache *cache)
{
ECalComponent *comp;
- icalcomponent *icalcomp;
gboolean retval;
g_return_val_if_fail (E_IS_CAL_BACKEND_SEXP (sexp), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (E_IS_TIMEZONE_CACHE (cache), FALSE);
- icalcomp = icalcomponent_new_from_string ((gchar *) object);
- if (!icalcomp)
+ comp = e_cal_component_new_from_string (object);
+ if (!comp)
return FALSE;
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomp);
-
retval = e_cal_backend_sexp_match_comp (sexp, comp, cache);
g_object_unref (comp);
diff --git a/src/calendar/libedata-cal/e-cal-backend-sync.c b/src/calendar/libedata-cal/e-cal-backend-sync.c
index 0ca680ea7..46ee65fe7 100644
--- a/src/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/src/calendar/libedata-cal/e-cal-backend-sync.c
@@ -32,7 +32,6 @@
#include <libedataserver/libedataserver.h>
#include "e-cal-backend-sync.h"
-#include <libical/icaltz-util.h>
#define E_CAL_BACKEND_SYNC_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -577,24 +576,25 @@ e_cal_backend_sync_get_timezone (ECalBackendSync *backend,
}
if (tzobject && !*tzobject) {
- icaltimezone *zone = NULL;
+ ICalTimezone *zone;
- zone = e_timezone_cache_get_timezone (
- E_TIMEZONE_CACHE (backend), tzid);
+ zone = e_timezone_cache_get_timezone (E_TIMEZONE_CACHE (backend), tzid);
if (!zone) {
if (error && !*error)
g_propagate_error (error, e_data_cal_create_error (ObjectNotFound, NULL));
} else {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
- icalcomp = icaltimezone_get_component (zone);
+ icomp = i_cal_timezone_get_component (zone);
- if (!icalcomp) {
+ if (!icomp) {
if (error && !*error)
g_propagate_error (error, e_data_cal_create_error (InvalidObject,
NULL));
} else {
- *tzobject = icalcomponent_as_ical_string_r (icalcomp);
+ *tzobject = i_cal_component_as_ical_string_r (icomp);
+
+ g_object_unref (icomp);
}
}
}
@@ -889,38 +889,33 @@ cal_backend_get_timezone (ECalBackend *backend,
}
if (slashes == 1) {
- icalcomponent *icalcomp = NULL, *free_comp = NULL;
-
- icaltimezone *zone = icaltimezone_get_builtin_timezone (tzid);
- if (!zone) {
- /* Try fetching the timezone from zone
- * directory. There are some timezones like
- * MST, US/Pacific etc. which do not appear
- * in zone.tab, so they will not be available
- * in the libical builtin timezone */
- icalcomp = free_comp = icaltzutil_fetch_timezone (tzid);
- }
+ ICalComponent *icomp = NULL;
+ ICalTimezone *zone;
+
+ zone = i_cal_timezone_get_builtin_timezone (tzid);
if (zone)
- icalcomp = icaltimezone_get_component (zone);
+ icomp = i_cal_timezone_get_component (zone);
- if (icalcomp) {
- icalcomponent *clone = icalcomponent_new_clone (icalcomp);
- icalproperty *prop;
+ if (icomp) {
+ ICalComponent *clone = i_cal_component_new_clone (icomp);
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (clone, ICAL_TZID_PROPERTY);
+ prop = i_cal_component_get_first_property (clone, I_CAL_TZID_PROPERTY);
if (prop) {
/* change tzid to our, because the component has the buildin tzid */
- icalproperty_set_tzid (prop, tzid);
+ i_cal_property_set_tzid (prop, tzid);
+
+ object = i_cal_component_as_ical_string_r (clone);
- object = icalcomponent_as_ical_string_r (clone);
g_clear_error (&error);
+ g_object_unref (prop);
}
- icalcomponent_free (clone);
+
+ g_clear_object (&clone);
}
- if (free_comp)
- icalcomponent_free (free_comp);
+ g_clear_object (&icomp);
}
/* also cache this timezone to backend */
diff --git a/src/calendar/libedata-cal/e-cal-backend-util.c b/src/calendar/libedata-cal/e-cal-backend-util.c
index 7bea2387e..078835461 100644
--- a/src/calendar/libedata-cal/e-cal-backend-util.c
+++ b/src/calendar/libedata-cal/e-cal-backend-util.c
@@ -189,28 +189,28 @@ is_attendee_declined (GSList *declined_attendees,
**/
gboolean
e_cal_backend_user_declined (ESourceRegistry *registry,
- icalcomponent *icalcomp)
+ ICalComponent *icalcomp)
{
GList *list, *iter;
GSList *declined_attendees = NULL;
gboolean declined = FALSE;
- icalproperty *prop;
- icalparameter *param;
+ ICalProperty *prop;
+ ICalParameter *param;
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), FALSE);
g_return_val_if_fail (icalcomp != NULL, FALSE);
/* First test whether there is any declined attendee at all and remember his/her address */
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icalcomp, I_CAL_ATTENDEE_PROPERTY);
prop != NULL;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
- param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER);
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icalcomp,
I_CAL_ATTENDEE_PROPERTY)) {
+ param = i_cal_property_get_first_parameter (prop, I_CAL_PARTSTAT_PARAMETER);
- if (param && icalparameter_get_partstat (param) == ICAL_PARTSTAT_DECLINED) {
+ if (param && i_cal_parameter_get_partstat (param) == I_CAL_PARTSTAT_DECLINED) {
gchar *attendee;
gchar *address;
- attendee = icalproperty_get_value_as_string_r (prop);
+ attendee = i_cal_property_get_value_as_string_r (prop);
if (attendee) {
if (!g_ascii_strncasecmp (attendee, "mailto:", 7))
address = g_strdup (attendee + 7);
@@ -227,6 +227,8 @@ e_cal_backend_user_declined (ESourceRegistry *registry,
g_free (attendee);
}
}
+
+ g_clear_object (¶m);
}
if (!declined_attendees)
diff --git a/src/calendar/libedata-cal/e-cal-backend-util.h b/src/calendar/libedata-cal/e-cal-backend-util.h
index 730b70426..ae9f2ad2c 100644
--- a/src/calendar/libedata-cal/e-cal-backend-util.h
+++ b/src/calendar/libedata-cal/e-cal-backend-util.h
@@ -44,7 +44,7 @@ gboolean e_cal_backend_mail_account_is_valid
const gchar *user,
gchar **name);
gboolean e_cal_backend_user_declined (ESourceRegistry *registry,
- icalcomponent *icalcomp);
+ ICalComponent *icalcomp);
G_END_DECLS
diff --git a/src/calendar/libedata-cal/e-cal-backend.c b/src/calendar/libedata-cal/e-cal-backend.c
index 1f41cd7d2..525976d41 100644
--- a/src/calendar/libedata-cal/e-cal-backend.c
+++ b/src/calendar/libedata-cal/e-cal-backend.c
@@ -45,7 +45,7 @@ struct _ECalBackendPrivate {
gboolean opened;
/* The kind of components for this backend */
- icalcomponent_kind kind;
+ ICalComponentKind kind;
GMutex views_mutex;
GList *views;
@@ -111,7 +111,7 @@ struct _DispatchNode {
struct _SignalClosure {
GWeakRef backend;
- icaltimezone *cached_zone;
+ ICalTimezone *cached_zone;
};
enum {
@@ -195,18 +195,12 @@ signal_closure_free (SignalClosure *signal_closure)
{
g_weak_ref_clear (&signal_closure->backend);
- /* The icaltimezone is cached in ECalBackend's internal
+ /* The ICalTimezone is cached in ECalBackend's internal
* "zone_cache" hash table and must not be freed here. */
g_slice_free (SignalClosure, signal_closure);
}
-static void
-cal_backend_free_zone (icaltimezone *zone)
-{
- icaltimezone_free (zone, 1);
-}
-
static void
cal_backend_push_operation (ECalBackend *backend,
GSimpleAsyncResult *simple,
@@ -389,7 +383,7 @@ static void
cal_backend_set_default_cache_dir (ECalBackend *backend)
{
ESource *source;
- icalcomponent_kind kind;
+ ICalComponentKind kind;
const gchar *component_type;
const gchar *user_cache_dir;
const gchar *uid;
@@ -404,13 +398,13 @@ cal_backend_set_default_cache_dir (ECalBackend *backend)
g_return_if_fail (uid != NULL);
switch (kind) {
- case ICAL_VEVENT_COMPONENT:
+ case I_CAL_VEVENT_COMPONENT:
component_type = "calendar";
break;
- case ICAL_VTODO_COMPONENT:
+ case I_CAL_VTODO_COMPONENT:
component_type = "tasks";
break;
- case ICAL_VJOURNAL_COMPONENT:
+ case I_CAL_VJOURNAL_COMPONENT:
component_type = "memos";
break;
default:
@@ -546,7 +540,7 @@ cal_backend_emit_timezone_added_idle_cb (gpointer user_data)
static void
cal_backend_set_kind (ECalBackend *backend,
- icalcomponent_kind kind)
+ ICalComponentKind kind)
{
backend->priv->kind = kind;
}
@@ -796,7 +790,7 @@ _e_cal_backend_remove_cached_timezones (ECalBackend *cal_backend)
static void
cal_backend_add_cached_timezone (ETimezoneCache *cache,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
ECalBackendPrivate *priv;
const gchar *tzid;
@@ -805,34 +799,30 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
/* XXX Apparently this function can sometimes return NULL.
* I'm not sure when or why that happens, but we can't
- * cache the icaltimezone if it has no tzid string. */
- tzid = icaltimezone_get_tzid (zone);
+ * cache the ICalTimezone if it has no tzid string. */
+ tzid = i_cal_timezone_get_tzid (zone);
if (tzid == NULL)
return;
g_mutex_lock (&priv->zone_cache_lock);
/* Avoid replacing an existing cache entry. We don't want to
- * invalidate any icaltimezone pointers that may have already
+ * invalidate any ICalTimezone pointers that may have already
* been returned through e_timezone_cache_get_timezone(). */
if (!g_hash_table_contains (priv->zone_cache, tzid)) {
GSource *idle_source;
GMainContext *main_context;
SignalClosure *signal_closure;
- icalcomponent *icalcomp;
- icaltimezone *cached_zone;
+ ICalTimezone *cached_zone;
- cached_zone = icaltimezone_new ();
- icalcomp = icaltimezone_get_component (zone);
- icalcomp = icalcomponent_new_clone (icalcomp);
- icaltimezone_set_component (cached_zone, icalcomp);
+ cached_zone = e_cal_util_copy_timezone (zone);
g_hash_table_insert (
priv->zone_cache,
g_strdup (tzid), cached_zone);
/* The closure's backend reference will keep the
- * internally cached icaltimezone alive for the
+ * internally cached ICalTimezone alive for the
* duration of the idle callback. */
signal_closure = g_slice_new0 (SignalClosure);
g_weak_ref_init (&signal_closure->backend, cache);
@@ -855,21 +845,21 @@ cal_backend_add_cached_timezone (ETimezoneCache *cache,
g_mutex_unlock (&priv->zone_cache_lock);
}
-static icaltimezone *
+static ICalTimezone *
cal_backend_get_cached_timezone (ETimezoneCache *cache,
const gchar *tzid)
{
ECalBackendPrivate *priv;
- icaltimezone *zone = NULL;
- icaltimezone *builtin_zone = NULL;
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ICalTimezone *zone = NULL;
+ ICalTimezone *builtin_zone = NULL;
+ ICalComponent *icomp, *clone;
+ ICalProperty *prop;
const gchar *builtin_tzid;
priv = E_CAL_BACKEND_GET_PRIVATE (cache);
if (g_str_equal (tzid, "UTC"))
- return icaltimezone_get_utc_timezone ();
+ return i_cal_timezone_get_utc_timezone ();
g_mutex_lock (&priv->zone_cache_lock);
@@ -882,53 +872,46 @@ cal_backend_get_cached_timezone (ETimezoneCache *cache,
/* Try to replace the original time zone with a more complete
* and/or potentially updated built-in time zone. Note this also
* applies to TZIDs which match built-in time zones exactly: they
- * are extracted via icaltimezone_get_builtin_timezone_from_tzid(). */
+ * are extracted via i_cal_timezone_get_builtin_timezone_from_tzid(). */
builtin_tzid = e_cal_match_tzid (tzid);
if (builtin_tzid != NULL)
- builtin_zone = icaltimezone_get_builtin_timezone_from_tzid (
- builtin_tzid);
+ builtin_zone = i_cal_timezone_get_builtin_timezone_from_tzid (builtin_tzid);
if (builtin_zone == NULL)
goto exit;
/* Use the built-in time zone *and* rename it. Likely the caller
* is asking for a specific TZID because it has an event with such
- * a TZID. Returning an icaltimezone with a different TZID would
+ * a TZID. Returning an ICalTimezone with a different TZID would
* lead to broken VCALENDARs in the caller. */
- icalcomp = icaltimezone_get_component (builtin_zone);
- icalcomp = icalcomponent_new_clone (icalcomp);
-
- prop = icalcomponent_get_first_property (
- icalcomp, ICAL_ANY_PROPERTY);
-
- while (prop != NULL) {
- if (icalproperty_isa (prop) == ICAL_TZID_PROPERTY) {
- icalproperty_set_value_from_string (prop, tzid, "NO");
+ icomp = i_cal_timezone_get_component (builtin_zone);
+ clone = i_cal_component_new_clone (icomp);
+ g_object_unref (icomp);
+ icomp = clone;
+
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ANY_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp, I_CAL_ANY_PROPERTY)) {
+ if (i_cal_property_isa (prop) == I_CAL_TZID_PROPERTY) {
+ i_cal_property_set_value_from_string (prop, tzid, "NO");
+ g_object_unref (prop);
break;
}
-
- prop = icalcomponent_get_next_property (
- icalcomp, ICAL_ANY_PROPERTY);
}
- if (icalcomp != NULL) {
- zone = icaltimezone_new ();
- if (icaltimezone_set_component (zone, icalcomp)) {
- tzid = icaltimezone_get_tzid (zone);
- g_hash_table_insert (
- priv->zone_cache,
- g_strdup (tzid), zone);
- } else {
- icalcomponent_free (icalcomp);
- icaltimezone_free (zone, 1);
- zone = NULL;
- }
+ zone = i_cal_timezone_new ();
+ if (i_cal_timezone_set_component (zone, icomp)) {
+ 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);
}
-exit:
+ exit:
g_mutex_unlock (&priv->zone_cache_lock);
return zone;
@@ -1089,7 +1072,7 @@ e_cal_backend_init (ECalBackend *backend)
(GHashFunc) g_str_hash,
(GEqualFunc) g_str_equal,
(GDestroyNotify) g_free,
- (GDestroyNotify) cal_backend_free_zone);
+ (GDestroyNotify) g_object_unref);
backend->priv = E_CAL_BACKEND_GET_PRIVATE (backend);
@@ -1116,7 +1099,7 @@ e_cal_backend_init (ECalBackend *backend)
*
* Returns: The kind of components for this backend.
*/
-icalcomponent_kind
+ICalComponentKind
e_cal_backend_get_kind (ECalBackend *backend)
{
g_return_val_if_fail (E_IS_CAL_BACKEND (backend), ICAL_NO_COMPONENT);
@@ -1528,7 +1511,7 @@ e_cal_backend_remove_view (ECalBackend *backend,
* g_list_free_full (list, g_object_unref);
* ]|
*
- * Returns: (element-type EDataCalView): a list of cal views
+ * Returns: (element-type EDataCalView) (transfer full): a list of cal views
*
* Since: 3.8
**/
@@ -2074,7 +2057,7 @@ e_cal_backend_get_object_finish (ECalBackend *backend,
* e_cal_backend_get_object_list_sync:
* @backend: an #ECalBackend
* @query: a search query in S-expression format
- * @out_objects: a #GQueue in which to deposit results
+ * @out_objects: (element-type utf8): a #GQueue in which to deposit results
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
@@ -2218,7 +2201,7 @@ e_cal_backend_get_object_list (ECalBackend *backend,
* e_cal_backend_get_object_list_finish:
* @backend: an #ECalBackend
* @result: a #GAsyncResult
- * @out_objects: a #GQueue in which to deposit results
+ * @out_objects: (element-type utf8): a #GQueue in which to deposit results
* @error: return location for a #GError, or %NULL
*
* Finishes the operation started with e_cal_backend_get_object_list().
@@ -2266,8 +2249,8 @@ e_cal_backend_get_object_list_finish (ECalBackend *backend,
* @backend: an #ECalBackend
* @start: start time
* @end: end time
- * @users: a %NULL-terminated array of user strings
- * @out_freebusy: iCalendar strings with overall returned Free/Busy data
+ * @users: (array zero-terminated=1): a %NULL-terminated array of user strings
+ * @out_freebusy: (element-type utf8): iCalendar strings with overall returned Free/Busy data
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
@@ -2366,7 +2349,7 @@ cal_backend_get_free_busy_thread (GSimpleAsyncResult *simple,
* @backend: an #ECalBackend
* @start: start time
* @end: end time
- * @users: a %NULL-terminated array of user strings
+ * @users: (array zero-terminated=1): a %NULL-terminated array of user strings
* @cancellable: optional #GCancellable object, or %NULL
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: data to pass to the callback function
@@ -2429,7 +2412,7 @@ e_cal_backend_get_free_busy (ECalBackend *backend,
* e_cal_backend_get_free_busy_finish:
* @backend: an #ECalBackend
* @result: a #GAsyncResult
- * @out_freebusy: iCalendar strings with overall returned Free/Busy data
+ * @out_freebusy: (element-type utf8): iCalendar strings with overall returned Free/Busy data
* @error: return location for a #GError, or %NULL
*
* Finishes the operation started with e_cal_backend_get_free_busy().
@@ -2711,7 +2694,7 @@ e_cal_backend_create_objects_finish (ECalBackend *backend,
}
/**
- * e_cal_backend_modify_objects:
+ * e_cal_backend_modify_objects_sync:
* @backend: an #ECalBackend
* @calobjs: a %NULL-terminated array of iCalendar strings
* @mod: modification type for recurrences
@@ -2946,7 +2929,7 @@ e_cal_backend_modify_objects_finish (ECalBackend *backend,
/**
* e_cal_backend_remove_objects_sync:
* @backend: an #ECalBackend
- * @component_ids: a #GList of #ECalComponentId structs
+ * @component_ids: (element-type ECalComponentId): a #GList of #ECalComponentId structs
* @mod: modification type for recurrences
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
@@ -3036,7 +3019,7 @@ cal_backend_remove_objects_thread (GSimpleAsyncResult *simple,
/**
* e_cal_backend_remove_objects:
* @backend: an #ECalBackend
- * @component_ids: a #GList of #ECalComponentId structs
+ * @component_ids: (element-type ECalComponentId): a #GList of #ECalComponentId structs
* @mod: modification type for recurrences
* @cancellable: optional #GCancellable object, or %NULL
* @callback: a #GAsyncReadyCallback to call when the request is satisfied
diff --git a/src/calendar/libedata-cal/e-cal-backend.h b/src/calendar/libedata-cal/e-cal-backend.h
index e729d032d..b732e20f3 100644
--- a/src/calendar/libedata-cal/e-cal-backend.h
+++ b/src/calendar/libedata-cal/e-cal-backend.h
@@ -135,25 +135,25 @@ struct _ECalBackendClass {
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
- const GSList *users,
+ const GSList *users, /* gchar * */
time_t start,
time_t end);
void (*create_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
- const GSList *calobjs);
+ const GSList *calobjs); /* gchar * */
void (*modify_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
- const GSList *calobjs,
+ const GSList *calobjs, /* gchar * */
ECalObjModType mod);
void (*remove_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
- const GSList *ids,
+ const GSList *ids, /* ECalComponentId * */
ECalObjModType mod);
void (*receive_objects) (ECalBackend *backend,
EDataCal *cal,
@@ -204,7 +204,7 @@ struct _ECalBackendClass {
};
GType e_cal_backend_get_type (void) G_GNUC_CONST;
-icalcomponent_kind
+ICalComponentKind
e_cal_backend_get_kind (ECalBackend *backend);
EDataCal * e_cal_backend_ref_data_cal (ECalBackend *backend);
void e_cal_backend_set_data_cal (ECalBackend *backend,
@@ -276,7 +276,7 @@ gchar * e_cal_backend_get_object_finish (ECalBackend *backend,
gboolean e_cal_backend_get_object_list_sync
(ECalBackend *backend,
const gchar *query,
- GQueue *out_objects,
+ GQueue *out_objects, /* gchar * */
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_object_list (ECalBackend *backend,
@@ -287,14 +287,14 @@ void e_cal_backend_get_object_list (ECalBackend *backend,
gboolean e_cal_backend_get_object_list_finish
(ECalBackend *backend,
GAsyncResult *result,
- GQueue *out_objects,
+ GQueue *out_objects, /* gchar * */
GError **error);
gboolean e_cal_backend_get_free_busy_sync
(ECalBackend *backend,
time_t start,
time_t end,
const gchar * const *users,
- GSList **out_freebusy,
+ GSList **out_freebusy, /* gchar * */
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_free_busy (ECalBackend *backend,
@@ -307,7 +307,7 @@ void e_cal_backend_get_free_busy (ECalBackend *backend,
gboolean e_cal_backend_get_free_busy_finish
(ECalBackend *backend,
GAsyncResult *result,
- GSList **out_freebusy,
+ GSList **out_freebusy, /* gchar * */
GError **error);
gboolean e_cal_backend_create_objects_sync
(ECalBackend *backend,
@@ -343,12 +343,12 @@ gboolean e_cal_backend_modify_objects_finish
GError **error);
gboolean e_cal_backend_remove_objects_sync
(ECalBackend *backend,
- GList *component_ids,
+ GList *component_ids, /* ECalComponentId * */
ECalObjModType mod,
GCancellable *cancellable,
GError **error);
void e_cal_backend_remove_objects (ECalBackend *backend,
- GList *component_ids,
+ GList *component_ids, /* ECalComponentId * */
ECalObjModType mod,
GCancellable *cancellable,
GAsyncReadyCallback callback,
diff --git a/src/calendar/libedata-cal/e-cal-cache.c b/src/calendar/libedata-cal/e-cal-cache.c
index f5695ba13..0eb190e0d 100644
--- a/src/calendar/libedata-cal/e-cal-cache.c
+++ b/src/calendar/libedata-cal/e-cal-cache.c
@@ -70,8 +70,8 @@
struct _ECalCachePrivate {
gboolean initializing;
- GHashTable *loaded_timezones; /* gchar *tzid ~> icaltimezone * */
- GHashTable *modified_timezones; /* gchar *tzid ~> icaltimezone * */
+ GHashTable *loaded_timezones; /* gchar *tzid ~> ICalTimezone * */
+ GHashTable *modified_timezones; /* gchar *tzid ~> ICalTimezone * */
GRecMutex timezones_lock;
GHashTable *sexps; /* gint ~> ECalBackendSExp * */
@@ -509,14 +509,16 @@ e_cal_cache_get_ids (ECache *cache,
static ICalTimezone *
ecc_resolve_tzid_cb (const gchar *tzid,
- gpointer user_data)
+ gpointer user_data,
+ GCancellable *cancellable,
+ GError **error)
{
ECalCache *cal_cache = user_data;
ICalTimezone *zone = NULL;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), NULL);
- if (e_cal_cache_get_timezone (cal_cache, tzid, &zone, NULL, NULL) && zone)
+ if (e_cal_cache_get_timezone (cal_cache, tzid, &zone, cancellable, NULL) && zone)
return zone;
zone = i_cal_timezone_get_builtin_timezone (tzid);
@@ -558,7 +560,7 @@ ecc_encode_time_to_sql (ECalCache *cal_cache,
if (i_cal_time_is_date (itt) && !i_cal_time_is_utc (itt) &&
e_cal_component_datetime_get_tzid (dt))
- zone = ecc_resolve_tzid_cb (e_cal_component_datetime_get_tzid (dt), cal_cache);
+ zone = ecc_resolve_tzid_cb (e_cal_component_datetime_get_tzid (dt), cal_cache, NULL, NULL);
i_cal_timezone_convert_time (itt, zone, i_cal_timezone_get_utc_timezone ());
@@ -843,13 +845,13 @@ ecc_fill_other_columns (ECalCache *cal_cache,
ECacheColumnValues *other_columns,
ECalComponent *comp)
{
- time_t occur_start = -1, occur_end = -1;
ECalComponentDateTime *dt;
ECalComponentText *text;
ECalComponentClassification classification = E_CAL_COMPONENT_CLASS_PUBLIC;
ICalComponent *icomp;
ICalPropertyStatus status = I_CAL_STATUS_NONE;
ICalTimetype *itt;
+ time_t occur_start = -1, occur_end = -1;
gchar *str = NULL;
gint nint;
gboolean has;
@@ -907,7 +909,7 @@ ecc_fill_other_columns (ECalCache *cal_cache,
nint = e_cal_component_get_priority (comp);
add_value (ECC_COLUMN_PRIORITY, nint != -1 ? g_strdup_printf ("%d", nint) : NULL);
- nint = e_cal_component_get_percent (comp);
+ nint = e_cal_component_get_percent_complete (comp);
add_value (ECC_COLUMN_PERCENT_COMPLETE, nint != -1 ? g_strdup_printf ("%d", nint) : NULL);
has = e_cal_component_has_alarms (comp);
@@ -1121,12 +1123,12 @@ ecc_sexp_func_occur_in_time_range (ESExp *esexp,
result = e_sexp_result_new (esexp, ESEXP_RES_STRING);
if (!ctx->not_level) {
- struct icaltimetype itt_start, itt_end;
+ ICalTimetype *itt_start, *itt_end;
gchar *start_str, *end_str;
/* The default zone argument, if any, is ignored here */
- itt_start = icaltime_from_timet_with_zone (argv[0]->value.time, 0, NULL);
- itt_end = icaltime_from_timet_with_zone (argv[1]->value.time, 0, NULL);
+ itt_start = i_cal_time_from_timet_with_zone (argv[0]->value.time, 0, NULL);
+ itt_end = i_cal_time_from_timet_with_zone (argv[1]->value.time, 0, NULL);
start_str = ecc_encode_itt_to_sql (itt_start);
end_str = ecc_encode_itt_to_sql (itt_end);
@@ -1136,6 +1138,8 @@ ecc_sexp_func_occur_in_time_range (ESExp *esexp,
if (!result->value.string)
result->value.string = g_strdup ("1=1");
+ g_clear_object (&itt_start);
+ g_clear_object (&itt_end);
g_free (start_str);
g_free (end_str);
} else {
@@ -1844,7 +1848,7 @@ ecc_timezone_from_string (const gchar *icalstring)
component = i_cal_component_new_from_string (icalstring);
if (component) {
- i_cal_timezone *zone;
+ ICalTimezone *zone;
zone = i_cal_timezone_new ();
if (!i_cal_timezone_set_component (zone, component)) {
@@ -1966,7 +1970,7 @@ ecc_count_timezones_for_component (ECalCache *cal_cache,
g_return_if_fail (E_IS_CAL_CACHE (cal_cache));
g_return_if_fail (timezones != NULL);
- if (icalcomp) {
+ if (icomp) {
CountTimezonesData ctd;
ctd.cal_cache = cal_cache;
@@ -2309,27 +2313,27 @@ e_cal_cache_new (const gchar *filename,
/**
* e_cal_cache_dup_component_revision:
* @cal_cache: an #ECalCache
- * @icalcomp: an icalcomponent
+ * @icomp: an #ICalComponent
*
- * Returns the @icalcomp revision, used to detect changes.
+ * Returns the @icomp revision, used to detect changes.
* The returned string should be freed with g_free(), when
* no longer needed.
*
* Returns: (transfer full): A newly allocated string containing
- * revision of the @icalcomp.
+ * revision of the @icomp.
*
* Since: 3.26
**/
gchar *
e_cal_cache_dup_component_revision (ECalCache *cal_cache,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
gchar *revision = NULL;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), NULL);
- g_return_val_if_fail (icalcomp != NULL, NULL);
+ g_return_val_if_fail (icomp != NULL, NULL);
- g_signal_emit (cal_cache, signals[DUP_COMPONENT_REVISION], 0, icalcomp, &revision);
+ g_signal_emit (cal_cache, signals[DUP_COMPONENT_REVISION], 0, icomp, &revision);
return revision;
}
@@ -2524,20 +2528,19 @@ e_cal_cache_remove_component (ECalCache *cal_cache,
GCancellable *cancellable,
GError **error)
{
- ECalComponentId id;
+ ECalComponentId *id;
GSList *ids = NULL;
gboolean success;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
- id.uid = (gchar *) uid;
- id.rid = (gchar *) rid;
+ id = e_cal_component_id_new (uid, rid);
- ids = g_slist_prepend (ids, &id);
+ ids = g_slist_prepend (ids, id);
success = e_cal_cache_remove_components (cal_cache, ids, offline_flag, cancellable, error);
- g_slist_free (ids);
+ g_slist_free_full (ids, e_cal_component_id_free);
return success;
}
@@ -3040,7 +3043,7 @@ e_cal_cache_get_components_in_range_as_strings (ECalCache *cal_cache,
GError **error)
{
gchar *sexp;
- struct icaltimetype itt_start, itt_end;
+ ICalTimetype *itt_start, *itt_end;
gboolean success;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
@@ -3048,12 +3051,25 @@ e_cal_cache_get_components_in_range_as_strings (ECalCache *cal_cache,
*out_icalstrings = NULL;
- itt_start = icaltime_from_timet_with_zone (range_start, FALSE, NULL);
- itt_end = icaltime_from_timet_with_zone (range_end, FALSE, NULL);
+ itt_start = i_cal_time_from_timet_with_zone (range_start, FALSE, NULL);
+ itt_end = i_cal_time_from_timet_with_zone (range_end, FALSE, NULL);
sexp = 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));
+
+ g_clear_object (&itt_start);
+ g_clear_object (&itt_end);
success = e_cal_cache_search_with_callback (cal_cache, sexp, ecc_search_icalstrings_cb,
out_icalstrings, cancellable, error);
@@ -3372,7 +3388,7 @@ e_cal_cache_get_offline_changes (ECalCache *cal_cache,
/**
* e_cal_cache_delete_attachments:
* @cal_cache: an #ECalCache
- * @component: an icalcomponent
+ * @component: an #ICalComponent
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
@@ -3386,33 +3402,29 @@ e_cal_cache_get_offline_changes (ECalCache *cal_cache,
**/
gboolean
e_cal_cache_delete_attachments (ECalCache *cal_cache,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error)
{
- icalproperty *prop;
+ ICalProperty *prop;
gchar *cache_dirname = NULL;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
g_return_val_if_fail (component != NULL, FALSE);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTACH_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTACH_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (component, ICAL_ATTACH_PROPERTY)) {
- icalattach *attach = icalproperty_get_attach (prop);
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTACH_PROPERTY)) {
+ ICalAttach *attach = i_cal_property_get_attach (prop);
- if (attach && icalattach_get_is_url (attach)) {
+ if (attach && i_cal_attach_get_is_url (attach)) {
const gchar *url;
- url = icalattach_get_url (attach);
+ url = i_cal_attach_get_url (attach);
if (url) {
- gsize buf_size;
gchar *buf;
- buf_size = strlen (url);
- buf = g_malloc0 (buf_size + 1);
-
- icalvalue_decode_ical_string (url, buf, buf_size);
+ buf = i_cal_value_decode_ical_string (url);
if (g_str_has_prefix (buf, "file://")) {
gchar *filename;
@@ -3434,6 +3446,8 @@ e_cal_cache_delete_attachments (ECalCache *cal_cache,
g_free (buf);
}
}
+
+ g_clear_object (&attach);
}
g_free (cache_dirname);
@@ -3485,7 +3499,7 @@ e_cal_cache_get_current_timezone_refs (ECalCache *cal_cache,
/**
* e_cal_cache_put_timezone:
* @cal_cache: an #ECalCache
- * @zone: an icaltimezone to put
+ * @zone: an #ICalTimezone to put
* @inc_ref_counts: how many refs to add, or 0 to have it stored forever
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
@@ -3502,7 +3516,7 @@ e_cal_cache_get_current_timezone_refs (ECalCache *cal_cache,
**/
gboolean
e_cal_cache_put_timezone (ECalCache *cal_cache,
- const icaltimezone *zone,
+ const ICalTimezone *zone,
guint inc_ref_counts,
GCancellable *cancellable,
GError **error)
@@ -3511,27 +3525,29 @@ e_cal_cache_put_timezone (ECalCache *cal_cache,
gchar *stmt;
const gchar *tzid;
gchar *component_str;
- icalcomponent *component;
+ ICalComponent *component;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
g_return_val_if_fail (zone != NULL, FALSE);
- tzid = icaltimezone_get_tzid ((icaltimezone *) zone);
+ tzid = i_cal_timezone_get_tzid ((ICalTimezone *) zone);
if (!tzid) {
g_set_error_literal (error, E_CACHE_ERROR, E_CACHE_ERROR_NOT_FOUND, _("Cannot add timezone
without tzid"));
return FALSE;
}
- if (ecc_tzid_is_libical_builtin (icaltimezone_get_tzid ((icaltimezone *) zone)))
+ if (ecc_tzid_is_libical_builtin (tzid))
return TRUE;
- component = icaltimezone_get_component ((icaltimezone *) zone);
+ component = i_cal_timezone_get_component ((ICalTimezone *) zone);
if (!component) {
g_set_error_literal (error, E_CACHE_ERROR, E_CACHE_ERROR_NOT_FOUND, _("Cannot add timezone
without component"));
return FALSE;
}
- component_str = icalcomponent_as_ical_string_r (component);
+ component_str = i_cal_component_as_ical_string_r (component);
+ g_clear_object (&component);
+
if (!component_str) {
g_set_error_literal (error, E_CACHE_ERROR, E_CACHE_ERROR_NOT_FOUND, _("Cannot add timezone
with invalid component"));
return FALSE;
@@ -3570,13 +3586,13 @@ e_cal_cache_put_timezone (ECalCache *cal_cache,
* e_cal_cache_get_timezone:
* @cal_cache: an #ECalCache
* @tzid: a timezone ID to get
- * @out_zone: (out) (transfer none): return location for the icaltimezone
+ * @out_zone: (out) (transfer none): return location for the #ICalTimezone
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Gets a timezone with given @tzid, which had been previously put
* into the @cal_cache with e_cal_cache_put_timezone().
- * The returned icaltimezone is owned by the @cal_cache and should
+ * The returned ICalTimezone is owned by the @cal_cache and should
* not be freed.
*
* Returns: Whether succeeded.
@@ -3586,7 +3602,7 @@ e_cal_cache_put_timezone (ECalCache *cal_cache,
gboolean
e_cal_cache_get_timezone (ECalCache *cal_cache,
const gchar *tzid,
- icaltimezone **out_zone,
+ ICalTimezone **out_zone,
GCancellable *cancellable,
GError **error)
@@ -3615,7 +3631,7 @@ e_cal_cache_get_timezone (ECalCache *cal_cache,
success = e_cal_cache_dup_timezone_as_string (cal_cache, tzid, &zone_str, cancellable, error);
if (success && zone_str) {
- icaltimezone *zone;
+ ICalTimezone *zone;
zone = ecc_timezone_from_string (zone_str);
if (zone) {
@@ -3637,13 +3653,13 @@ e_cal_cache_get_timezone (ECalCache *cal_cache,
* e_cal_cache_dup_timezone_as_string:
* @cal_cache: an #ECalCache
* @tzid: a timezone ID to get
- * @out_zone_string: (out) (transfer full): return location for the icaltimezone as iCal string
+ * @out_zone_string: (out) (transfer full): return location for the #ICalTimezone as iCal string
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Gets a timezone with given @tzid, which had been previously put
* into the @cal_cache with e_cal_cache_put_timezone().
- * The returned string is an iCal string for that icaltimezone and
+ * The returned string is an iCal string for that ICalTimezone and
* should be freed with g_free() when no longer needed.
*
* Returns: Whether succeeded.
@@ -3696,7 +3712,7 @@ e_cal_cache_load_zones_cb (ECache *cache,
/* Do not overwrite already loaded timezones, they can be used anywhere around */
if (!g_hash_table_lookup (loaded_zones, column_values[0])) {
- icaltimezone *zone;
+ ICalTimezone *zone;
zone = ecc_timezone_from_string (column_values[1]);
if (zone) {
@@ -3710,13 +3726,13 @@ e_cal_cache_load_zones_cb (ECache *cache,
/**
* e_cal_cache_list_timezones:
* @cal_cache: an #ECalCache
- * @out_timezones: (out) (transfer container) (element-type icaltimezone): return location for the list of
stored timezones
+ * @out_timezones: (out) (transfer container) (element-type ICalTimezone): return location for the list of
stored timezones
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
* Gets a list of all stored timezones by the @cal_cache.
* Only the returned list should be freed with g_list_free()
- * when no longer needed; the icaltimezone-s are owned
+ * when no longer needed; the #ICalTimezone-s are owned
* by the @cal_cache.
*
* Note: The list can contain timezones previously stored
@@ -3931,18 +3947,18 @@ ecc_search_delete_attachment_cb (ECalCache *cal_cache,
EOfflineState offline_state,
gpointer user_data)
{
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
GCancellable *cancellable = user_data;
GError *local_error = NULL;
g_return_val_if_fail (E_IS_CAL_CACHE (cal_cache), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
- icalcomp = icalcomponent_new_from_string (object);
- if (!icalcomp)
+ icomp = i_cal_component_new_from_string (object);
+ if (!icomp)
return TRUE;
- if (!e_cal_cache_delete_attachments (cal_cache, icalcomp, cancellable, &local_error)) {
+ if (!e_cal_cache_delete_attachments (cal_cache, icomp, cancellable, &local_error)) {
if (rid && !*rid)
rid = NULL;
@@ -3951,7 +3967,7 @@ ecc_search_delete_attachment_cb (ECalCache *cal_cache,
g_clear_error (&local_error);
}
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
return !g_cancellable_is_cancelled (cancellable);
}
@@ -3977,47 +3993,53 @@ ecc_empty_aux_tables (ECache *cache,
<DTSTAMP> "-" <LAST-MODIFIED> "-" <SEQUENCE> */
static gchar *
ecc_dup_component_revision (ECalCache *cal_cache,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
- struct icaltimetype itt;
- icalproperty *prop;
+ ICalTimetype *itt;
+ ICalProperty *prop;
GString *revision;
- g_return_val_if_fail (icalcomp != NULL, NULL);
+ g_return_val_if_fail (icomp != NULL, NULL);
revision = g_string_sized_new (48);
- itt = icalcomponent_get_dtstamp (icalcomp);
- if (icaltime_is_null_time (itt) || !icaltime_is_valid_time (itt)) {
+ itt = i_cal_component_get_dtstamp (icomp);
+ if (!itt || i_cal_time_is_null_time (itt) || !i_cal_time_is_valid_time (itt)) {
g_string_append_c (revision, 'x');
} else {
g_string_append_printf (revision, "%04d%02d%02d%02d%02d%02d",
- itt.year, itt.month, itt.day,
- itt.hour, itt.minute, itt.second);
+ i_cal_timetype_get_year (itt), i_cal_timetype_get_month (itt), i_cal_timetype_get_day
(itt),
+ i_cal_timetype_get_hour (itt), i_cal_timetype_get_minute (itt),
i_cal_timetype_get_second (itt));
}
+ g_clear_object (&itt);
+
g_string_append_c (revision, '-');
- prop = icalcomponent_get_first_property (icalcomp, ICAL_LASTMODIFIED_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_LASTMODIFIED_PROPERTY);
if (prop)
- itt = icalproperty_get_lastmodified (prop);
+ itt = i_cal_property_get_lastmodified (prop);
- if (!prop || icaltime_is_null_time (itt) || !icaltime_is_valid_time (itt)) {
+ if (!prop || !itt || i_cal_time_is_null_time (itt) || !i_cal_time_is_valid_time (itt)) {
g_string_append_c (revision, 'x');
} else {
g_string_append_printf (revision, "%04d%02d%02d%02d%02d%02d",
- itt.year, itt.month, itt.day,
- itt.hour, itt.minute, itt.second);
+ i_cal_timetype_get_year (itt), i_cal_timetype_get_month (itt), i_cal_timetype_get_day
(itt),
+ i_cal_timetype_get_hour (itt), i_cal_timetype_get_minute (itt),
i_cal_timetype_get_second (itt));
}
+ g_clear_object (&prop);
+ g_clear_object (&itt);
+
g_string_append_c (revision, '-');
- prop = icalcomponent_get_first_property (icalcomp, ICAL_SEQUENCE_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_SEQUENCE_PROPERTY);
if (!prop) {
g_string_append_c (revision, 'x');
} else {
- g_string_append_printf (revision, "%d", icalproperty_get_sequence (prop));
+ g_string_append_printf (revision, "%d", i_cal_property_get_sequence (prop));
}
+ g_clear_object (&prop);
return g_string_free (revision, FALSE);
}
@@ -4129,41 +4151,41 @@ e_cal_cache_remove_all_locked (ECache *cache,
static void
cal_cache_free_zone (gpointer ptr)
{
- icaltimezone *zone = ptr;
+ ICalTimezone *zone = ptr;
if (zone)
- icaltimezone_free (zone, 1);
+ g_object_unref (zone);
}
static void
ecc_add_cached_timezone (ETimezoneCache *cache,
- icaltimezone *zone)
+ ICalTimezone *zone)
{
ECalCache *cal_cache;
cal_cache = E_CAL_CACHE (cache);
- if (!zone || ecc_tzid_is_libical_builtin (icaltimezone_get_tzid (zone)))
+ if (!zone || ecc_tzid_is_libical_builtin (i_cal_timezone_get_tzid (zone)))
return;
e_cal_cache_put_timezone (cal_cache, zone, 0, NULL, NULL);
}
-static icaltimezone *
+static ICalTimezone *
ecc_get_cached_timezone (ETimezoneCache *cache,
const gchar *tzid)
{
ECalCache *cal_cache;
- icaltimezone *zone = NULL;
- icaltimezone *builtin_zone = NULL;
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ICalTimezone *zone = NULL;
+ ICalTimezone *builtin_zone = NULL;
+ ICalComponent *icomp, *clone;
+ ICalProperty *prop;
const gchar *builtin_tzid;
cal_cache = E_CAL_CACHE (cache);
if (g_str_equal (tzid, "UTC"))
- return icaltimezone_get_utc_timezone ();
+ return i_cal_timezone_get_utc_timezone ();
g_rec_mutex_lock (&cal_cache->priv->timezones_lock);
@@ -4177,19 +4199,19 @@ ecc_get_cached_timezone (ETimezoneCache *cache,
goto exit;
/* Try the location first */
- /*zone = icaltimezone_get_builtin_timezone (tzid);
+ /*zone = i_cal_timezone_get_builtin_timezone (tzid);
if (zone)
goto exit;*/
/* Try to replace the original time zone with a more complete
* and/or potentially updated built-in time zone. Note this also
* applies to TZIDs which match built-in time zones exactly: they
- * are extracted via icaltimezone_get_builtin_timezone_from_tzid(). */
+ * are extracted via i_cal_timezone_get_builtin_timezone_from_tzid(). */
builtin_tzid = e_cal_match_tzid (tzid);
if (builtin_tzid)
- builtin_zone = icaltimezone_get_builtin_timezone_from_tzid (builtin_tzid);
+ builtin_zone = i_cal_timezone_get_builtin_timezone_from_tzid (builtin_tzid);
if (!builtin_zone) {
e_cal_cache_get_timezone (cal_cache, tzid, &zone, NULL, NULL);
@@ -4198,33 +4220,31 @@ ecc_get_cached_timezone (ETimezoneCache *cache,
/* Use the built-in time zone *and* rename it. Likely the caller
* is asking for a specific TZID because it has an event with such
- * a TZID. Returning an icaltimezone with a different TZID would
+ * a TZID. Returning an i_cal_timezone with a different TZID would
* lead to broken VCALENDARs in the caller. */
- icalcomp = icaltimezone_get_component (builtin_zone);
- icalcomp = icalcomponent_new_clone (icalcomp);
+ icomp = i_cal_timezone_get_component (builtin_zone);
+ clone = i_cal_component_new_clone (icomp);
+ g_object_unref (icomp);
+ icomp = clone;
- prop = icalcomponent_get_first_property (icalcomp, ICAL_ANY_PROPERTY);
-
- while (prop != NULL) {
- if (icalproperty_isa (prop) == ICAL_TZID_PROPERTY) {
- icalproperty_set_value_from_string (prop, tzid, "NO");
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ANY_PROPERTY);
+ prop;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp, ICAL_ANY_PROPERTY)) {
+ if (i_cal_property_isa (prop) == I_CAL_TZID_PROPERTY) {
+ i_cal_property_set_value_from_string (prop, tzid, "NO");
+ g_object_unref (prop);
break;
}
-
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ANY_PROPERTY);
}
- if (icalcomp != NULL) {
- zone = icaltimezone_new ();
- if (icaltimezone_set_component (zone, icalcomp)) {
- tzid = icaltimezone_get_tzid (zone);
- g_hash_table_insert (cal_cache->priv->modified_timezones, g_strdup (tzid), zone);
- } else {
- icalcomponent_free (icalcomp);
- icaltimezone_free (zone, 1);
- zone = NULL;
- }
+ zone = i_cal_timezone_new ();
+ if (i_cal_timezone_set_component (zone, icomp)) {
+ 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);
}
exit:
@@ -4280,7 +4300,7 @@ e_cal_cache_class_init (ECalCacheClass *klass)
/**
* ECalCache:dup-component-revision:
- * A signal being called to get revision of an icalcomponent.
+ * A signal being called to get revision of an ICalComponent.
* The default implementation uses a concatenation of
* DTSTAMP '-' LASTMODIFIED '-' SEQUENCE.
**/
@@ -4303,7 +4323,7 @@ e_cal_cache_class_init (ECalCacheClass *klass)
* A signal being called to get timezone when putting component
* into the cache. It's used to make sure the cache contains
* all timezones which are needed by the component. The returned
- * icaltimezone will not be freed.
+ * ICalTimezone will not be freed.
*
* Since: 3.30
**/
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
index f712f1550..a1a327aad 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.c
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
@@ -104,7 +104,7 @@ enum {
static guint signals[LAST_SIGNAL];
/* To be able to call the ECalBackend implementation, which stores zones only in the memory */
-static icaltimezone * (* ecmb_timezone_cache_parent_get_timezone) (ETimezoneCache *cache,
+static ICalTimezone * (* ecmb_timezone_cache_parent_get_timezone) (ETimezoneCache *cache,
const gchar *tzid);
static GList * (* ecmb_timezone_cache_parent_list_timezones) (ETimezoneCache *cache);
@@ -918,7 +918,6 @@ ecmb_put_one_component (ECalMetaBackend *meta_backend,
if (e_cal_component_has_attachments (comp)) {
success = e_cal_meta_backend_store_inline_attachments_sync (meta_backend,
e_cal_component_get_icalcomponent (comp), cancellable, error);
- e_cal_component_rescan (comp);
}
success = success && e_cal_cache_put_component (cal_cache, comp, extra, offline_flag, cancellable,
error);
@@ -1010,33 +1009,33 @@ ecmb_put_instances (ECalMetaBackend *meta_backend,
static void
ecmb_gather_timezones (ECalMetaBackend *meta_backend,
ETimezoneCache *timezone_cache,
- icalcomponent *icalcomp)
+ ICalComponent *icomp)
{
- icalcomponent *subcomp;
- icaltimezone *zone;
+ ICalComponent *subcomp;
+ ICalTimezone *zone;
g_return_if_fail (E_IS_CAL_META_BACKEND (meta_backend));
g_return_if_fail (E_IS_TIMEZONE_CACHE (timezone_cache));
- g_return_if_fail (icalcomp != NULL);
+ g_return_if_fail (icomp != NULL);
- zone = icaltimezone_new ();
+ zone = i_cal_timezone_new ();
- for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+ for (subcomp = i_cal_component_get_first_component (icomp, I_CAL_VTIMEZONE_COMPONENT);
subcomp;
- subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
- icalcomponent *clone;
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp,
I_CAL_VTIMEZONE_COMPONENT)) {
+ ICalComponent *clone;
- clone = icalcomponent_new_clone (subcomp);
+ clone = i_cal_component_new_clone (subcomp);
- if (icaltimezone_set_component (zone, clone)) {
- if (icaltimezone_get_tzid (zone))
+ if (i_cal_timezone_set_component (zone, clone)) {
+ if (i_cal_timezone_get_tzid (zone))
e_timezone_cache_add_timezone (timezone_cache, zone);
} else {
- icalcomponent_free (clone);
+ g_object_unref (clone);
}
}
- icaltimezone_free (zone, TRUE);
+ g_object_unref (zone);
}
static gboolean
@@ -1050,7 +1049,7 @@ ecmb_load_component_wrapper_sync (ECalMetaBackend *meta_backend,
GError **error)
{
ECacheOfflineFlag offline_flag = E_CACHE_IS_ONLINE;
- icalcomponent *icalcomp = NULL;
+ ICalComponent *icomp = NULL;
GSList *new_instances = NULL;
gchar *extra = NULL;
const gchar *loaded_uid = NULL;
@@ -1058,51 +1057,51 @@ ecmb_load_component_wrapper_sync (ECalMetaBackend *meta_backend,
GError *local_error = NULL;
if (preloaded_object && *preloaded_object) {
- icalcomp = icalcomponent_new_from_string (preloaded_object);
- if (!icalcomp) {
+ icomp = i_cal_component_new_from_string (preloaded_object);
+ if (!icomp) {
g_propagate_error (error, e_data_cal_create_error_fmt (InvalidObject, _("Preloaded
object for UID “%s” is invalid"), uid));
return FALSE;
}
} else if (!e_cal_meta_backend_ensure_connected_sync (meta_backend, cancellable, error) ||
- !e_cal_meta_backend_load_component_sync (meta_backend, uid, preloaded_extra, &icalcomp,
&extra, cancellable, error)) {
+ !e_cal_meta_backend_load_component_sync (meta_backend, uid, preloaded_extra, &icomp,
&extra, cancellable, error)) {
g_free (extra);
return FALSE;
- } else if (!icalcomp) {
+ } else if (!icomp) {
g_propagate_error (error, e_data_cal_create_error_fmt (InvalidObject, _("Received object for
UID “%s” is invalid"), uid));
g_free (extra);
return FALSE;
}
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT) {
- icalcomponent_kind kind;
- icalcomponent *subcomp;
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT) {
+ ICalComponentKind kind;
+ ICalComponent *subcomp;
- ecmb_gather_timezones (meta_backend, E_TIMEZONE_CACHE (meta_backend), icalcomp);
+ ecmb_gather_timezones (meta_backend, E_TIMEZONE_CACHE (meta_backend), icomp);
kind = e_cal_backend_get_kind (E_CAL_BACKEND (meta_backend));
- for (subcomp = icalcomponent_get_first_component (icalcomp, kind);
- subcomp && success;
- subcomp = icalcomponent_get_next_component (icalcomp, kind)) {
- ECalComponent *comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone
(subcomp));
+ for (subcomp = i_cal_component_get_first_component (icomp, kind);
+ subcomp;
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp, kind)) {
+ ECalComponent *comp = e_cal_component_new_from_icalcomponent
(i_cal_component_new_clone (subcomp));
if (comp) {
new_instances = g_slist_prepend (new_instances, comp);
if (!loaded_uid)
- loaded_uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent
(comp));
+ loaded_uid = e_cal_component_get_uid (comp);
}
}
} else {
- ECalComponent *comp = e_cal_component_new_from_icalcomponent (icalcomp);
+ ECalComponent *comp = e_cal_component_new_from_icalcomponent (icomp);
- icalcomp = NULL;
+ icomp = NULL;
if (comp) {
new_instances = g_slist_prepend (new_instances, comp);
if (!loaded_uid)
- loaded_uid = icalcomponent_get_uid (e_cal_component_get_icalcomponent (comp));
+ loaded_uid = e_cal_component_get_uid (comp);
}
}
@@ -1120,8 +1119,7 @@ ecmb_load_component_wrapper_sync (ECalMetaBackend *meta_backend,
}
g_slist_free_full (new_instances, g_object_unref);
- if (icalcomp)
- icalcomponent_free (icalcomp);
+ g_clear_object (&icomp);
g_free (extra);
if (local_error) {
@@ -1176,7 +1174,6 @@ ecmb_save_component_wrapper_sync (ECalMetaBackend *meta_backend,
success = e_cal_meta_backend_inline_local_attachments_sync (meta_backend,
e_cal_component_get_icalcomponent (comp), cancellable, error);
- e_cal_component_rescan (comp);
} else {
g_object_ref (comp);
}
@@ -1331,13 +1328,13 @@ ecmb_get_object_sync (ECalBackendSync *sync_backend,
success = e_cal_cache_get_components_by_uid (cal_cache, uid, &components, cancellable,
&local_error);
if (success) {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
- icalcomp = e_cal_meta_backend_merge_instances (meta_backend, components, FALSE);
- if (icalcomp) {
- *calobj = icalcomponent_as_ical_string_r (icalcomp);
+ icomp = e_cal_meta_backend_merge_instances (meta_backend, components, FALSE);
+ if (icomp) {
+ *calobj = i_cal_component_as_ical_string_r (icomp);
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
} else {
g_set_error (&local_error, E_CACHE_ERROR, E_CACHE_ERROR_NOT_FOUND, _("Object
“%s” not found"), uid);
success = FALSE;
@@ -1390,49 +1387,52 @@ ecmb_get_object_list_sync (ECalBackendSync *sync_backend,
}
static gboolean
-ecmb_add_free_busy_instance_cb (icalcomponent *icalcomp,
- struct icaltimetype instance_start,
- struct icaltimetype instance_end,
+ecmb_add_free_busy_instance_cb (ICalComponent *icomp,
+ ICalTimetype *instance_start,
+ ICalTimetype *instance_end,
gpointer user_data,
GCancellable *cancellable,
GError **error)
{
- icalcomponent *vfreebusy = user_data;
- icalproperty *prop, *classification;
- icalparameter *param;
- struct icalperiodtype ipt;
+ ICalComponent *vfreebusy = user_data;
+ ICalProperty *prop, *classification;
+ ICalParameter *param;
+ ICalPeriodType *ipt;
- ipt.start = instance_start;
- ipt.end = instance_end;
- ipt.duration = icaldurationtype_null_duration ();
+ ipt = i_cal_period_type_null_period ();
+ i_cal_period_type_set_start (ipt, instance_start);
+ i_cal_period_type_set_end (ipt, instance_end);
/* Add busy information to the VFREEBUSY component */
- prop = icalproperty_new (ICAL_FREEBUSY_PROPERTY);
- icalproperty_set_freebusy (prop, ipt);
+ prop = i_cal_property_new (I_CAL_FREEBUSY_PROPERTY);
+ i_cal_property_set_freebusy (prop, ipt);
+ g_object_unref (ipt);
- param = icalparameter_new_fbtype (ICAL_FBTYPE_BUSY);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_fbtype (I_CAL_FBTYPE_BUSY);
+ i_cal_property_take_parameter (prop, param);
- classification = icalcomponent_get_first_property (icalcomp, ICAL_CLASS_PROPERTY);
- if (!classification || icalproperty_get_class (classification) == ICAL_CLASS_PUBLIC) {
+ classification = i_cal_component_get_first_property (icomp, I_CAL_CLASS_PROPERTY);
+ if (!classification || i_cal_property_get_class (classification) == I_CAL_CLASS_PUBLIC) {
const gchar *str;
- str = icalcomponent_get_summary (icalcomp);
+ str = i_cal_component_get_summary (icomp);
if (str && *str) {
- param = icalparameter_new_x (str);
- icalparameter_set_xname (param, "X-SUMMARY");
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_x (str);
+ i_cal_parameter_set_xname (param, "X-SUMMARY");
+ i_cal_property_take_parameter (prop, param);
}
- str = icalcomponent_get_location (icalcomp);
+ str = i_cal_component_get_location (icomp);
if (str && *str) {
- param = icalparameter_new_x (str);
- icalparameter_set_xname (param, "X-LOCATION");
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_x (str);
+ i_cal_parameter_set_xname (param, "X-LOCATION");
+ i_cal_property_take_parameter (prop, param);
}
}
- icalcomponent_add_property (vfreebusy, prop);
+ g_clear_object (&classification);
+
+ i_cal_component_take_property (vfreebusy, prop);
return TRUE;
}
@@ -1451,9 +1451,10 @@ ecmb_get_free_busy_sync (ECalBackendSync *sync_backend,
ECalCache *cal_cache;
GSList *link, *components = NULL;
gchar *cal_email_address, *mailto;
- icalcomponent *vfreebusy, *icalcomp;
- icalproperty *prop;
- icaltimezone *utc_zone;
+ ICalComponent *vfreebusy, *icomp;
+ ICalProperty *prop;
+ ICalTimezone *utc_zone;
+ ICalTimetype *itt;
g_return_if_fail (E_IS_CAL_META_BACKEND (sync_backend));
g_return_if_fail (out_freebusy != NULL);
@@ -1494,54 +1495,70 @@ ecmb_get_free_busy_sync (ECalBackendSync *sync_backend,
return;
}
- vfreebusy = icalcomponent_new_vfreebusy ();
+ vfreebusy = i_cal_component_new_vfreebusy ();
mailto = g_strconcat ("mailto:", cal_email_address, NULL);
- prop = icalproperty_new_organizer (mailto);
+ prop = i_cal_property_new_organizer (mailto);
g_free (mailto);
if (prop)
- icalcomponent_add_property (vfreebusy, prop);
+ i_cal_component_take_property (vfreebusy, prop);
+
+ utc_zone = i_cal_timezone_get_utc_timezone ();
- utc_zone = icaltimezone_get_utc_timezone ();
- icalcomponent_set_dtstart (vfreebusy, icaltime_from_timet_with_zone (start, FALSE, utc_zone));
- icalcomponent_set_dtend (vfreebusy, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
+ itt = i_cal_time_from_timet_with_zone (start, FALSE, utc_zone);
+ i_cal_component_set_dtstart (vfreebusy, itt);
+ g_object_unref (itt);
+
+ itt = i_cal_time_from_timet_with_zone (end, FALSE, utc_zone);
+ i_cal_component_set_dtend (vfreebusy, itt);
+ g_object_unref (itt);
for (link = components; link; link = g_slist_next (link)) {
ECalComponent *comp = link->data;
+ ICalTimetype *starttt, *endtt;
+ gboolean success;
if (!E_IS_CAL_COMPONENT (comp)) {
g_warn_if_reached ();
continue;
}
- icalcomp = e_cal_component_get_icalcomponent (comp);
- if (!icalcomp)
+ icomp = e_cal_component_get_icalcomponent (comp);
+ if (!icomp)
continue;
/* If the event is TRANSPARENT, skip it. */
- prop = icalcomponent_get_first_property (icalcomp, ICAL_TRANSP_PROPERTY);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_TRANSP_PROPERTY);
if (prop) {
- icalproperty_transp transp_val = icalproperty_get_transp (prop);
- if (transp_val == ICAL_TRANSP_TRANSPARENT ||
- transp_val == ICAL_TRANSP_TRANSPARENTNOCONFLICT)
+ ICalPropertyTransp transp_val = i_cal_property_get_transp (prop);
+
+ g_object_unref (prop);
+
+ if (transp_val == I_CAL_TRANSP_TRANSPARENT ||
+ transp_val == I_CAL_TRANSP_TRANSPARENTNOCONFLICT)
continue;
}
- if (!e_cal_recur_generate_instances_sync (icalcomp,
- icaltime_from_timet_with_zone (start, FALSE, NULL),
- icaltime_from_timet_with_zone (end, FALSE, NULL),
+ starttt = i_cal_time_from_timet_with_zone (start, FALSE, NULL);
+ endtt = i_cal_time_from_timet_with_zone (end, FALSE, NULL);
+
+ success = e_cal_recur_generate_instances_sync (icomp, starttt, endtt,
ecmb_add_free_busy_instance_cb, vfreebusy,
e_cal_cache_resolve_timezone_cb, cal_cache,
- utc_zone, cancellable, error)) {
+ utc_zone, cancellable, error);
+
+ g_clear_object (&starttt);
+ g_clear_object (&endtt);
+
+ if (!success)
break;
- }
}
- *out_freebusy = g_slist_prepend (*out_freebusy, icalcomponent_as_ical_string_r (vfreebusy));
+ *out_freebusy = g_slist_prepend (*out_freebusy, i_cal_component_as_ical_string_r (vfreebusy));
g_slist_free_full (components, g_object_unref);
- icalcomponent_free (vfreebusy);
+ g_object_unref (vfreebusy);
g_object_unref (cal_cache);
g_free (cal_email_address);
}
@@ -1557,21 +1574,21 @@ ecmb_create_object_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- icalcomponent *icalcomp;
- struct icaltimetype itt;
+ ICalComponent *icomp;
+ ICalTimetype *itt;
const gchar *uid;
gchar *new_uid = NULL, *new_extra = NULL;
gboolean success, requires_put = TRUE;
g_return_val_if_fail (comp != NULL, FALSE);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- if (!icalcomp) {
+ icomp = e_cal_component_get_icalcomponent (comp);
+ if (!icomp) {
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
return FALSE;
}
- uid = icalcomponent_get_uid (icalcomp);
+ uid = i_cal_component_get_uid (icomp);
if (!uid) {
gchar *new_uid;
@@ -1581,8 +1598,8 @@ ecmb_create_object_sync (ECalMetaBackend *meta_backend,
return FALSE;
}
- icalcomponent_set_uid (icalcomp, new_uid);
- uid = icalcomponent_get_uid (icalcomp);
+ i_cal_component_set_uid (icomp, new_uid);
+ uid = i_cal_component_get_uid (icomp);
g_free (new_uid);
}
@@ -1593,17 +1610,19 @@ ecmb_create_object_sync (ECalMetaBackend *meta_backend,
}
/* Set the created and last modified times on the component, if not there already */
- itt = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
+ itt = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
- if (!icalcomponent_get_first_property (icalcomp, ICAL_CREATED_PROPERTY)) {
+ if (!e_cal_util_component_has_property (icomp, I_CAL_CREATED_PROPERTY)) {
/* Update both when CREATED is missing, to make sure the LAST-MODIFIED
is not before CREATED */
- e_cal_component_set_created (comp, &itt);
- e_cal_component_set_last_modified (comp, &itt);
- } else if (!icalcomponent_get_first_property (icalcomp, ICAL_LASTMODIFIED_PROPERTY)) {
- e_cal_component_set_last_modified (comp, &itt);
+ e_cal_component_set_created (comp, itt);
+ e_cal_component_set_last_modified (comp, itt);
+ } else if (!e_cal_util_component_has_property (icomp, I_CAL_LASTMODIFIED_PROPERTY)) {
+ e_cal_component_set_last_modified (comp, itt);
}
+ g_clear_object (&itt);
+
if (*offline_flag == E_CACHE_OFFLINE_UNKNOWN) {
if (e_backend_get_online (E_BACKEND (meta_backend)) &&
e_cal_meta_backend_ensure_connected_sync (meta_backend, cancellable, NULL)) {
@@ -1638,7 +1657,7 @@ ecmb_create_object_sync (ECalMetaBackend *meta_backend,
if (success) {
if (out_new_uid)
- *out_new_uid = g_strdup (new_uid ? new_uid : icalcomponent_get_uid
(e_cal_component_get_icalcomponent (comp)));
+ *out_new_uid = g_strdup (new_uid ? new_uid : e_cal_component_get_uid (comp));
if (out_new_comp) {
if (new_uid) {
if (!e_cal_cache_get_component (cal_cache, new_uid, NULL, out_new_comp,
cancellable, NULL))
@@ -1668,7 +1687,7 @@ ecmb_create_objects_sync (ECalBackendSync *sync_backend,
ECalCache *cal_cache;
ECacheOfflineFlag offline_flag = E_CACHE_OFFLINE_UNKNOWN;
EConflictResolution conflict_resolution = E_CONFLICT_RESOLUTION_FAIL;
- icalcomponent_kind backend_kind;
+ ICalComponentKind backend_kind;
GSList *link;
gboolean success = TRUE;
@@ -1698,7 +1717,7 @@ ecmb_create_objects_sync (ECalBackendSync *sync_backend,
comp = e_cal_component_new_from_string (link->data);
if (!comp ||
!e_cal_component_get_icalcomponent (comp) ||
- backend_kind != icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
+ backend_kind != i_cal_component_isa (e_cal_component_get_icalcomponent (comp))) {
g_clear_object (&comp);
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
@@ -1734,7 +1753,7 @@ ecmb_modify_object_sync (ECalMetaBackend *meta_backend,
GCancellable *cancellable,
GError **error)
{
- struct icaltimetype itt;
+ ICalTimetype *itt;
ECalComponentId *id;
ECalComponent *old_comp = NULL, *new_comp = NULL, *master_comp, *existing_comp = NULL;
GSList *instances = NULL;
@@ -1780,14 +1799,16 @@ ecmb_modify_object_sync (ECalMetaBackend *meta_backend,
if (!existing_comp)
existing_comp = master_comp;
- if (!e_cal_cache_get_component_extra (cal_cache, e_cal_component_id_get_uid (id),
e_cal_component_id_get_rid (id), &extra, cancellable, NULL) && id->rid) {
+ if (!e_cal_cache_get_component_extra (cal_cache, e_cal_component_id_get_uid (id),
e_cal_component_id_get_rid (id), &extra, cancellable, NULL) &&
+ e_cal_component_id_get_rid (id)) {
if (!e_cal_cache_get_component_extra (cal_cache, e_cal_component_id_get_uid (id), NULL,
&extra, cancellable, NULL))
extra = NULL;
}
/* Set the last modified time on the component */
- itt = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
- e_cal_component_set_last_modified (comp, &itt);
+ itt = i_cal_time_current_time_with_zone (i_cal_timezone_get_utc_timezone ());
+ e_cal_component_set_last_modified (comp, itt);
+ g_clear_object (&itt);
/* Remember old and new components */
if (out_old_comp && existing_comp)
@@ -1813,7 +1834,7 @@ ecmb_modify_object_sync (ECalMetaBackend *meta_backend,
instances = g_slist_append (instances, e_cal_component_clone (comp));
break;
case E_CAL_OBJ_MOD_ALL:
- e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb, cal_cache);
+ e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb, cal_cache,
cancellable, NULL);
/* Replace master object */
instances = g_slist_remove (instances, master_comp);
@@ -1825,25 +1846,24 @@ ecmb_modify_object_sync (ECalMetaBackend *meta_backend,
case E_CAL_OBJ_MOD_THIS_AND_PRIOR:
case E_CAL_OBJ_MOD_THIS_AND_FUTURE:
if (e_cal_component_is_instance (comp) && master_comp) {
- struct icaltimetype rid, master_dtstart;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
- icalcomponent *split_icalcomp;
- icalproperty *prop;
+ ICalTimetype *rid, *master_dtstart;
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (comp);
+ ICalComponent *split_icomp;
+ ICalProperty *prop;
- rid = icalcomponent_get_recurrenceid (icalcomp);
+ rid = i_cal_component_get_recurrenceid (icomp);
if (mod == E_CAL_OBJ_MOD_THIS_AND_FUTURE &&
- e_cal_util_is_first_instance (master_comp, icalcomponent_get_recurrenceid
(icalcomp),
- e_cal_cache_resolve_timezone_cb, cal_cache)) {
- icalproperty *prop = icalcomponent_get_first_property (icalcomp,
ICAL_RECURRENCEID_PROPERTY);
-
- if (prop)
- icalcomponent_remove_property (icalcomp, prop);
+ e_cal_util_is_first_instance (master_comp, rid, e_cal_cache_resolve_timezone_cb,
cal_cache)) {
+ prop = i_cal_component_get_first_property (icomp,
I_CAL_RECURRENCEID_PROPERTY);
- e_cal_component_rescan (comp);
+ if (prop) {
+ i_cal_component_remove_property (icomp, prop);
+ g_object_unref (prop);
+ }
/* Then do it like for "mod_all" */
- e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb,
cal_cache);
+ e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb,
cal_cache, cancellable, NULL);
/* Replace master */
instances = g_slist_remove (instances, master_comp);
@@ -1856,42 +1876,51 @@ ecmb_modify_object_sync (ECalMetaBackend *meta_backend,
g_clear_object (&new_comp);
new_comp = e_cal_component_clone (comp);
}
+
+ g_clear_object (&rid);
break;
}
- prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
- if (prop)
- icalcomponent_remove_property (icalcomp, prop);
- e_cal_component_rescan (comp);
+ prop = i_cal_component_get_first_property (icomp, I_CAL_RECURRENCEID_PROPERTY);
+ if (prop) {
+ i_cal_component_remove_property (icomp, prop);
+ g_object_unref (prop);
+ }
+
+ master_dtstart = i_cal_component_get_dtstart (e_cal_component_get_icalcomponent
(master_comp));
+ split_icomp = e_cal_util_split_at_instance (icomp, rid, master_dtstart);
+ if (split_icomp) {
+ ICalTimetype *rid_utc;
- master_dtstart = icalcomponent_get_dtstart (e_cal_component_get_icalcomponent
(master_comp));
- split_icalcomp = e_cal_util_split_at_instance (icalcomp, rid, master_dtstart);
- if (split_icalcomp) {
- rid = icaltime_convert_to_zone (rid, icaltimezone_get_utc_timezone ());
- e_cal_util_remove_instances (e_cal_component_get_icalcomponent (master_comp),
rid, mod);
- e_cal_component_rescan (master_comp);
- e_cal_recur_ensure_end_dates (master_comp, TRUE,
e_cal_cache_resolve_timezone_cb, cal_cache);
+ rid_utc = i_cal_time_convert_to_zone (rid, i_cal_timezone_get_utc_timezone
());
+ e_cal_util_remove_instances (e_cal_component_get_icalcomponent (master_comp),
rid_utc, mod);
+ e_cal_recur_ensure_end_dates (master_comp, TRUE,
e_cal_cache_resolve_timezone_cb, cal_cache, cancellable, NULL);
if (out_new_comp) {
g_clear_object (&new_comp);
new_comp = e_cal_component_clone (master_comp);
}
+
+ g_object_unref (rid_utc);
}
- if (split_icalcomp) {
+ if (split_icomp) {
gchar *new_uid;
new_uid = e_util_generate_uid ();
- icalcomponent_set_uid (split_icalcomp, new_uid);
+ i_cal_component_set_uid (split_icomp, new_uid);
g_free (new_uid);
- g_warn_if_fail (e_cal_component_set_icalcomponent (comp, split_icalcomp));
+ g_warn_if_fail (e_cal_component_set_icalcomponent (comp, split_icomp));
- e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb,
cal_cache);
+ e_cal_recur_ensure_end_dates (comp, TRUE, e_cal_cache_resolve_timezone_cb,
cal_cache, cancellable, NULL);
success = ecmb_create_object_sync (meta_backend, cal_cache, offline_flag,
E_CONFLICT_RESOLUTION_FAIL,
comp, NULL, NULL, cancellable, error);
}
+
+ g_clear_object (&master_dtstart);
+ g_clear_object (&rid);
} else {
/* Replace master */
instances = g_slist_remove (instances, master_comp);
@@ -1960,7 +1989,7 @@ ecmb_modify_objects_sync (ECalBackendSync *sync_backend,
ECalCache *cal_cache;
ECacheOfflineFlag offline_flag = E_CACHE_OFFLINE_UNKNOWN;
EConflictResolution conflict_resolution = E_CONFLICT_RESOLUTION_FAIL;
- icalcomponent_kind backend_kind;
+ ICalComponentKind backend_kind;
GSList *link;
gboolean success = TRUE;
@@ -1989,7 +2018,7 @@ ecmb_modify_objects_sync (ECalBackendSync *sync_backend,
comp = e_cal_component_new_from_string (link->data);
if (!comp ||
!e_cal_component_get_icalcomponent (comp) ||
- backend_kind != icalcomponent_isa (e_cal_component_get_icalcomponent (comp))) {
+ backend_kind != i_cal_component_isa (e_cal_component_get_icalcomponent (comp))) {
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
break;
}
@@ -2108,7 +2137,7 @@ ecmb_remove_object_sync (ECalMetaBackend *meta_backend,
dt = e_cal_component_get_dtstart (master_comp);
if (dt && e_cal_component_datetime_get_value (dt) &&
e_cal_component_datetime_get_tzid (dt)) {
- ICalTimezone *zone = e_cal_cache_resolve_timezone_cb
(e_cal_component_datetime_get_tzid (dt), cal_cache);
+ ICalTimezone *zone = e_cal_cache_resolve_timezone_cb
(e_cal_component_datetime_get_tzid (dt), cal_cache, NULL, NULL);
if (zone) {
tmp_itt = i_cal_time_convert_to_zone (itt, zone);
@@ -2124,7 +2153,7 @@ ecmb_remove_object_sync (ECalMetaBackend *meta_backend,
}
if (master_comp)
- e_cal_util_component_remove_instances
(e_cal_component_get_icalcomponent (master_comp), itt, mod);
+ e_cal_util_remove_instances (e_cal_component_get_icalcomponent
(master_comp), itt, mod);
g_clear_object (&itt);
}
@@ -2148,7 +2177,7 @@ ecmb_remove_object_sync (ECalMetaBackend *meta_backend,
dt = e_cal_component_get_dtstart (master_comp);
if (dt && e_cal_component_datetime_get_value (dt) &&
e_cal_component_datetime_get_tzid (dt)) {
- icaltimezone *zone = e_cal_cache_resolve_timezone_cb
(e_cal_component_datetime_get_tzid (dt), cal_cache);
+ ICalTimezone *zone = e_cal_cache_resolve_timezone_cb
(e_cal_component_datetime_get_tzid (dt), cal_cache, NULL, NULL);
if (zone) {
tmp_itt = i_cal_time_convert_to_zone (itt, zone);
@@ -2159,7 +2188,7 @@ ecmb_remove_object_sync (ECalMetaBackend *meta_backend,
e_cal_component_datetime_free (dt);
tmp_itt = i_cal_time_convert_to_zone (itt, i_cal_timezone_get_utc_timezone
());
- g_obejct_unref (itt);
+ g_object_unref (itt);
itt = tmp_itt;
}
@@ -2171,7 +2200,7 @@ ecmb_remove_object_sync (ECalMetaBackend *meta_backend,
for (link = instances; link && fromtt > 0;) {
ECalComponent *comp = link->data;
ECalComponentRange *range;
- ECalComponentDatetime *rangedt;
+ ECalComponentDateTime *rangedt;
if (!e_cal_component_is_instance (comp)) {
previous = link;
@@ -2399,7 +2428,7 @@ ecmb_receive_object_sync (ECalMetaBackend *meta_backend,
ECacheOfflineFlag *offline_flag,
EConflictResolution conflict_resolution,
ECalComponent *comp,
- icalproperty_method method,
+ ICalPropertyMethod method,
GCancellable *cancellable,
GError **error)
{
@@ -2414,7 +2443,7 @@ ecmb_receive_object_sync (ECalMetaBackend *meta_backend,
id = e_cal_component_get_id (comp);
- if (!id && method == ICAL_METHOD_PUBLISH) {
+ if (!id && method == I_CAL_METHOD_PUBLISH) {
gchar *new_uid;
new_uid = e_util_generate_uid ();
@@ -2449,9 +2478,9 @@ ecmb_receive_object_sync (ECalMetaBackend *meta_backend,
mod = e_cal_component_is_instance (comp) ? E_CAL_OBJ_MOD_THIS : E_CAL_OBJ_MOD_ALL;
switch (method) {
- case ICAL_METHOD_PUBLISH:
- case ICAL_METHOD_REQUEST:
- case ICAL_METHOD_REPLY:
+ case I_CAL_METHOD_PUBLISH:
+ case I_CAL_METHOD_REQUEST:
+ case I_CAL_METHOD_REPLY:
is_declined = e_cal_backend_user_declined (registry, e_cal_component_get_icalcomponent
(comp));
if (is_in_cache) {
if (!is_declined) {
@@ -2466,7 +2495,7 @@ ecmb_receive_object_sync (ECalMetaBackend *meta_backend,
comp, NULL, NULL, cancellable, error);
}
break;
- case ICAL_METHOD_CANCEL:
+ case I_CAL_METHOD_CANCEL:
if (is_in_cache) {
success = ecmb_remove_object_sync (meta_backend, cal_cache, offline_flag,
conflict_resolution,
E_CAL_OBJ_MOD_THIS, e_cal_component_id_get_uid (id),
e_cal_component_id_get_rid (id), NULL, NULL, cancellable, error);
@@ -2497,9 +2526,9 @@ ecmb_receive_objects_sync (ECalBackendSync *sync_backend,
EConflictResolution conflict_resolution = E_CONFLICT_RESOLUTION_FAIL;
ECalCache *cal_cache;
ECalComponent *comp;
- icalcomponent *icalcomp, *subcomp;
- icalcomponent_kind kind;
- icalproperty_method top_method;
+ ICalComponent *icomp, *subcomp;
+ ICalComponentKind kind;
+ ICalPropertyMethod top_method;
GSList *comps = NULL, *link;
gboolean success = TRUE;
@@ -2515,8 +2544,8 @@ ecmb_receive_objects_sync (ECalBackendSync *sync_backend,
cal_cache = e_cal_meta_backend_ref_cache (meta_backend);
g_return_if_fail (cal_cache != NULL);
- icalcomp = icalparser_parse_string (calobj);
- if (!icalcomp) {
+ icomp = i_cal_parser_parse_string (calobj);
+ if (!icomp) {
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
g_object_unref (cal_cache);
return;
@@ -2524,17 +2553,17 @@ ecmb_receive_objects_sync (ECalBackendSync *sync_backend,
kind = e_cal_backend_get_kind (E_CAL_BACKEND (meta_backend));
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT) {
- for (subcomp = icalcomponent_get_first_component (icalcomp, kind);
- subcomp && success;
- subcomp = icalcomponent_get_next_component (icalcomp, kind)) {
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (subcomp));
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT) {
+ for (subcomp = i_cal_component_get_first_component (icomp, kind);
+ subcomp;
+ g_object_unref (subcomp), subcomp = i_cal_component_get_next_component (icomp, kind)) {
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (subcomp));
if (comp)
comps = g_slist_prepend (comps, comp);
}
- } else if (icalcomponent_isa (icalcomp) == kind) {
- comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (icalcomp));
+ } else if (i_cal_component_isa (icomp) == kind) {
+ comp = e_cal_component_new_from_icalcomponent (i_cal_component_new_clone (icomp));
if (comp)
comps = g_slist_prepend (comps, comp);
@@ -2542,29 +2571,29 @@ ecmb_receive_objects_sync (ECalBackendSync *sync_backend,
if (!comps) {
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
g_object_unref (cal_cache);
return;
}
comps = g_slist_reverse (comps);
- if (icalcomponent_isa (icalcomp) == ICAL_VCALENDAR_COMPONENT)
- ecmb_gather_timezones (meta_backend, E_TIMEZONE_CACHE (meta_backend), icalcomp);
+ if (i_cal_component_isa (icomp) == I_CAL_VCALENDAR_COMPONENT)
+ ecmb_gather_timezones (meta_backend, E_TIMEZONE_CACHE (meta_backend), icomp);
- if (icalcomponent_get_first_property (icalcomp, ICAL_METHOD_PROPERTY))
- top_method = icalcomponent_get_method (icalcomp);
+ if (e_cal_util_component_has_property (icomp, I_CAL_METHOD_PROPERTY))
+ top_method = i_cal_component_get_method (icomp);
else
- top_method = ICAL_METHOD_PUBLISH;
+ top_method = I_CAL_METHOD_PUBLISH;
for (link = comps; link && success; link = g_slist_next (link)) {
ECalComponent *comp = link->data;
- icalproperty_method method;
+ ICalPropertyMethod method;
subcomp = e_cal_component_get_icalcomponent (comp);
- if (icalcomponent_get_first_property (subcomp, ICAL_METHOD_PROPERTY)) {
- method = icalcomponent_get_method (subcomp);
+ if (e_cal_util_component_has_property (subcomp, I_CAL_METHOD_PROPERTY)) {
+ method = i_cal_component_get_method (subcomp);
} else {
method = top_method;
}
@@ -2574,7 +2603,7 @@ ecmb_receive_objects_sync (ECalBackendSync *sync_backend,
}
g_slist_free_full (comps, g_object_unref);
- icalcomponent_free (icalcomp);
+ g_object_unref (icomp);
g_object_unref (cal_cache);
}
@@ -2600,32 +2629,28 @@ static void
ecmb_add_attachment_uris (ECalComponent *comp,
GSList **out_uris)
{
- icalcomponent *icalcomp;
- icalproperty *prop;
+ ICalComponent *icomp;
+ ICalProperty *prop;
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
g_return_if_fail (out_uris != NULL);
- icalcomp = e_cal_component_get_icalcomponent (comp);
- g_return_if_fail (icalcomp != NULL);
+ icomp = e_cal_component_get_icalcomponent (comp);
+ g_return_if_fail (icomp != NULL);
- for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTACH_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomp, I_CAL_ATTACH_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTACH_PROPERTY)) {
- icalattach *attach = icalproperty_get_attach (prop);
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomp, I_CAL_ATTACH_PROPERTY)) {
+ ICalAttach *attach = i_cal_property_get_attach (prop);
- if (attach && icalattach_get_is_url (attach)) {
+ if (attach && i_cal_attach_get_is_url (attach)) {
const gchar *url;
- url = icalattach_get_url (attach);
+ url = i_cal_attach_get_url (attach);
if (url) {
- gsize buf_size;
gchar *buf;
- buf_size = strlen (url);
- buf = g_malloc0 (buf_size + 1);
-
- icalvalue_decode_ical_string (url, buf, buf_size);
+ buf = i_cal_value_decode_ical_string (url);
*out_uris = g_slist_prepend (*out_uris, g_strdup (buf));
@@ -2719,7 +2744,7 @@ ecmb_get_timezone_sync (ECalBackendSync *sync_backend,
gchar **tzobject,
GError **error)
{
- icaltimezone *zone;
+ ICalTimezone *zone;
gchar *timezone_str = NULL;
GError *local_error = NULL;
@@ -2732,14 +2757,15 @@ ecmb_get_timezone_sync (ECalBackendSync *sync_backend,
zone = e_timezone_cache_get_timezone (E_TIMEZONE_CACHE (sync_backend), tzid);
if (zone) {
- icalcomponent *icalcomp;
+ ICalComponent *icomp;
- icalcomp = icaltimezone_get_component (zone);
+ icomp = i_cal_timezone_get_component (zone);
- if (!icalcomp) {
+ if (!icomp) {
local_error = e_data_cal_create_error (InvalidObject, NULL);
} else {
- timezone_str = icalcomponent_as_ical_string_r (icalcomp);
+ timezone_str = i_cal_component_as_ical_string_r (icomp);
+ g_object_unref (icomp);
}
}
@@ -2759,7 +2785,7 @@ ecmb_add_timezone_sync (ECalBackendSync *sync_backend,
const gchar *tzobject,
GError **error)
{
- icalcomponent *tz_comp;
+ ICalComponent *tz_comp;
g_return_if_fail (E_IS_CAL_META_BACKEND (sync_backend));
@@ -2771,25 +2797,22 @@ ecmb_add_timezone_sync (ECalBackendSync *sync_backend,
return;
}
- tz_comp = icalparser_parse_string (tzobject);
+ tz_comp = i_cal_parser_parse_string (tzobject);
if (!tz_comp ||
- icalcomponent_isa (tz_comp) != ICAL_VTIMEZONE_COMPONENT) {
+ i_cal_component_isa (tz_comp) != I_CAL_VTIMEZONE_COMPONENT) {
g_propagate_error (error, e_data_cal_create_error (InvalidObject, NULL));
} else {
- icaltimezone *zone;
+ ICalTimezone *zone;
- zone = icaltimezone_new ();
- icaltimezone_set_component (zone, tz_comp);
-
- tz_comp = NULL;
+ zone = i_cal_timezone_new ();
+ i_cal_timezone_set_component (zone, tz_comp);
/* Add it only to memory, do not store it persistently into the ECalCache */
e_timezone_cache_add_timezone (E_TIMEZONE_CACHE (sync_backend), zone);
- icaltimezone_free (zone, 1);
+ g_object_unref (zone);
}
- if (tz_comp)
- icalcomponent_free (tz_comp);
+ g_clear_object (&tz_comp);
}
static gchar *
@@ -3131,12 +3154,12 @@ ecmb_maybe_wait_for_credentials (ECalMetaBackend *meta_backend,
return got_credentials;
}
-static icaltimezone *
+static ICalTimezone *
ecmb_get_cached_timezone (ETimezoneCache *cache,
const gchar *tzid)
{
ECalCache *cal_cache;
- icaltimezone *zone;
+ ICalTimezone *zone;
if (ecmb_timezone_cache_parent_get_timezone) {
zone = ecmb_timezone_cache_parent_get_timezone (cache, tzid);
@@ -3659,7 +3682,7 @@ ecmb_cache_revision_changed_cb (ECache *cache,
}
}
-static icaltimezone *
+static ICalTimezone *
ecmb_cache_get_timezone_cb (ECalCache *cal_cache,
const gchar *tzid,
gpointer user_data)
@@ -3772,8 +3795,8 @@ sort_master_first_cb (gconstpointer a,
return 1;
}
- rida = icalcomponent_get_recurrenceid (ca);
- ridb = icalcomponent_get_recurrenceid (cb);
+ rida = i_cal_component_get_recurrenceid (ca);
+ ridb = i_cal_component_get_recurrenceid (cb);
if (!rida || !ridb) {
if (rida == ridb)
@@ -3793,64 +3816,83 @@ sort_master_first_cb (gconstpointer a,
typedef struct {
ETimezoneCache *timezone_cache;
gboolean replace_tzid_with_location;
- icalcomponent *vcalendar;
- icalcomponent *icalcomp;
+ ICalComponent *vcalendar;
+ ICalComponent *icomp;
} ForeachTzidData;
static void
-add_timezone_cb (icalparameter *param,
+add_timezone_cb (ICalParameter *param,
gpointer user_data)
{
- icaltimezone *tz;
+ ICalTimezone *tz;
const gchar *tzid;
- icalcomponent *vtz_comp;
+ ICalComponent *vtz_comp;
ForeachTzidData *f_data = user_data;
- tzid = icalparameter_get_tzid (param);
+ tzid = i_cal_parameter_get_tzid (param);
if (!tzid)
return;
- tz = icalcomponent_get_timezone (f_data->vcalendar, tzid);
- if (tz)
+ tz = i_cal_component_get_timezone (f_data->vcalendar, tzid);
+ if (tz) {
+ g_object_unref (tz);
return;
+ }
- tz = icalcomponent_get_timezone (f_data->icalcomp, tzid);
- if (!tz)
- tz = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (!tz && f_data->timezone_cache)
+ tz = i_cal_component_get_timezone (f_data->icomp, tzid);
+ if (!tz) {
+ tz = i_cal_timezone_get_builtin_timezone_from_tzid (tzid);
+ if (tz)
+ g_object_ref (tz);
+ }
+
+ if (!tz && f_data->timezone_cache) {
tz = e_timezone_cache_get_timezone (f_data->timezone_cache, tzid);
+ if (tz)
+ g_object_ref (tz);
+ }
+
if (!tz)
return;
if (f_data->replace_tzid_with_location) {
const gchar *location;
- location = icaltimezone_get_location (tz);
+ location = i_cal_timezone_get_location (tz);
if (location && *location) {
- icalparameter_set_tzid (param, location);
+ ICalTimezone *existing_tz;
+
+ i_cal_parameter_set_tzid (param, location);
tzid = location;
- if (icalcomponent_get_timezone (f_data->vcalendar, tzid))
+ existing_tz = i_cal_component_get_timezone (f_data->vcalendar, tzid);
+ if (existing_tz) {
+ g_object_unref (existing_tz);
+ g_object_unref (tz);
return;
+ }
}
}
- vtz_comp = icaltimezone_get_component (tz);
+ vtz_comp = i_cal_timezone_get_component (tz);
if (vtz_comp) {
- icalcomponent *clone = icalcomponent_new_clone (vtz_comp);
+ ICalComponent *clone = i_cal_component_new_clone (vtz_comp);
if (f_data->replace_tzid_with_location) {
- icalproperty *prop;
+ ICalProperty *prop;
- prop = icalcomponent_get_first_property (clone, ICAL_TZID_PROPERTY);
+ prop = i_cal_component_get_first_property (clone, I_CAL_TZID_PROPERTY);
if (prop) {
- icalproperty_set_tzid (prop, tzid);
+ i_cal_property_set_tzid (prop, tzid);
+ g_object_unref (prop);
}
}
- icalcomponent_add_component (f_data->vcalendar, clone);
+ i_cal_component_take_component (f_data->vcalendar, clone);
}
+
+ g_object_unref (tz);
}
/**
@@ -3867,21 +3909,21 @@ add_timezone_cb (icalparameter *param,
* Any TZID property parameters can be replaced with corresponding timezone
* location, which will not influence the timezone itself.
*
- * Returns: (transfer full): an #icalcomponent containing a VCALENDAR
+ * Returns: (transfer full): an #ICalComponent containing a VCALENDAR
* component which consists of all the given instances. Free
- * the returned pointer with icalcomponent_free() when no longer needed.
+ * the returned pointer with g_object_unref(), when no longer needed.
*
* See: e_cal_meta_backend_save_component_sync()
*
* Since: 3.26
**/
-icalcomponent *
+ICalComponent *
e_cal_meta_backend_merge_instances (ECalMetaBackend *meta_backend,
const GSList *instances,
gboolean replace_tzid_with_location)
{
ForeachTzidData f_data;
- icalcomponent *vcalendar;
+ ICalComponent *vcalendar;
GSList *link, *sorted;
g_return_val_if_fail (E_IS_CAL_META_BACKEND (meta_backend), NULL);
@@ -3897,19 +3939,16 @@ e_cal_meta_backend_merge_instances (ECalMetaBackend *meta_backend,
for (link = sorted; link; link = g_slist_next (link)) {
ECalComponent *comp = link->data;
- icalcomponent *icalcomp;
if (!E_IS_CAL_COMPONENT (comp)) {
g_warn_if_reached ();
continue;
}
- icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
- icalcomponent_add_component (vcalendar, icalcomp);
+ f_data.icomp = i_cal_component_new_clone (e_cal_component_get_icalcomponent (comp));
- f_data.icalcomp = icalcomp;
-
- icalcomponent_foreach_tzid (icalcomp, add_timezone_cb, &f_data);
+ i_cal_component_foreach_tzid (f_data.icomp, add_timezone_cb, &f_data);
+ i_cal_component_take_component (vcalendar, f_data.icomp);
}
g_slist_free (sorted);
@@ -3918,27 +3957,29 @@ e_cal_meta_backend_merge_instances (ECalMetaBackend *meta_backend,
}
static void
-ecmb_remove_all_but_filename_parameter (icalproperty *prop)
+ecmb_remove_all_but_filename_parameter (ICalProperty *prop)
{
- icalparameter *param;
+ ICalParameter *param;
g_return_if_fail (prop != NULL);
- while (param = icalproperty_get_first_parameter (prop, ICAL_ANY_PARAMETER), param) {
- if (icalparameter_isa (param) == ICAL_FILENAME_PARAMETER) {
- param = icalproperty_get_next_parameter (prop, ICAL_ANY_PARAMETER);
+ while (param = i_cal_property_get_first_parameter (prop, I_CAL_ANY_PARAMETER), param) {
+ if (i_cal_parameter_isa (param) == I_CAL_FILENAME_PARAMETER) {
+ g_object_unref (param);
+ param = i_cal_property_get_next_parameter (prop, I_CAL_ANY_PARAMETER);
if (!param)
break;
}
- icalproperty_remove_parameter_by_ref (prop, param);
+ i_cal_property_remove_parameter_by_ref (prop, param);
+ g_object_unref (param);
}
}
/**
* e_cal_meta_backend_inline_local_attachments_sync:
* @meta_backend: an #ECalMetaBackend
- * @component: an icalcomponent to work with
+ * @component: an #ICalComponent to work with
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
@@ -3955,29 +3996,29 @@ ecmb_remove_all_but_filename_parameter (icalproperty *prop)
**/
gboolean
e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error)
{
- icalproperty *prop;
+ ICalProperty *prop;
const gchar *uid;
gboolean success = TRUE;
g_return_val_if_fail (E_IS_CAL_META_BACKEND (meta_backend), FALSE);
g_return_val_if_fail (component != NULL, FALSE);
- uid = icalcomponent_get_uid (component);
+ uid = i_cal_component_get_uid (component);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTACH_PROPERTY);
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTACH_PROPERTY);
prop && success;
- prop = icalcomponent_get_next_property (component, ICAL_ATTACH_PROPERTY)) {
- icalattach *attach;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTACH_PROPERTY)) {
+ ICalAttach *attach;
- attach = icalproperty_get_attach (prop);
- if (icalattach_get_is_url (attach)) {
+ attach = i_cal_property_get_attach (prop);
+ if (i_cal_attach_get_is_url (attach)) {
const gchar *url;
- url = icalattach_get_url (attach);
+ url = i_cal_attach_get_url (attach);
if (g_str_has_prefix (url, LOCAL_PREFIX)) {
GFile *file;
gchar *basename;
@@ -3987,28 +4028,28 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
file = g_file_new_for_uri (url);
basename = g_file_get_basename (file);
if (g_file_load_contents (file, cancellable, &content, &len, NULL, error)) {
- icalattach *new_attach;
- icalparameter *param;
+ ICalAttach *new_attach;
+ ICalParameter *param;
gchar *base64;
base64 = g_base64_encode ((const guchar *) content, len);
- new_attach = icalattach_new_from_data (base64, NULL, NULL);
+ new_attach = i_cal_attach_new_from_data (base64, NULL, NULL);
g_free (content);
g_free (base64);
ecmb_remove_all_but_filename_parameter (prop);
- icalproperty_set_attach (prop, new_attach);
- icalattach_unref (new_attach);
+ i_cal_property_set_attach (prop, new_attach);
+ g_object_unref (new_attach);
- param = icalparameter_new_value (ICAL_VALUE_BINARY);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_value (I_CAL_VALUE_BINARY);
+ i_cal_property_take_parameter (prop, param);
- param = icalparameter_new_encoding (ICAL_ENCODING_BASE64);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_encoding (I_CAL_ENCODING_BASE64);
+ i_cal_property_take_parameter (prop, param);
/* Preserve existing FILENAME parameter */
- if (!icalproperty_get_first_parameter (prop,
ICAL_FILENAME_PARAMETER)) {
+ if (!e_cal_util_property_has_parameter (prop,
I_CAL_FILENAME_PARAMETER)) {
const gchar *use_filename = basename;
/* generated filename by Evolution */
@@ -4017,8 +4058,8 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
use_filename += strlen (uid) + 1;
}
- param = icalparameter_new_filename (use_filename);
- icalproperty_add_parameter (prop, param);
+ param = i_cal_parameter_new_filename (use_filename);
+ i_cal_property_take_parameter (prop, param);
}
} else {
success = FALSE;
@@ -4028,15 +4069,19 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
g_free (basename);
}
}
+
+ g_clear_object (&attach);
}
+ g_clear_object (&prop);
+
return success;
}
/**
* e_cal_meta_backend_store_inline_attachments_sync:
* @meta_backend: an #ECalMetaBackend
- * @component: an icalcomponent to work with
+ * @component: an #ICalComponent to work with
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
*
@@ -4053,55 +4098,58 @@ e_cal_meta_backend_inline_local_attachments_sync (ECalMetaBackend *meta_backend,
**/
gboolean
e_cal_meta_backend_store_inline_attachments_sync (ECalMetaBackend *meta_backend,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error)
{
gint fileindex;
- icalproperty *prop;
+ ICalProperty *prop;
gboolean success = TRUE;
g_return_val_if_fail (E_IS_CAL_META_BACKEND (meta_backend), FALSE);
g_return_val_if_fail (component != NULL, FALSE);
- for (prop = icalcomponent_get_first_property (component, ICAL_ATTACH_PROPERTY), fileindex = 0;
+ for (prop = i_cal_component_get_first_property (component, I_CAL_ATTACH_PROPERTY), fileindex = 0;
prop && success;
- prop = icalcomponent_get_next_property (component, ICAL_ATTACH_PROPERTY), fileindex++) {
- icalattach *attach;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (component,
I_CAL_ATTACH_PROPERTY), fileindex++) {
+ ICalAttach *attach;
+
+ attach = i_cal_property_get_attach (prop);
- attach = icalproperty_get_attach (prop);
- if (!icalattach_get_is_url (attach)) {
- icalparameter *param;
+ if (!i_cal_attach_get_is_url (attach)) {
+ ICalParameter *param;
const gchar *basename;
gsize len = -1;
gchar *decoded = NULL;
gchar *local_filename;
- param = icalproperty_get_first_parameter (prop, ICAL_FILENAME_PARAMETER);
- basename = param ? icalparameter_get_filename (param) : NULL;
+ param = i_cal_property_get_first_parameter (prop, I_CAL_FILENAME_PARAMETER);
+ basename = param ? i_cal_parameter_get_filename (param) : NULL;
if (!basename || !*basename)
basename = _("attachment.dat");
- local_filename = e_cal_backend_create_cache_filename (E_CAL_BACKEND (meta_backend),
icalcomponent_get_uid (component), basename, fileindex);
+ local_filename = e_cal_backend_create_cache_filename (E_CAL_BACKEND (meta_backend),
i_cal_component_get_uid (component), basename, fileindex);
+
+ g_clear_object (¶m);
if (local_filename) {
const gchar *content;
- content = (const gchar *) icalattach_get_data (attach);
+ content = (const gchar *) i_cal_attach_get_data (attach);
decoded = (gchar *) g_base64_decode (content, &len);
if (g_file_set_contents (local_filename, decoded, len, error)) {
- icalattach *new_attach;
+ ICalAttach *new_attach;
gchar *url;
ecmb_remove_all_but_filename_parameter (prop);
url = g_filename_to_uri (local_filename, NULL, NULL);
- new_attach = icalattach_new_from_url (url);
+ new_attach = i_cal_attach_new_from_url (url);
- icalproperty_set_attach (prop, new_attach);
+ i_cal_property_set_attach (prop, new_attach);
- icalattach_unref (new_attach);
+ g_object_unref (new_attach);
g_free (url);
} else {
success = FALSE;
@@ -4112,15 +4160,19 @@ e_cal_meta_backend_store_inline_attachments_sync (ECalMetaBackend *meta_backend,
g_free (local_filename);
}
+
+ g_clear_object (&attach);
}
+ g_clear_object (&prop);
+
return success;
}
/**
* e_cal_meta_backend_gather_timezones_sync:
* @meta_backend: an #ECalMetaBackend
- * @vcalendar: a VCALENDAR icalcomponent
+ * @vcalendar: a VCALENDAR #ICalComponent
* @remove_existing: whether to remove any existing first
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
@@ -4139,7 +4191,7 @@ e_cal_meta_backend_store_inline_attachments_sync (ECalMetaBackend *meta_backend,
**/
gboolean
e_cal_meta_backend_gather_timezones_sync (ECalMetaBackend *meta_backend,
- icalcomponent *vcalendar,
+ ICalComponent *vcalendar,
gboolean remove_existing,
GCancellable *cancellable,
GError **error)
@@ -4150,7 +4202,7 @@ e_cal_meta_backend_gather_timezones_sync (ECalMetaBackend *meta_backend,
g_return_val_if_fail (E_IS_CAL_META_BACKEND (meta_backend), FALSE);
g_return_val_if_fail (vcalendar != NULL, FALSE);
- if (icalcomponent_isa (vcalendar) != ICAL_VCALENDAR_COMPONENT)
+ if (i_cal_component_isa (vcalendar) != I_CAL_VCALENDAR_COMPONENT)
return TRUE;
cal_cache = e_cal_meta_backend_ref_cache (meta_backend);
@@ -4395,7 +4447,7 @@ e_cal_meta_backend_ensure_connected_sync (ECalMetaBackend *meta_backend,
/**
* e_cal_meta_backend_split_changes_sync:
* @meta_backend: an #ECalMetaBackend
- * @objects: (inout caller-allocates) (element-type ECalMetaBackendInfo):
+ * @objects: (inout) (element-type ECalMetaBackendInfo):
* a #GSList of #ECalMetaBackendInfo object infos to split
* @out_created_objects: (out) (element-type ECalMetaBackendInfo) (transfer full):
* a #GSList of #ECalMetaBackendInfo object infos which had been created
@@ -4943,7 +4995,7 @@ e_cal_meta_backend_list_existing_sync (ECalMetaBackend *meta_backend,
* @meta_backend: an #ECalMetaBackend
* @uid: a component UID
* @extra: (nullable): optional extra data stored with the component, or %NULL
- * @out_component: (out) (transfer full): a loaded component, as icalcomponent
+ * @out_component: (out) (transfer full): a loaded component, as #ICalComponent
* @out_extra: (out) (transfer full): an extra data to store to #ECalCache with this component
* @cancellable: optional #GCancellable object, or %NULL
* @error: return location for a #GError, or %NULL
@@ -4956,7 +5008,7 @@ e_cal_meta_backend_list_existing_sync (ECalMetaBackend *meta_backend,
*
* It is mandatory to implement this virtual method by the descendant.
*
- * The returned @out_component should be freed with icalcomponent_free(),
+ * The returned @out_component should be freed with g_object_unref(),
* when no longer needed.
*
* The returned @out_extra should be freed with g_free(), when no longer
@@ -4970,7 +5022,7 @@ gboolean
e_cal_meta_backend_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)
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.h b/src/calendar/libedata-cal/e-cal-meta-backend.h
index 4318e151d..8480a1609 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.h
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.h
@@ -127,7 +127,7 @@ struct _ECalMetaBackendClass {
gboolean (* 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);
@@ -190,23 +190,23 @@ gchar * e_cal_meta_backend_dup_sync_tag (ECalMetaBackend *meta_backend);
void e_cal_meta_backend_set_cache (ECalMetaBackend *meta_backend,
ECalCache *cache);
ECalCache * e_cal_meta_backend_ref_cache (ECalMetaBackend *meta_backend);
-icalcomponent * e_cal_meta_backend_merge_instances
+ICalComponent * e_cal_meta_backend_merge_instances
(ECalMetaBackend *meta_backend,
const GSList *instances, /* ECalComponent * */
gboolean replace_tzid_with_location);
gboolean e_cal_meta_backend_inline_local_attachments_sync
(ECalMetaBackend *meta_backend,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error);
gboolean e_cal_meta_backend_store_inline_attachments_sync
(ECalMetaBackend *meta_backend,
- icalcomponent *component,
+ ICalComponent *component,
GCancellable *cancellable,
GError **error);
gboolean e_cal_meta_backend_gather_timezones_sync
(ECalMetaBackend *meta_backend,
- icalcomponent *vcalendar,
+ ICalComponent *vcalendar,
gboolean remove_existing,
GCancellable *cancellable,
GError **error);
@@ -270,7 +270,7 @@ gboolean e_cal_meta_backend_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);
diff --git a/src/calendar/libedata-cal/e-data-cal-factory.c b/src/calendar/libedata-cal/e-data-cal-factory.c
index a0ace0a98..5a4de310a 100644
--- a/src/calendar/libedata-cal/e-data-cal-factory.c
+++ b/src/calendar/libedata-cal/e-data-cal-factory.c
@@ -364,7 +364,7 @@ e_data_cal_factory_new (gint backend_per_process,
GCancellable *cancellable,
GError **error)
{
- ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
+ i_cal_set_unknown_token_handling_setting (I_CAL_DISCARD_TOKEN);
return g_initable_new (E_TYPE_DATA_CAL_FACTORY, cancellable, error,
"reload-supported", TRUE,
diff --git a/src/calendar/libedata-cal/e-data-cal-view.c b/src/calendar/libedata-cal/e-data-cal-view.c
index d5fbec71c..5888e74c1 100644
--- a/src/calendar/libedata-cal/e-data-cal-view.c
+++ b/src/calendar/libedata-cal/e-data-cal-view.c
@@ -1029,7 +1029,7 @@ e_data_cal_view_get_flags (EDataCalView *view)
}
static gboolean
-filter_component (icalcomponent *icomponent,
+filter_component (ICalComponent *icomponent,
GHashTable *fields_of_interest,
GString *string)
{
@@ -1038,10 +1038,10 @@ filter_component (icalcomponent *icomponent,
/* RFC 2445 explicitly says that the newline is *ALWAYS* a \r\n (CRLF)!!!! */
const gchar newline[] = "\r\n";
- icalcomponent_kind kind;
+ ICalComponentKind kind;
const gchar *kind_string;
- icalproperty *prop;
- icalcomponent *icomp;
+ ICalProperty *prop;
+ ICalComponent *icomp;
gboolean fail = FALSE;
g_return_val_if_fail (icomponent != NULL, FALSE);
@@ -1049,29 +1049,29 @@ filter_component (icalcomponent *icomponent,
/* Open iCalendar string */
g_string_append (string, "BEGIN:");
- kind = icalcomponent_isa (icomponent);
+ kind = i_cal_component_isa (icomponent);
- /* if (kind != ICAL_X_COMPONENT) { */
- /* kind_string = icalcomponent_kind_to_string (kind); */
+ /* if (kind != I_CAL_X_COMPONENT) { */
+ /* kind_string = i_cal_component_kind_to_string (kind); */
/* } else { */
/* kind_string = icomponent->x_name; */
/* } */
- kind_string = icalcomponent_kind_to_string (kind);
+ kind_string = i_cal_component_kind_to_string (kind);
g_string_append (string, kind_string);
g_string_append (string, newline);
- for (prop = icalcomponent_get_first_property (icomponent, ICAL_ANY_PROPERTY);
+ for (prop = i_cal_component_get_first_property (icomponent, I_CAL_ANY_PROPERTY);
prop;
- prop = icalcomponent_get_next_property (icomponent, ICAL_ANY_PROPERTY)) {
- const gchar *name;
- gboolean is_field_of_interest;
+ g_object_unref (prop), prop = i_cal_component_get_next_property (icomponent,
I_CAL_ANY_PROPERTY)) {
+ gchar *name;
+ gboolean is_field_of_interest;
- name = icalproperty_get_property_name (prop);
+ name = i_cal_property_get_property_name_r (prop);
if (!name) {
- g_warning ("NULL ical property name encountered while serializing component");
+ g_warning ("NULL iCal property name encountered while serializing component");
fail = TRUE;
break;
}
@@ -1080,15 +1080,17 @@ filter_component (icalcomponent *icomponent,
/* Append any name that is mentioned in the fields-of-interest */
if (is_field_of_interest) {
- str = icalproperty_as_ical_string_r (prop);
+ str = i_cal_property_as_ical_string_r (prop);
g_string_append (string, str);
g_free (str);
}
+
+ g_free (name);
}
- for (icomp = icalcomponent_get_first_component (icomponent, ICAL_ANY_COMPONENT);
+ for (icomp = i_cal_component_get_first_component (icomponent, I_CAL_ANY_COMPONENT);
fail == FALSE && icomp;
- icomp = icalcomponent_get_next_component (icomponent, ICAL_ANY_COMPONENT)) {
+ g_object_unref (icomp), icomp = i_cal_component_get_next_component (icomponent,
I_CAL_ANY_COMPONENT)) {
if (!filter_component (icomp, fields_of_interest, string)) {
fail = TRUE;
@@ -1096,8 +1098,10 @@ filter_component (icalcomponent *icomponent,
}
}
+ g_clear_object (&icomp);
+
g_string_append (string, "END:");
- g_string_append (string, icalcomponent_kind_to_string (kind));
+ g_string_append (string, i_cal_component_kind_to_string (kind));
g_string_append (string, newline);
return fail == FALSE;
@@ -1128,9 +1132,9 @@ e_data_cal_view_get_component_string (EDataCalView *view,
if (view->priv->fields_of_interest) {
GString *string = g_string_new ("");
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (component);
+ ICalComponent *icomp = e_cal_component_get_icalcomponent (component);
- if (filter_component (icalcomp, view->priv->fields_of_interest, string))
+ if (filter_component (icomp, view->priv->fields_of_interest, string))
str = g_string_free (string, FALSE);
else
g_string_free (string, TRUE);
@@ -1150,12 +1154,12 @@ e_data_cal_view_get_component_string (EDataCalView *view,
/**
* e_data_cal_view_notify_components_added:
* @view: an #EDataCalView
- * @ecalcomponents: List of #ECalComponent-s that have been added.
+ * @ecalcomponents: (element-type ECalComponent): List of #ECalComponent-s that have been added.
*
* Notifies all view listeners of the addition of a list of components.
*
* Uses the #EDataCalView's fields-of-interest to filter out unwanted
- * information from ical strings sent over the bus.
+ * information from iCalendar strings sent over the bus.
*
* Since: 3.4
*/
@@ -1191,7 +1195,7 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
* Notifies all the view listeners of the addition of a single object.
*
* Uses the #EDataCalView's fields-of-interest to filter out unwanted
- * information from ical strings sent over the bus.
+ * information from iCalendar strings sent over the bus.
*
* Since: 3.4
*/
@@ -1216,7 +1220,7 @@ e_data_cal_view_notify_components_added_1 (EDataCalView *view,
* Notifies all view listeners of the modification of a list of components.
*
* Uses the #EDataCalView's fields-of-interest to filter out unwanted
- * information from ical strings sent over the bus.
+ * information from iCalendar strings sent over the bus.
*
* Since: 3.4
*/
@@ -1252,7 +1256,7 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
* Notifies all view listeners of the modification of @component.
*
* Uses the #EDataCalView's fields-of-interest to filter out unwanted
- * information from ical strings sent over the bus.
+ * information from iCalendar strings sent over the bus.
*
* Since: 3.4
*/
diff --git a/src/calendar/libedata-cal/e-data-cal.c b/src/calendar/libedata-cal/e-data-cal.c
index 957bf03b8..f913dd6f7 100644
--- a/src/calendar/libedata-cal/e-data-cal.c
+++ b/src/calendar/libedata-cal/e-data-cal.c
@@ -26,7 +26,6 @@
#include "evolution-data-server-config.h"
-#include <libical-glib/libical-glib.h>
#include <glib/gi18n-lib.h>
#include <unistd.h>
@@ -1999,7 +1998,7 @@ e_data_cal_respond_modify_objects (EDataCal *cal,
* @cal: A calendar client interface.
* @opid: associated operation id
* @error: Operation error, if any, automatically freed if passed it.
- * @ids: (element-type: utf8) IDs of the removed objects.
+ * @ids: (element-type utf8): IDs of the removed objects.
* @old_components: (element-type ECalComponent): The old #ECalComponent(s).
* @new_components: (element-type ECalComponent): The new #ECalComponent(s).
* They will not be NULL only when removing instances of recurring appointments.
diff --git a/src/calendar/libedata-cal/e-subprocess-cal-factory.c
b/src/calendar/libedata-cal/e-subprocess-cal-factory.c
index 40a4329e9..22fb66059 100644
--- a/src/calendar/libedata-cal/e-subprocess-cal-factory.c
+++ b/src/calendar/libedata-cal/e-subprocess-cal-factory.c
@@ -137,7 +137,7 @@ ESubprocessCalFactory *
e_subprocess_cal_factory_new (GCancellable *cancellable,
GError **error)
{
- ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
+ i_cal_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
return g_initable_new (
E_TYPE_SUBPROCESS_CAL_FACTORY,
diff --git a/src/services/evolution-alarm-notify/e-alarm-notify.c
b/src/services/evolution-alarm-notify/e-alarm-notify.c
index fe842d606..6f4e25b28 100644
--- a/src/services/evolution-alarm-notify/e-alarm-notify.c
+++ b/src/services/evolution-alarm-notify/e-alarm-notify.c
@@ -99,19 +99,22 @@ e_alarm_notify_audio (EAlarmNotify *an,
const EReminderData *rd,
ECalComponentAlarm *alarm)
{
- icalattach *attach = NULL;
+ ICalAttach *attach = NULL;
+ GSList *attachments;
gboolean did_play = FALSE;
g_return_val_if_fail (an != NULL, FALSE);
g_return_val_if_fail (rd != NULL, FALSE);
g_return_val_if_fail (alarm != NULL, FALSE);
- e_cal_component_alarm_get_attach (alarm, &attach);
+ attachments = e_cal_component_alarm_get_attachments (alarm);
+ if (attachments && !attachments->next)
+ attach = attachments->data;
- if (attach && icalattach_get_is_url (attach)) {
+ if (attach && i_cal_attach_get_is_url (attach)) {
const gchar *url;
- url = icalattach_get_url (attach);
+ url = i_cal_attach_get_url (attach);
if (url && *url) {
gchar *filename;
GError *error = NULL;
@@ -136,8 +139,7 @@ e_alarm_notify_audio (EAlarmNotify *an,
if (!did_play)
gdk_beep ();
- if (attach)
- icalattach_unref (attach);
+ g_slist_free_full (attachments, g_object_unref);
return FALSE;
}
@@ -185,7 +187,7 @@ e_alarm_notify_build_notif_id (const EReminderData *rd)
g_string_append (string, "\n");
}
- id = e_cal_component_get_id (e_reminder_data_get_source_uid (component));
+ id = e_cal_component_get_id (e_reminder_data_get_component (rd));
if (id) {
if (e_cal_component_id_get_uid (id)) {
g_string_append (string, e_cal_component_id_get_uid (id));
@@ -408,8 +410,9 @@ e_alarm_notify_procedure (EAlarmNotify *an,
const EReminderData *rd,
ECalComponentAlarm *alarm)
{
- ECalComponentText description;
- icalattach *attach;
+ ECalComponentText *description;
+ ICalAttach *attach = NULL;
+ GSList *attachments;
const gchar *url;
gchar *cmd;
gboolean result = FALSE;
@@ -418,24 +421,27 @@ e_alarm_notify_procedure (EAlarmNotify *an,
g_return_val_if_fail (rd != NULL, FALSE);
g_return_val_if_fail (alarm != NULL, FALSE);
- e_cal_component_alarm_get_attach (alarm, &attach);
- e_cal_component_alarm_get_description (alarm, &description);
+ attachments = e_cal_component_alarm_get_attachments (alarm);
+
+ if (attachments && !attachments->next)
+ attach = attachments->data;
+
+ description = e_cal_component_alarm_get_description (alarm);
/* If the alarm has no attachment, simply display a notification dialog. */
if (!attach)
goto fallback;
- if (!icalattach_get_is_url (attach)) {
- icalattach_unref (attach);
+ if (!i_cal_attach_get_is_url (attach)) {
goto fallback;
}
- url = icalattach_get_url (attach);
+ url = i_cal_attach_get_url (attach);
g_return_val_if_fail (url != NULL, FALSE);
/* Ask for confirmation before executing the stuff */
- if (description.value)
- cmd = g_strconcat (url, " ", description.value, NULL);
+ if (description && e_cal_component_text_get_value (description))
+ cmd = g_strconcat (url, " ", e_cal_component_text_get_value (description), NULL);
else
cmd = (gchar *) url;
@@ -445,15 +451,17 @@ e_alarm_notify_procedure (EAlarmNotify *an,
if (cmd != (gchar *) url)
g_free (cmd);
- icalattach_unref (attach);
-
/* Fall back to display notification if we got an error */
if (!result)
goto fallback;
+ g_slist_free_full (attachments, g_object_unref);
+
return FALSE;
fallback:
+ g_slist_free_full (attachments, g_object_unref);
+
return e_alarm_notify_display (an, rd, alarm);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]