[evolution-data-server] Bug #664572 - Change e_cal_backend_notify_component* to use ECalComponent
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #664572 - Change e_cal_backend_notify_component* to use ECalComponent
- Date: Thu, 24 Nov 2011 11:02:59 +0000 (UTC)
commit 95d7fe1d4d8748fee96e152830a0dad2a1c0d4d9
Author: Milan Crha <mcrha redhat com>
Date: Thu Nov 24 12:02:30 2011 +0100
Bug #664572 - Change e_cal_backend_notify_component* to use ECalComponent
calendar/backends/caldav/e-cal-backend-caldav.c | 159 +++++------
.../backends/contacts/e-cal-backend-contacts.c | 75 +++---
calendar/backends/file/e-cal-backend-file.c | 303 +++++++-------------
calendar/backends/http/e-cal-backend-http.c | 45 ++--
calendar/backends/weather/e-cal-backend-weather.c | 42 +--
calendar/libecal/e-cal-component.c | 26 ++-
calendar/libecal/e-cal-component.h | 1 +
calendar/libedata-cal/e-cal-backend-sync.c | 32 +-
calendar/libedata-cal/e-cal-backend-sync.h | 12 +-
calendar/libedata-cal/e-cal-backend.c | 150 +++-------
calendar/libedata-cal/e-cal-backend.h | 18 +-
calendar/libedata-cal/e-data-cal-view.c | 81 +++---
calendar/libedata-cal/e-data-cal-view.h | 13 +-
calendar/libedata-cal/e-data-cal.c | 26 +-
calendar/libedata-cal/e-data-cal.h | 6 +-
configure.ac | 2 +-
16 files changed, 423 insertions(+), 568 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 1fe45be..83b0dca 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1770,11 +1770,7 @@ remove_complist_from_cache_and_notify_cb (gpointer key,
}
if (e_cal_backend_store_remove_component (priv->store, id->uid, id->rid)) {
- gchar *old_str = e_cal_component_get_as_string (old_comp);
-
- e_cal_backend_notify_object_removed ((ECalBackend *) cbdav, id, old_str, NULL);
-
- g_free (old_str);
+ e_cal_backend_notify_component_removed ((ECalBackend *) cbdav, id, old_comp, NULL);
}
e_cal_component_free_id (id);
@@ -2039,19 +2035,9 @@ synchronize_cache (ECalBackendCalDAV *cbdav,
put_component_to_store (cbdav, new_comp);
if (old_comp == NULL) {
- gchar *new_str = e_cal_component_get_as_string (new_comp);
-
- e_cal_backend_notify_object_created (bkend, new_str);
-
- g_free (new_str);
+ e_cal_backend_notify_component_created (bkend, new_comp);
} else {
- gchar *new_str = e_cal_component_get_as_string (new_comp);
- gchar *old_str = e_cal_component_get_as_string (old_comp);
-
- e_cal_backend_notify_object_modified (bkend, old_str, new_str);
-
- g_free (new_str);
- g_free (old_str);
+ e_cal_backend_notify_component_modified (bkend, old_comp, new_comp);
ccl->slist = g_slist_remove (ccl->slist, old_comp);
g_object_unref (old_comp);
@@ -3523,12 +3509,43 @@ replace_master (ECalBackendCalDAV *cbdav,
return old_comp;
}
+/* the resulting component should be unreffed when done with it;
+ the fallback_comp is cloned, if used */
+static ECalComponent *
+get_ecalcomp_master_from_cache_or_fallback (ECalBackendCalDAV *cbdav,
+ const gchar *uid,
+ const gchar *rid,
+ ECalComponent *fallback_comp)
+{
+ ECalComponent *comp = NULL;
+ icalcomponent *icalcomp;
+
+ g_return_val_if_fail (cbdav != NULL, NULL);
+ g_return_val_if_fail (uid != NULL, NULL);
+
+ icalcomp = get_comp_from_cache (cbdav, uid, rid, NULL, NULL);
+ if (icalcomp) {
+ icalcomponent *master = get_master_comp (cbdav, icalcomp);
+
+ if (master) {
+ comp = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (master));
+ }
+
+ icalcomponent_free (icalcomp);
+ }
+
+ if (!comp && fallback_comp)
+ comp = e_cal_component_clone (fallback_comp);
+
+ return comp;
+}
+
/* a busy_lock is supposed to be locked already, when calling this function */
static void
do_create_object (ECalBackendCalDAV *cbdav,
const gchar *in_calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **perror)
{
ECalComponent *comp;
@@ -3605,22 +3622,8 @@ do_create_object (ECalBackendCalDAV *cbdav,
if (uid)
*uid = g_strdup (comp_uid);
- icalcomp = get_comp_from_cache (cbdav, comp_uid, NULL, NULL, NULL);
-
- if (icalcomp) {
- icalcomponent *master = get_master_comp (cbdav, icalcomp);
-
- if (!master)
- *new_component =
- icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
- else
- *new_component = icalcomponent_new_clone (master);
-
- icalcomponent_free (icalcomp);
- } else {
- *new_component =
- icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
- }
+ if (new_component)
+ *new_component = get_ecalcomp_master_from_cache_or_fallback (cbdav, comp_uid, NULL, comp);
}
g_object_unref (comp);
@@ -3631,8 +3634,8 @@ static void
do_modify_object (ECalBackendCalDAV *cbdav,
const gchar *calobj,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **new_component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **error)
{
ECalBackendCalDAVPrivate *priv;
@@ -3701,9 +3704,7 @@ do_modify_object (ECalBackendCalDAV *cbdav,
/* This will give a reference to 'old_component' */
if (old_instance) {
- *old_component =
- icalcomponent_new_clone (e_cal_component_get_icalcomponent
- (old_instance));
+ *old_component = e_cal_component_clone (old_instance);
g_object_unref (old_instance);
}
}
@@ -3711,9 +3712,10 @@ do_modify_object (ECalBackendCalDAV *cbdav,
if (!*old_component) {
icalcomponent *master = get_master_comp (cbdav, cache_comp);
- if (master)
- /* set full component as the old object */
- *old_component = icalcomponent_new_clone (master);
+ if (master) {
+ /* set full component as the old object */
+ *old_component = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (master));
+ }
}
}
@@ -3725,7 +3727,7 @@ do_modify_object (ECalBackendCalDAV *cbdav,
/* new object is only this instance */
if (new_component)
- *new_component = icalcomponent_new_clone (new_comp);
+ *new_component = e_cal_component_clone (comp);
/* add the detached instance */
if (icalcomponent_isa (cache_comp) == ICAL_VCALENDAR_COMPONENT) {
@@ -3781,18 +3783,9 @@ do_modify_object (ECalBackendCalDAV *cbdav,
if (did_put) {
if (new_component && !*new_component) {
/* read the comp from cache again, as some servers can modify it on put */
- icalcomponent *newcomp = get_comp_from_cache (cbdav, id->uid, NULL, NULL, NULL), *master;
+ *new_component = get_ecalcomp_master_from_cache_or_fallback (cbdav, id->uid, id->rid, NULL);
- if (!newcomp)
- newcomp = cache_comp;
-
- master = get_master_comp (cbdav, newcomp);
-
- if (master)
- *new_component = icalcomponent_new_clone (master);
-
- if (cache_comp != newcomp)
- icalcomponent_free (newcomp);
+ g_warn_if_fail (*new_component != NULL);
}
}
@@ -3809,8 +3802,8 @@ do_remove_object (ECalBackendCalDAV *cbdav,
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **perror)
{
ECalBackendCalDAVPrivate *priv;
@@ -3820,8 +3813,8 @@ do_remove_object (ECalBackendCalDAV *cbdav,
priv = cbdav->priv;
- if (component)
- *component = NULL;
+ if (new_component)
+ *new_component = NULL;
if (!check_state (cbdav, &online, perror))
return;
@@ -3837,14 +3830,14 @@ do_remove_object (ECalBackendCalDAV *cbdav,
ECalComponent *old = e_cal_backend_store_get_component (priv->store, uid, rid);
if (old) {
- *old_component =
- icalcomponent_new_clone (e_cal_component_get_icalcomponent (old));
+ *old_component = e_cal_component_clone (old);
g_object_unref (old);
} else {
icalcomponent *master = get_master_comp (cbdav, cache_comp);
- if (master)
- *old_component = icalcomponent_new_clone (master);
+ if (master) {
+ *old_component = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (master));
+ }
}
}
@@ -3854,11 +3847,11 @@ do_remove_object (ECalBackendCalDAV *cbdav,
if (rid && *rid) {
/* remove one instance from the component */
if (remove_instance (cbdav, cache_comp, icaltime_from_string (rid), mod, mod != CALOBJ_MOD_ONLY_THIS)) {
- if (component) {
+ if (new_component) {
icalcomponent *master = get_master_comp (cbdav, cache_comp);
if (master)
- *component = icalcomponent_new_clone (master);
+ *new_component = e_cal_component_new_from_icalcomponent (icalcomponent_new_clone (master));
}
} else {
/* this was the last instance, thus delete whole component */
@@ -4018,7 +4011,7 @@ process_object (ECalBackendCalDAV *cbdav,
is_declined = e_cal_backend_user_declined (e_cal_component_get_icalcomponent (ecomp));
if (is_in_cache) {
if (!is_declined) {
- icalcomponent *new_component = NULL, *old_component = NULL;
+ ECalComponent *new_component = NULL, *old_component = NULL;
do_modify_object (cbdav, new_obj_str, mod,
&old_component, &new_component, &err);
@@ -4030,11 +4023,11 @@ process_object (ECalBackendCalDAV *cbdav,
}
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
} else {
- icalcomponent *new_component = NULL, *old_component = NULL;
+ ECalComponent *new_component = NULL, *old_component = NULL;
do_remove_object (cbdav, id->uid, id->rid, mod, &old_component, &new_component, &err);
if (!err) {
@@ -4046,12 +4039,12 @@ process_object (ECalBackendCalDAV *cbdav,
}
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
}
} else if (!is_declined) {
- icalcomponent *new_component = NULL;
+ ECalComponent *new_component = NULL;
do_create_object (cbdav, new_obj_str, NULL, &new_component, &err);
@@ -4060,13 +4053,13 @@ process_object (ECalBackendCalDAV *cbdav,
}
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
}
break;
case ICAL_METHOD_CANCEL:
if (is_in_cache) {
- icalcomponent *new_component = NULL, *old_component = NULL;
+ ECalComponent *new_component = NULL, *old_component = NULL;
do_remove_object (cbdav, id->uid, id->rid, CALOBJ_MOD_THIS, &old_component, &new_component, &err);
if (!err) {
@@ -4078,9 +4071,9 @@ process_object (ECalBackendCalDAV *cbdav,
}
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
} else {
err = EDC_ERROR (ObjectNotFound);
}
@@ -4207,7 +4200,7 @@ caldav_busy_stub (
GCancellable *cancellable,
const gchar *in_calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **perror),
do_create_object,
(cbdav,
@@ -4223,8 +4216,8 @@ caldav_busy_stub (
GCancellable *cancellable,
const gchar *calobj,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **new_component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **perror),
do_modify_object,
(cbdav,
@@ -4242,8 +4235,8 @@ caldav_busy_stub (
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **perror),
do_remove_object,
(cbdav,
@@ -4251,7 +4244,7 @@ caldav_busy_stub (
rid,
mod,
old_component,
- component,
+ new_component,
perror))
caldav_busy_stub (
@@ -4446,9 +4439,7 @@ caldav_start_view (ECalBackend *backend,
if (!do_search ||
e_cal_backend_sexp_match_comp (sexp, comp, bkend)) {
- gchar *str = e_cal_component_get_as_string (comp);
- e_data_cal_view_notify_objects_added_1 (query, str);
- g_free (str);
+ e_data_cal_view_notify_components_added_1 (query, comp);
}
g_object_unref (comp);
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index c4f1a79..dff1004 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -199,7 +199,6 @@ contact_record_new (ECalBackendContacts *cbc,
EContact *contact)
{
ContactRecord *cr = g_new0 (ContactRecord, 1);
- gchar *comp_str;
cr->cbc = cbc;
cr->book_client = book_client;
@@ -207,17 +206,11 @@ contact_record_new (ECalBackendContacts *cbc,
cr->comp_birthday = create_birthday (cbc, contact);
cr->comp_anniversary = create_anniversary (cbc, contact);
- if (cr->comp_birthday) {
- comp_str = e_cal_component_get_as_string (cr->comp_birthday);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbc), comp_str);
- g_free (comp_str);
- }
+ if (cr->comp_birthday)
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (cbc), cr->comp_birthday);
- if (cr->comp_anniversary) {
- comp_str = e_cal_component_get_as_string (cr->comp_anniversary);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbc), comp_str);
- g_free (comp_str);
- }
+ if (cr->comp_anniversary)
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (cbc), cr->comp_anniversary);
g_object_ref (G_OBJECT (contact));
@@ -227,31 +220,26 @@ contact_record_new (ECalBackendContacts *cbc,
static void
contact_record_free (ContactRecord *cr)
{
- gchar *comp_str;
ECalComponentId *id;
g_object_unref (G_OBJECT (cr->contact));
/* Remove the birthday event */
if (cr->comp_birthday) {
- comp_str = e_cal_component_get_as_string (cr->comp_birthday);
id = e_cal_component_get_id (cr->comp_birthday);
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), id, comp_str, NULL);
+ e_cal_backend_notify_component_removed (E_CAL_BACKEND (cr->cbc), id, cr->comp_birthday, NULL);
e_cal_component_free_id (id);
- g_free (comp_str);
g_object_unref (G_OBJECT (cr->comp_birthday));
}
/* Remove the anniversary event */
if (cr->comp_anniversary) {
- comp_str = e_cal_component_get_as_string (cr->comp_anniversary);
id = e_cal_component_get_id (cr->comp_anniversary);
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), id, comp_str, NULL);
+ e_cal_backend_notify_component_removed (E_CAL_BACKEND (cr->cbc), id, cr->comp_anniversary, NULL);
e_cal_component_free_id (id);
- g_free (comp_str);
g_object_unref (G_OBJECT (cr->comp_anniversary));
}
@@ -262,17 +250,20 @@ contact_record_free (ContactRecord *cr)
typedef struct _ContactRecordCB {
ECalBackendContacts *cbc;
ECalBackendSExp *sexp;
+ gboolean as_string;
GSList *result;
} ContactRecordCB;
static ContactRecordCB *
contact_record_cb_new (ECalBackendContacts *cbc,
- ECalBackendSExp *sexp)
+ ECalBackendSExp *sexp,
+ gboolean as_string)
{
ContactRecordCB *cb_data = g_new (ContactRecordCB, 1);
cb_data->cbc = cbc;
cb_data->sexp = sexp;
+ cb_data->as_string = as_string;
cb_data->result = NULL;
return cb_data;
@@ -281,7 +272,8 @@ contact_record_cb_new (ECalBackendContacts *cbc,
static void
contact_record_cb_free (ContactRecordCB *cb_data)
{
- g_slist_foreach (cb_data->result, (GFunc) g_free, NULL);
+ if (cb_data->as_string)
+ g_slist_foreach (cb_data->result, (GFunc) g_free, NULL);
g_slist_free (cb_data->result);
g_free (cb_data);
@@ -294,15 +286,24 @@ contact_record_cb (gpointer key,
{
ContactRecordCB *cb_data = user_data;
ContactRecord *record = value;
+ gpointer data;
if (record->comp_birthday && e_cal_backend_sexp_match_comp (cb_data->sexp, record->comp_birthday, E_CAL_BACKEND (cb_data->cbc))) {
- gchar * comp_str = e_cal_component_get_as_string (record->comp_birthday);
- cb_data->result = g_slist_append (cb_data->result, comp_str);
+ if (cb_data->as_string)
+ data = e_cal_component_get_as_string (record->comp_birthday);
+ else
+ data = record->comp_birthday;
+
+ cb_data->result = g_slist_prepend (cb_data->result, data);
}
if (record->comp_anniversary && e_cal_backend_sexp_match_comp (cb_data->sexp, record->comp_anniversary, E_CAL_BACKEND (cb_data->cbc))) {
- gchar * comp_str = e_cal_component_get_as_string (record->comp_anniversary);
- cb_data->result = g_slist_append (cb_data->result, comp_str);
+ if (cb_data->as_string)
+ data = e_cal_component_get_as_string (record->comp_anniversary);
+ else
+ data = record->comp_anniversary;
+
+ cb_data->result = g_slist_prepend (cb_data->result, data);
}
}
@@ -537,21 +538,25 @@ static void
manage_comp_alarm_update (ECalBackendContacts *cbc,
ECalComponent *comp)
{
- gchar *old_comp, *new_comp;
+ gchar *old_comp_str, *new_comp_str;
+ ECalComponent *old_comp;
g_return_if_fail (cbc != NULL);
g_return_if_fail (comp != NULL);
- old_comp = e_cal_component_get_as_string (comp);
+ old_comp = e_cal_component_clone (comp);
setup_alarm (cbc, comp);
- new_comp = e_cal_component_get_as_string (comp);
+
+ old_comp_str = e_cal_component_get_as_string (old_comp);
+ new_comp_str = e_cal_component_get_as_string (comp);
/* check if component changed and notify if so */
- if (old_comp && new_comp && !g_str_equal (old_comp, new_comp))
- e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbc), old_comp, new_comp);
+ if (old_comp_str && new_comp_str && !g_str_equal (old_comp_str, new_comp_str))
+ e_cal_backend_notify_component_modified (E_CAL_BACKEND (cbc), old_comp, comp);
- g_free (old_comp);
- g_free (new_comp);
+ g_free (old_comp_str);
+ g_free (new_comp_str);
+ g_object_unref (old_comp);
}
static void
@@ -1125,7 +1130,7 @@ e_cal_backend_contacts_get_object_list (ECalBackendSync *backend,
return;
}
- cb_data = contact_record_cb_new (cbc, sexp);
+ cb_data = contact_record_cb_new (cbc, sexp, TRUE);
g_hash_table_foreach (priv->tracked_contacts, contact_record_cb, cb_data);
*objects = cb_data->result;
@@ -1151,10 +1156,10 @@ e_cal_backend_contacts_start_view (ECalBackend *backend,
return;
}
- cb_data = contact_record_cb_new (cbc, sexp);
+ cb_data = contact_record_cb_new (cbc, sexp, FALSE);
g_hash_table_foreach (priv->tracked_contacts, contact_record_cb, cb_data);
- e_data_cal_view_notify_objects_added (query, cb_data->result);
+ e_data_cal_view_notify_components_added (query, cb_data->result);
contact_record_cb_free (cb_data);
@@ -1264,7 +1269,7 @@ e_cal_backend_contacts_create_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **perror)
{
g_propagate_error (perror, EDC_ERROR (PermissionDenied));
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 03c38d9..cc2a908 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -1145,29 +1145,18 @@ notify_removals_cb (gpointer key,
ECalBackendFileObject *old_obj_data = value;
if (!g_hash_table_lookup (context->new_uid_hash, uid)) {
- icalcomponent *old_icomp;
- gchar *old_obj_str;
- ECalComponent *comp;
ECalComponentId *id;
/* Object was removed */
- old_icomp = e_cal_component_get_icalcomponent (old_obj_data->full_object);
- if (!old_icomp)
- return;
-
- old_obj_str = icalcomponent_as_ical_string_r (old_icomp);
- if (!old_obj_str)
+ if (!old_obj_data->full_object)
return;
- comp = e_cal_component_new_from_string (old_obj_str);
- id = e_cal_component_get_id (comp);
+ id = e_cal_component_get_id (old_obj_data->full_object);
- e_cal_backend_notify_object_removed (context->backend, id, old_obj_str, NULL);
+ e_cal_backend_notify_component_removed (context->backend, id, old_obj_data->full_object, NULL);
e_cal_component_free_id (id);
- g_free (old_obj_str);
- g_object_unref (comp);
}
}
@@ -1180,37 +1169,31 @@ notify_adds_modifies_cb (gpointer key,
const gchar *uid = key;
ECalBackendFileObject *new_obj_data = value;
ECalBackendFileObject *old_obj_data;
- icalcomponent *old_icomp, *new_icomp;
- gchar *old_obj_str, *new_obj_str;
old_obj_data = g_hash_table_lookup (context->old_uid_hash, uid);
if (!old_obj_data) {
/* Object was added */
-
- new_icomp = e_cal_component_get_icalcomponent (new_obj_data->full_object);
- if (!new_icomp)
+ if (!new_obj_data->full_object)
return;
- e_cal_backend_notify_component_created (context->backend, new_icomp);
+ e_cal_backend_notify_component_created (context->backend, new_obj_data->full_object);
} else {
- old_icomp = e_cal_component_get_icalcomponent (old_obj_data->full_object);
- new_icomp = e_cal_component_get_icalcomponent (new_obj_data->full_object);
- if (!old_icomp || !new_icomp)
+ gchar *old_obj_str, *new_obj_str;
+
+ if (!old_obj_data->full_object || !new_obj_data->full_object)
return;
/* There should be better ways to compare an icalcomponent
* than serializing and comparing the strings...
*/
- old_obj_str = icalcomponent_as_ical_string_r (old_icomp);
- new_obj_str = icalcomponent_as_ical_string_r (new_icomp);
- if (!old_obj_str || !new_obj_str)
- return;
-
- if (strcmp (old_obj_str, new_obj_str)) {
+ old_obj_str = e_cal_component_get_as_string (old_obj_data->full_object);
+ new_obj_str = e_cal_component_get_as_string (new_obj_data->full_object);
+ if (old_obj_str && new_obj_str && strcmp (old_obj_str, new_obj_str) != 0) {
/* Object was modified */
- e_cal_backend_notify_component_modified (context->backend, old_icomp, new_icomp);
+ e_cal_backend_notify_component_modified (context->backend, old_obj_data->full_object, new_obj_data->full_object);
}
+
g_free (old_obj_str);
g_free (new_obj_str);
}
@@ -1678,29 +1661,15 @@ e_cal_backend_file_add_timezone (ECalBackendSync *backend,
}
typedef struct {
- GSList *obj_list;
+ GSList *comps_list;
gboolean search_needed;
const gchar *query;
ECalBackendSExp *obj_sexp;
ECalBackend *backend;
EDataCalView *view;
+ gboolean as_string;
} MatchObjectData;
-static GSList *
-prepend_component (GSList *list,
- MatchObjectData *match_data,
- icalcomponent *icalcomp)
-{
- gchar *str;
-
- if (match_data->view)
- str = e_data_cal_view_get_component_string (match_data->view, icalcomp);
- else
- str = icalcomponent_as_ical_string_r (icalcomp);
-
- return g_slist_prepend (list, str);
-}
-
static void
match_object_sexp_to_component (gpointer value,
gpointer data)
@@ -1710,7 +1679,6 @@ match_object_sexp_to_component (gpointer value,
const gchar *uid;
ECalBackendFile *cbfile;
ECalBackendFilePrivate *priv;
- icalcomponent *icalcomp;
e_cal_component_get_uid (comp, &uid);
@@ -1724,11 +1692,12 @@ match_object_sexp_to_component (gpointer value,
g_return_if_fail (priv != NULL);
- icalcomp = e_cal_component_get_icalcomponent (comp);
-
if ((!match_data->search_needed) ||
(e_cal_backend_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
- match_data->obj_list = prepend_component (match_data->obj_list, match_data, icalcomp);
+ if (match_data->as_string)
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, e_cal_component_get_as_string (comp));
+ else
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, comp);
}
}
@@ -1738,14 +1707,14 @@ match_recurrence_sexp (gpointer key,
gpointer data)
{
ECalComponent *comp = value;
- icalcomponent *icalcomp;
MatchObjectData *match_data = data;
- icalcomp = e_cal_component_get_icalcomponent (comp);
-
if ((!match_data->search_needed) ||
(e_cal_backend_sexp_match_comp (match_data->obj_sexp, comp, match_data->backend))) {
- match_data->obj_list = prepend_component (match_data->obj_list, match_data, icalcomp);
+ if (match_data->as_string)
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, e_cal_component_get_as_string (comp));
+ else
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, comp);
}
}
@@ -1762,10 +1731,10 @@ match_object_sexp (gpointer key,
(e_cal_backend_sexp_match_comp (match_data->obj_sexp,
obj_data->full_object,
match_data->backend))) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
-
- match_data->obj_list = prepend_component (match_data->obj_list, match_data, icalcomp);
+ if (match_data->as_string)
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, e_cal_component_get_as_string (obj_data->full_object));
+ else
+ match_data->comps_list = g_slist_prepend (match_data->comps_list, obj_data->full_object);
}
}
@@ -1797,7 +1766,8 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend,
match_data.search_needed = TRUE;
match_data.query = sexp;
- match_data.obj_list = NULL;
+ match_data.comps_list = NULL;
+ match_data.as_string = TRUE;
match_data.backend = E_CAL_BACKEND (backend);
if (!strcmp (sexp, "#t"))
@@ -1830,7 +1800,7 @@ e_cal_backend_file_get_object_list (ECalBackendSync *backend,
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
- *objects = g_slist_reverse (match_data.obj_list);
+ *objects = g_slist_reverse (match_data.comps_list);
if (objs_occuring_in_tw) {
g_list_foreach (objs_occuring_in_tw, (GFunc) g_object_unref, NULL);
@@ -1983,7 +1953,8 @@ e_cal_backend_file_start_view (ECalBackend *backend,
/* try to match all currently existing objects */
match_data.search_needed = TRUE;
match_data.query = e_data_cal_view_get_text (query);
- match_data.obj_list = NULL;
+ match_data.comps_list = NULL;
+ match_data.as_string = FALSE;
match_data.backend = backend;
match_data.obj_sexp = e_data_cal_view_get_object_sexp (query);
match_data.view = query;
@@ -2029,14 +2000,13 @@ e_cal_backend_file_start_view (ECalBackend *backend,
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
/* notify listeners of all objects */
- if (match_data.obj_list) {
- match_data.obj_list = g_slist_reverse (match_data.obj_list);
+ if (match_data.comps_list) {
+ match_data.comps_list = g_slist_reverse (match_data.comps_list);
- e_data_cal_view_notify_objects_added (query, match_data.obj_list);
+ e_data_cal_view_notify_components_added (query, match_data.comps_list);
/* free memory */
- g_slist_foreach (match_data.obj_list, (GFunc) g_free, NULL);
- g_slist_free (match_data.obj_list);
+ g_slist_free (match_data.comps_list);
}
if (objs_occuring_in_tw) {
@@ -2293,7 +2263,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *in_calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **error)
{
ECalBackendFile *cbfile;
@@ -2375,7 +2345,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend,
if (uid)
*uid = g_strdup (comp_uid);
- *new_component = icalcomponent_new_clone (icalcomp);
+ *new_component = e_cal_component_clone (comp);
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
}
@@ -2422,8 +2392,8 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **new_component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **error)
{
RemoveRecurrenceData rrdata;
@@ -2498,9 +2468,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
case CALOBJ_MOD_THIS :
if (!rid || !*rid) {
if (old_component && obj_data->full_object) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (obj_data->full_object);
}
/* replace only the full object */
@@ -2522,9 +2490,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
save (cbfile, TRUE);
if (new_component) {
- icalcomponent *new_icalcomp =
- e_cal_component_get_icalcomponent (comp);
- *new_component = icalcomponent_new_clone (new_icalcomp);
+ *new_component = e_cal_component_clone (comp);
}
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
@@ -2534,9 +2500,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
if (g_hash_table_lookup_extended (obj_data->recurrences, rid, (gpointer *) &real_rid, (gpointer *) &recurrence)) {
if (old_component) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (recurrence);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (recurrence);
}
/* remove the component from our data */
@@ -2562,9 +2526,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
if (!rid || !*rid) {
if (old_component && obj_data->full_object) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (obj_data->full_object);
}
remove_component (cbfile, comp_uid, obj_data);
@@ -2588,9 +2550,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
(gpointer *) &real_rid, (gpointer *) &recurrence)) {
if (old_component) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (recurrence);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (recurrence);
}
/* remove the component from our data */
@@ -2602,9 +2562,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
} else {
if (old_component && obj_data->full_object) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (obj_data->full_object);
}
}
@@ -2636,9 +2594,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
case CALOBJ_MOD_ALL :
/* Remove the old version */
if (old_component && obj_data->full_object) {
- icalcomponent *old_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *old_component = icalcomponent_new_clone (old_icalcomp);
+ *old_component = e_cal_component_clone (obj_data->full_object);
}
if (obj_data->recurrences_list) {
@@ -2676,7 +2632,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
}
break;
case CALOBJ_MOD_ONLY_THIS:
- // not reached, keep compiler happy
+ /* not reached, keep compiler happy */
break;
}
@@ -2684,9 +2640,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend,
g_free (rid);
if (new_component) {
- icalcomponent *new_icalcomp =
- e_cal_component_get_icalcomponent (comp);
- *new_component = icalcomponent_new_clone (new_icalcomp);
+ *new_component = e_cal_component_clone (comp);
}
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
@@ -2712,8 +2666,8 @@ remove_instance (ECalBackendFile *cbfile,
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_comp,
+ ECalComponent **new_comp,
GError **error)
{
gchar *hash_rid;
@@ -2730,12 +2684,9 @@ remove_instance (ECalBackendFile *cbfile,
(gpointer *) &hash_rid, (gpointer *) &comp)) {
/* Removing without parent or not modifying parent?
* Report removal to caller. */
- if (old_component &&
+ if (old_comp &&
(!obj_data->full_object || mod == CALOBJ_MOD_ONLY_THIS)) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (comp);
-
- *old_component = icalcomponent_new_clone (icalcomp);
+ *old_comp = e_cal_component_clone (comp);
}
/* Reporting parent modification to caller?
@@ -2748,7 +2699,7 @@ remove_instance (ECalBackendFile *cbfile,
ECalComponentId id;
id.uid = (gchar *) uid;
id.rid = (gchar *) rid;
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbfile), &id, NULL, NULL);
+ e_cal_backend_notify_component_removed (E_CAL_BACKEND (cbfile), &id, NULL, NULL);
}
/* remove the component from our data */
@@ -2785,11 +2736,8 @@ remove_instance (ECalBackendFile *cbfile,
cbfile->priv->comp = g_list_remove (cbfile->priv->comp, obj_data->full_object);
/* add EXDATE or EXRULE to parent, report as update */
- if (old_component) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
-
- *old_component = icalcomponent_new_clone (icalcomp);
+ if (old_comp) {
+ *old_comp = e_cal_component_clone (obj_data->full_object);
}
e_cal_util_remove_instances (e_cal_component_get_icalcomponent (obj_data->full_object),
@@ -2801,11 +2749,8 @@ remove_instance (ECalBackendFile *cbfile,
e_cal_component_set_last_modified (obj_data->full_object, ¤t);
/* report update */
- if (component) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
-
- *component = icalcomponent_new_clone (icalcomp);
+ if (new_comp) {
+ *new_comp = e_cal_component_clone (obj_data->full_object);
}
/* add the modified object to the beginning of the list,
@@ -2835,11 +2780,8 @@ remove_instance (ECalBackendFile *cbfile,
cbfile->priv->comp = g_list_remove (cbfile->priv->comp, obj_data->full_object);
/* remove parent, report as removal */
- if (old_component) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
-
- *old_component = icalcomponent_new_clone (icalcomp);
+ if (old_comp) {
+ *old_comp = g_object_ref (obj_data->full_object);
}
g_object_unref (obj_data->full_object);
obj_data->full_object = NULL;
@@ -2855,31 +2797,26 @@ remove_instance (ECalBackendFile *cbfile,
return obj_data;
}
-static icalcomponent *
-clone_icalcomp_from_fileobject (ECalBackendFileObject *obj_data,
+static ECalComponent *
+clone_ecalcomp_from_fileobject (ECalBackendFileObject *obj_data,
const gchar *rid)
{
ECalComponent *comp = obj_data->full_object;
- icalcomponent *icalcomp = NULL;
gchar *real_rid;
if (!comp)
return NULL;
- if (!rid) {
- icalcomp = e_cal_component_get_icalcomponent (comp);
- } else {
- if (g_hash_table_lookup_extended (obj_data->recurrences, rid,
- (gpointer *) &real_rid, (gpointer *) &comp))
- icalcomp = e_cal_component_get_icalcomponent (comp);
- else {
+ if (rid) {
+ if (!g_hash_table_lookup_extended (obj_data->recurrences, rid,
+ (gpointer *) &real_rid, (gpointer *) &comp)) {
/* FIXME remove this once we delete an instance from master object through
* modify request by setting exception */
- icalcomp = e_cal_component_get_icalcomponent (comp);
+ comp = obj_data->full_object;
}
}
- return icalcomp ? icalcomponent_new_clone (icalcomp) : NULL;
+ return comp ? e_cal_component_clone (comp) : NULL;
}
static void
@@ -2889,7 +2826,6 @@ notify_comp_removed_cb (gpointer pecalcomp,
ECalComponent *comp = pecalcomp;
ECalBackend *backend = pbackend;
ECalComponentId *id;
- gchar *compstr;
g_return_if_fail (comp != NULL);
g_return_if_fail (backend != NULL);
@@ -2897,12 +2833,9 @@ notify_comp_removed_cb (gpointer pecalcomp,
id = e_cal_component_get_id (comp);
g_return_if_fail (id != NULL);
- compstr = e_cal_component_get_as_string (comp);
-
- e_cal_backend_notify_object_removed (backend, id, compstr, NULL);
+ e_cal_backend_notify_component_removed (backend, id, comp, NULL);
e_cal_component_free_id (id);
- g_free (compstr);
}
/* Remove_object handler for the file backend */
@@ -2913,8 +2846,8 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **error)
{
ECalBackendFile *cbfile;
@@ -2942,7 +2875,7 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
return;
}
- *old_component = *component = NULL;
+ *old_component = *new_component = NULL;
g_static_rec_mutex_lock (&priv->idle_save_rmutex);
@@ -2958,17 +2891,17 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
switch (mod) {
case CALOBJ_MOD_ALL :
- *old_component = clone_icalcomp_from_fileobject (obj_data, recur_id);
+ *old_component = clone_ecalcomp_from_fileobject (obj_data, recur_id);
if (obj_data->recurrences_list)
g_list_foreach (obj_data->recurrences_list, notify_comp_removed_cb, cbfile);
remove_component (cbfile, uid, obj_data);
- *component = NULL;
+ *new_component = NULL;
break;
case CALOBJ_MOD_ONLY_THIS:
case CALOBJ_MOD_THIS :
obj_data = remove_instance (cbfile, obj_data, uid, recur_id, mod,
- old_component, component, error);
+ old_component, new_component, error);
break;
case CALOBJ_MOD_THISANDPRIOR :
case CALOBJ_MOD_THISANDFUTURE :
@@ -2981,9 +2914,7 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
}
if (comp) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (comp);
- *old_component = icalcomponent_new_clone (icalcomp);
+ *old_component = e_cal_component_clone (comp);
/* remove the component from our data, temporarily */
icalcomponent_remove_component (priv->icalcomp,
@@ -3008,10 +2939,7 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
priv->comp = g_list_prepend (priv->comp, comp);
if (obj_data->full_object) {
- icalcomponent *icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
-
- *component = icalcomponent_new_clone (icalcomp);
+ *new_component = e_cal_component_clone (obj_data->full_object);
}
break;
}
@@ -3023,20 +2951,21 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend,
static gboolean
cancel_received_object (ECalBackendFile *cbfile,
- icalcomponent *icalcomp,
- icalcomponent **old_icalcomp,
- icalcomponent **new_icalcomp)
+ ECalComponent *comp,
+ ECalComponent **old_comp,
+ ECalComponent **new_comp)
{
ECalBackendFileObject *obj_data;
ECalBackendFilePrivate *priv;
gchar *rid;
- ECalComponent *comp;
- const gchar *uid = icalcomponent_get_uid (icalcomp);
+ const gchar *uid = NULL;
priv = cbfile->priv;
- *old_icalcomp = NULL;
- *new_icalcomp = NULL;
+ *old_comp = NULL;
+ *new_comp = NULL;
+
+ e_cal_component_get_uid (comp, &uid);
/* Find the old version of the component. */
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
@@ -3044,27 +2973,17 @@ cancel_received_object (ECalBackendFile *cbfile,
return FALSE;
/* And remove it */
- comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp))) {
- g_object_unref (comp);
- return FALSE;
- }
-
rid = e_cal_component_get_recurid_as_string (comp);
if (rid && *rid) {
obj_data = remove_instance (cbfile, obj_data, uid, rid, CALOBJ_MOD_THIS,
- old_icalcomp, new_icalcomp, NULL);
- if (obj_data && obj_data->full_object) {
- icalcomponent *tmp_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *new_icalcomp = icalcomponent_new_clone (tmp_icalcomp);
+ old_comp, new_comp, NULL);
+ if (obj_data && obj_data->full_object && !*new_comp) {
+ *new_comp = e_cal_component_clone (obj_data->full_object);
}
} else {
/* report as removal by keeping *new_component NULL */
if (obj_data->full_object) {
- icalcomponent *tmp_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- *old_icalcomp = icalcomponent_new_clone (tmp_icalcomp);
+ *old_comp = e_cal_component_clone (obj_data->full_object);
}
remove_component (cbfile, uid, obj_data);
}
@@ -3264,8 +3183,8 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
/* Now we manipulate the components we care about */
for (l = comps; l; l = l->next) {
- icalcomponent *old_component = NULL;
- icalcomponent *component = NULL;
+ ECalComponent *old_component = NULL;
+ ECalComponent *new_component = NULL;
const gchar *uid;
gchar *rid;
ECalBackendFileObject *obj_data;
@@ -3303,18 +3222,16 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
if (obj_data) {
if (rid) {
- icalcomponent *ignore_icalcomp = NULL;
+ ECalComponent *ignore_comp = NULL;
remove_instance (cbfile, obj_data, uid, rid, CALOBJ_MOD_THIS,
- &old_component, &ignore_icalcomp, NULL);
+ &old_component, &ignore_comp, NULL);
- if (ignore_icalcomp)
- icalcomponent_free (ignore_icalcomp);
+ if (ignore_comp)
+ g_object_unref (ignore_comp);
} else {
if (obj_data->full_object) {
- icalcomponent *full_icalcomp =
- e_cal_component_get_icalcomponent (obj_data->full_object);
- old_component = icalcomponent_new_clone (full_icalcomp);
+ old_component = e_cal_component_clone (obj_data->full_object);
}
remove_component (cbfile, uid, obj_data);
}
@@ -3322,31 +3239,26 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
if (!is_declined)
add_component (cbfile, comp, FALSE);
- component = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
if (!is_declined)
e_cal_backend_notify_component_modified (E_CAL_BACKEND (backend),
- old_component, component);
+ old_component, comp);
else {
ECalComponentId *id = e_cal_component_get_id (comp);
e_cal_backend_notify_component_removed (E_CAL_BACKEND (backend),
id, old_component,
- rid ? component : NULL);
+ rid ? comp : NULL);
e_cal_component_free_id (id);
}
- if (component)
- icalcomponent_free (component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
} else if (!is_declined) {
add_component (cbfile, comp, FALSE);
- component = e_cal_component_get_icalcomponent (comp);
-
- e_cal_backend_notify_component_created (E_CAL_BACKEND (backend), component);
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (backend), comp);
}
g_free (rid);
break;
@@ -3367,25 +3279,23 @@ e_cal_backend_file_receive_objects (ECalBackendSync *backend,
goto error;
break;
case ICAL_METHOD_CANCEL:
- old_component = NULL;
- component = NULL;
- if (cancel_received_object (cbfile, subcomp, &old_component, &component)) {
+ if (cancel_received_object (cbfile, comp, &old_component, &new_component)) {
ECalComponentId *id;
id = e_cal_component_get_id (comp);
e_cal_backend_notify_component_removed (E_CAL_BACKEND (backend),
- id, old_component, component);
+ id, old_component, new_component);
/* remove the component from the toplevel VCALENDAR */
icalcomponent_remove_component (toplevel_comp, subcomp);
icalcomponent_free (subcomp);
e_cal_component_free_id (id);
- if (component)
- icalcomponent_free (component);
+ if (new_component)
+ g_object_unref (new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
}
g_free (rid);
break;
@@ -3665,7 +3575,8 @@ test_query_by_scanning_all_objects (ECalBackendFile *cbfile,
match_data.search_needed = TRUE;
match_data.query = sexp;
- match_data.obj_list = NULL;
+ match_data.comps_list = NULL;
+ match_data.as_string = TRUE;
match_data.backend = E_CAL_BACKEND (cbfile);
if (!strcmp (sexp, "#t"))
@@ -3688,7 +3599,7 @@ test_query_by_scanning_all_objects (ECalBackendFile *cbfile,
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
- *objects = g_slist_reverse (match_data.obj_list);
+ *objects = g_slist_reverse (match_data.comps_list);
g_object_unref (match_data.obj_sexp);
}
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 0c73c7a..ad9721e 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -216,7 +216,7 @@ notify_and_remove_from_cache (gpointer key,
ECalComponentId *id = e_cal_component_get_id (comp);
e_cal_backend_store_remove_component (cbhttp->priv->store, id->uid, id->rid);
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), id, calobj, NULL);
+ e_cal_backend_notify_component_removed (E_CAL_BACKEND (cbhttp), id, comp, NULL);
e_cal_component_free_id (id);
g_object_unref (comp);
@@ -238,16 +238,13 @@ empty_cache (ECalBackendHttp *cbhttp)
comps = e_cal_backend_store_get_components (priv->store);
for (l = comps; l != NULL; l = g_slist_next (l)) {
- gchar *comp_str;
ECalComponentId *id;
ECalComponent *comp = l->data;
id = e_cal_component_get_id (comp);
- comp_str = e_cal_component_get_as_string (comp);
- e_cal_backend_notify_object_removed ((ECalBackend *) cbhttp, id, comp_str, NULL);
+ e_cal_backend_notify_component_removed ((ECalBackend *) cbhttp, id, comp, NULL);
- g_free (comp_str);
e_cal_component_free_id (id);
g_object_unref (comp);
}
@@ -497,21 +494,21 @@ retrieval_done (SoupSession *session,
if (e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp))) {
const gchar *uid;
gpointer orig_key, orig_value;
- gchar *obj;
e_cal_component_get_uid (comp, &uid);
if (!put_component_to_store (cbhttp, comp)) {
g_hash_table_remove (old_cache, uid);
} else if (g_hash_table_lookup_extended (old_cache, uid, &orig_key, &orig_value)) {
- obj = icalcomponent_as_ical_string_r (subcomp);
- e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbhttp), (const gchar *) orig_value, obj);
- g_free (obj);
+ ECalComponent *orig_comp = e_cal_component_new_from_string (orig_value);
+
+ e_cal_backend_notify_component_modified (E_CAL_BACKEND (cbhttp), orig_comp, comp);
+
g_hash_table_remove (old_cache, uid);
+ if (orig_comp)
+ g_object_unref (orig_comp);
} else {
- obj = icalcomponent_as_ical_string_r (subcomp);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbhttp), obj);
- g_free (obj);
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (cbhttp), comp);
}
}
@@ -1059,16 +1056,16 @@ e_cal_backend_http_start_view (ECalBackend *backend,
: e_cal_backend_store_get_components (priv->store);
for (l = components; l != NULL; l = g_slist_next (l)) {
- if (e_cal_backend_sexp_match_comp (cbsexp, E_CAL_COMPONENT (l->data), E_CAL_BACKEND (backend))) {
- objects = g_slist_append (objects, e_cal_component_get_as_string (l->data));
+ ECalComponent *comp = l->data;
+
+ if (e_cal_backend_sexp_match_comp (cbsexp, comp, E_CAL_BACKEND (backend))) {
+ objects = g_slist_append (objects, comp);
}
}
- e_data_cal_view_notify_objects_added (query, objects);
+ e_data_cal_view_notify_components_added (query, objects);
- g_slist_foreach (components, (GFunc) g_object_unref, NULL);
- g_slist_free (components);
- g_slist_foreach (objects, (GFunc) g_free, NULL);
+ g_slist_free_full (components, g_object_unref);
g_slist_free (objects);
g_object_unref (cbsexp);
@@ -1267,7 +1264,7 @@ e_cal_backend_http_create_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **perror)
{
g_propagate_error (perror, EDC_ERROR (PermissionDenied));
@@ -1279,8 +1276,8 @@ e_cal_backend_http_modify_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **perror)
{
g_propagate_error (perror, EDC_ERROR (PermissionDenied));
@@ -1294,11 +1291,11 @@ e_cal_backend_http_remove_object (ECalBackendSync *backend,
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **perror)
{
- *old_component = *component = NULL;
+ *old_component = *new_component = NULL;
g_propagate_error (perror, EDC_ERROR (PermissionDenied));
}
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index aad9618..d47754f 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -173,9 +173,7 @@ finished_retrieval_cb (WeatherInfo *info,
{
ECalBackendWeatherPrivate *priv;
ECalComponent *comp;
- icalcomponent *icomp;
- GSList *l;
- gchar *obj;
+ GSList *comps, *l;
priv = cbw->priv;
@@ -185,26 +183,20 @@ finished_retrieval_cb (WeatherInfo *info,
}
/* update cache */
- l = e_cal_backend_store_get_components (priv->store);
+ comps = e_cal_backend_store_get_components (priv->store);
- for (; l != NULL; l = g_slist_next (l)) {
+ for (l = comps; l != NULL; l = g_slist_next (l)) {
ECalComponentId *id;
- gchar *obj;
- icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (l->data));
- id = e_cal_component_get_id (E_CAL_COMPONENT (l->data));
+ comp = E_CAL_COMPONENT (l->data);
+ id = e_cal_component_get_id (comp);
- obj = icalcomponent_as_ical_string_r (icomp);
- e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbw),
- id,
- obj,
- NULL);
+ e_cal_backend_notify_component_removed (E_CAL_BACKEND (cbw), id, comp, NULL);
e_cal_component_free_id (id);
- g_free (obj);
- g_object_unref (G_OBJECT (l->data));
+ g_object_unref (comp);
}
- g_slist_free (l);
+ g_slist_free (comps);
e_cal_backend_store_clean (priv->store);
comp = create_weather (cbw, info, FALSE);
@@ -212,10 +204,7 @@ finished_retrieval_cb (WeatherInfo *info,
GSList *forecasts;
put_component_to_store (cbw, comp);
- icomp = e_cal_component_get_icalcomponent (comp);
- obj = icalcomponent_as_ical_string_r (icomp);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), obj);
- g_free (obj);
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (cbw), comp);
g_object_unref (comp);
forecasts = weather_info_get_forecast_list (info);
@@ -230,10 +219,7 @@ finished_retrieval_cb (WeatherInfo *info,
comp = create_weather (cbw, nfo, TRUE);
if (comp) {
put_component_to_store (cbw, comp);
- icomp = e_cal_component_get_icalcomponent (comp);
- obj = icalcomponent_as_ical_string_r (icomp);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), obj);
- g_free (obj);
+ e_cal_backend_notify_component_created (E_CAL_BACKEND (cbw), comp);
g_object_unref (comp);
}
}
@@ -773,15 +759,13 @@ e_cal_backend_weather_start_view (ECalBackend *backend,
for (l = components; l != NULL; l = g_slist_next (l)) {
if (e_cal_backend_sexp_match_comp (sexp, E_CAL_COMPONENT (l->data), backend))
- objects = g_slist_append (objects, e_cal_component_get_as_string (l->data));
+ objects = g_slist_prepend (objects, l->data);
}
if (objects)
- e_data_cal_view_notify_objects_added (query, objects);
+ e_data_cal_view_notify_components_added (query, objects);
- g_slist_foreach (components, (GFunc) g_object_unref, NULL);
- g_slist_free (components);
- g_slist_foreach (objects, (GFunc) g_free, NULL);
+ g_slist_free_full (components, g_object_unref);
g_slist_free (objects);
e_data_cal_view_notify_complete (query, NULL /* Success */);
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index 63fc1dc..eb9d992 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -466,7 +466,6 @@ e_cal_component_new (void)
ECalComponent *
e_cal_component_new_from_string (const gchar *calobj)
{
- ECalComponent *comp;
icalcomponent *icalcomp;
g_return_val_if_fail (calobj != NULL, NULL);
@@ -475,6 +474,31 @@ e_cal_component_new_from_string (const gchar *calobj)
if (!icalcomp)
return NULL;
+ return e_cal_component_new_from_icalcomponent (icalcomp);
+}
+
+/**
+ * e_cal_component_new_from_icalcomponent:
+ * @icalcomp: An #icalcomponent to use
+ *
+ * Creates a new #ECalComponent which will has set @icalcomp as
+ * an inner #icalcomponent. The newly created #ECalComponent takes
+ * ownership of the @icalcomp, and if the call
+ * to e_cal_component_set_icalcomponent() fails, then @icalcomp
+ * is freed.
+ *
+ * Returns: An #ECalComponet with @icalcomp assigned on success,
+ * NULL if the @icalcomp cannot be assigned to #ECalComponent.
+ *
+ * Since: 3.4
+ **/
+ECalComponent *
+e_cal_component_new_from_icalcomponent (icalcomponent *icalcomp)
+{
+ ECalComponent *comp;
+
+ g_return_val_if_fail (icalcomp != NULL, NULL);
+
comp = e_cal_component_new ();
if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
diff --git a/calendar/libecal/e-cal-component.h b/calendar/libecal/e-cal-component.h
index cfa88c5..4a31818 100644
--- a/calendar/libecal/e-cal-component.h
+++ b/calendar/libecal/e-cal-component.h
@@ -204,6 +204,7 @@ gchar *e_cal_component_gen_uid (void);
ECalComponent *e_cal_component_new (void);
ECalComponent *e_cal_component_new_from_string (const gchar *calobj);
+ECalComponent *e_cal_component_new_from_icalcomponent (icalcomponent *icalcomp);
ECalComponent *e_cal_component_clone (ECalComponent *comp);
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 53ecf99..e0a4b3f 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -309,7 +309,7 @@ e_cal_backend_sync_get_free_busy (ECalBackendSync *backend,
* @cancellable: a #GCancellable for the operation
* @calobj: The object to be added.
* @uid: Placeholder for server-generated UID.
- * @new_component: (out) (transfer full): Placeholder for returned #icalcomponent.
+ * @new_component: (out) (transfer full): Placeholder for returned #ECalComponent.
* @error: Out parameter for a #GError.
*
* Calls the create_object_sync method on the given backend.
@@ -320,7 +320,7 @@ e_cal_backend_sync_create_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
gchar **uid,
- icalcomponent **new_component,
+ ECalComponent **new_component,
GError **error)
{
e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
@@ -350,8 +350,8 @@ e_cal_backend_sync_modify_object (ECalBackendSync *backend,
GCancellable *cancellable,
const gchar *calobj,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **new_component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **error)
{
e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
@@ -385,8 +385,8 @@ e_cal_backend_sync_remove_object (ECalBackendSync *backend,
const gchar *uid,
const gchar *rid,
CalObjModType mod,
- icalcomponent **old_component,
- icalcomponent **new_component,
+ ECalComponent **old_component,
+ ECalComponent **new_component,
GError **error)
{
e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
@@ -733,19 +733,19 @@ cal_backend_create_object (ECalBackend *backend,
{
GError *error = NULL;
gchar *uid = NULL;
- icalcomponent *new_component = NULL;
+ ECalComponent *new_component = NULL;
e_cal_backend_sync_create_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, &uid, &new_component, &error);
if (!new_component)
- new_component = icalparser_parse_string (calobj);
+ new_component = e_cal_component_new_from_string (calobj);
e_data_cal_respond_create_object (cal, opid, error, uid, new_component);
g_free (uid);
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
}
static void
@@ -757,20 +757,20 @@ cal_backend_modify_object (ECalBackend *backend,
CalObjModType mod)
{
GError *error = NULL;
- icalcomponent *old_component = NULL, *new_component = NULL;
+ ECalComponent *old_component = NULL, *new_component = NULL;
e_cal_backend_sync_modify_object (E_CAL_BACKEND_SYNC (backend), cal, cancellable, calobj, mod, &old_component, &new_component, &error);
if (!old_component)
- old_component = icalparser_parse_string (calobj);
+ old_component = e_cal_component_new_from_string (calobj);
e_data_cal_respond_modify_object (cal, opid, error, old_component, new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
}
static void
@@ -783,7 +783,7 @@ cal_backend_remove_object (ECalBackend *backend,
CalObjModType mod)
{
GError *error = NULL;
- icalcomponent *old_component = NULL, *new_component = NULL;
+ ECalComponent *old_component = NULL, *new_component = NULL;
ECalComponentId compid;
compid.uid = (gchar *) uid;
@@ -794,10 +794,10 @@ cal_backend_remove_object (ECalBackend *backend,
e_data_cal_respond_remove_object (cal, opid, error, &compid, old_component, new_component);
if (old_component)
- icalcomponent_free (old_component);
+ g_object_unref (old_component);
if (new_component)
- icalcomponent_free (new_component);
+ g_object_unref (new_component);
}
static void
diff --git a/calendar/libedata-cal/e-cal-backend-sync.h b/calendar/libedata-cal/e-cal-backend-sync.h
index 5e96b91..d3c2d13 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.h
+++ b/calendar/libedata-cal/e-cal-backend-sync.h
@@ -39,9 +39,9 @@ struct _ECalBackendSyncClass {
void (* get_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **calobj, GError **error);
void (* get_object_list_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **calobjs, GError **error);
void (* get_free_busy_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusyobjs, GError **error);
- void (* create_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, icalcomponent **new_component, GError **error);
- void (* modify_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, icalcomponent **old_component, icalcomponent **new_component, GError **error);
- void (* remove_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, icalcomponent **old_component, icalcomponent **new_component, GError **error);
+ void (* create_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, ECalComponent **new_component, GError **error);
+ void (* modify_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, ECalComponent **old_component, ECalComponent **new_component, GError **error);
+ void (* remove_object_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, ECalComponent **old_component, ECalComponent **new_component, GError **error);
void (* receive_objects_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error);
void (* send_objects_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users, gchar **modified_calobj, GError **error);
void (* get_attachment_uris_sync) (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachments, GError **error);
@@ -64,9 +64,9 @@ gboolean e_cal_backend_sync_set_backend_property (ECalBackendSync *backend, EDat
void e_cal_backend_sync_get_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, gchar **calobj, GError **error);
void e_cal_backend_sync_get_object_list (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *sexp, GSList **calobjs, GError **error);
void e_cal_backend_sync_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const GSList *users, time_t start, time_t end, GSList **freebusyobjects, GError **error);
-void e_cal_backend_sync_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, icalcomponent **new_component, GError **error);
-void e_cal_backend_sync_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, icalcomponent **old_component, icalcomponent **new_component, GError **error);
-void e_cal_backend_sync_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, icalcomponent **old_component, icalcomponent **new_component, GError **error);
+void e_cal_backend_sync_create_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, gchar **uid, ECalComponent **new_component, GError **error);
+void e_cal_backend_sync_modify_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, ECalComponent **old_component, ECalComponent **new_component, GError **error);
+void e_cal_backend_sync_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, CalObjModType mod, ECalComponent **old_component, ECalComponent **new_component, GError **error);
void e_cal_backend_sync_receive_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GError **error);
void e_cal_backend_sync_send_objects (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, GSList **users, gchar **modified_calobj, GError **error);
void e_cal_backend_sync_get_attachment_uris (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, GSList **attachments, GError **error);
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index 1a4d589..7b99118 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -1376,45 +1376,22 @@ static gboolean
component_created_cb (EDataCalView *view,
gpointer data)
{
- ECalComponent *comp = (ECalComponent *) data;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+ ECalComponent *comp = data;
if (e_data_cal_view_component_matches (view, comp))
- e_data_cal_view_notify_components_added_1 (view, icalcomp);
+ e_data_cal_view_notify_components_added_1 (view, comp);
return TRUE;
}
-static ECalComponent *
-ecal_comp_from_icalcomp (const icalcomponent *component)
-{
- ECalComponent *comp = NULL;
- icalcomponent *icalclone;
-
- if (component) {
- comp = e_cal_component_new ();
- icalclone = icalcomponent_new_clone ((icalcomponent *) component);
-
- if (!e_cal_component_set_icalcomponent (comp, icalclone)) {
- g_warning ("ecal_comp_from_icalcomp failed to set icalcomponent");
-
- icalcomponent_free (icalclone);
- g_object_unref (comp);
- comp = NULL;
- }
- }
-
- return comp;
-}
-
/**
* e_cal_backend_notify_component_created:
* @backend: an #ECalBackend
- * @component: the newly created #icalcomponent
+ * @component: the newly created #ECalComponent
*
* Notifies each of the backend's listeners about a new object.
*
- * Like e_cal_backend_notify_object_created() except takes an #icalcomponent
+ * Like e_cal_backend_notify_object_created() except takes an #ECalComponent
* instead of an ical string representation and uses the #EDataCalView's
* fields-of-interest to filter out unwanted information from ical strings
* sent over the bus.
@@ -1423,10 +1400,9 @@ ecal_comp_from_icalcomp (const icalcomponent *component)
**/
void
e_cal_backend_notify_component_created (ECalBackend *backend,
- const icalcomponent *component)
+ /* const */ ECalComponent *component)
{
ECalBackendPrivate *priv;
- ECalComponent *comp;
priv = backend->priv;
@@ -1435,48 +1411,25 @@ e_cal_backend_notify_component_created (ECalBackend *backend,
return;
}
- comp = ecal_comp_from_icalcomp (component);
-
- e_cal_backend_foreach_view (backend, component_created_cb, (gpointer) comp);
- g_object_unref (comp);
-}
-
-/**
- * e_cal_backend_notify_components_added:
- *
- * Like e_cal_backend_notify_objects_added() except take a list of
- * #icalcomponents instead of ical string representations and uses the
- * #EDataCalView's fields-of-interest to filter out unwanted information
- * from ical strings sent over the bus.
- *
- * Since: 3.4
- **/
-void
-e_cal_backend_notify_components_added (ECalBackend *backend,
- EDataCalView *view,
- const GSList *objects)
-{
- e_data_cal_view_notify_components_added (view, objects);
+ e_cal_backend_foreach_view (backend, component_created_cb, component);
}
static void
match_view_and_notify_component (EDataCalView *view,
ECalComponent *old_component,
- ECalComponent *component)
+ ECalComponent *new_component)
{
gboolean old_match = FALSE, new_match = FALSE;
- icalcomponent *icalcomp;
if (old_component)
old_match = e_data_cal_view_component_matches (view, old_component);
- new_match = e_data_cal_view_component_matches (view, component);
- icalcomp = e_cal_component_get_icalcomponent (component);
+ new_match = e_data_cal_view_component_matches (view, new_component);
if (old_match && new_match)
- e_data_cal_view_notify_components_modified_1 (view, icalcomp);
+ e_data_cal_view_notify_components_modified_1 (view, new_component);
else if (new_match)
- e_data_cal_view_notify_components_added_1 (view, icalcomp);
+ e_data_cal_view_notify_components_added_1 (view, new_component);
else if (old_match) {
ECalComponentId *id = e_cal_component_get_id (old_component);
@@ -1489,7 +1442,7 @@ match_view_and_notify_component (EDataCalView *view,
struct component_call_data {
ECalComponent *old_component;
- ECalComponent *component;
+ ECalComponent *new_component;
const ECalComponentId *id;
};
@@ -1501,7 +1454,7 @@ call_match_and_notify_component (EDataCalView *view,
g_return_val_if_fail (user_data != NULL, FALSE);
- match_view_and_notify_component (view, cd->old_component, cd->component);
+ match_view_and_notify_component (view, cd->old_component, cd->new_component);
return TRUE;
}
@@ -1509,12 +1462,12 @@ call_match_and_notify_component (EDataCalView *view,
/**
* e_cal_backend_notify_component_modified:
* @backend: an #ECalBackend
- * @old_component: the #icalcomponent before the modification
- * @new_component: the #icalcomponent after the modification
+ * @old_component: the #ECalComponent before the modification
+ * @new_component: the #ECalComponent after the modification
*
* Notifies each of the backend's listeners about a modified object.
*
- * Like e_cal_backend_notify_object_modified() except takes an #icalcomponent
+ * Like e_cal_backend_notify_object_modified() except takes an #ECalComponent
* instead of an ical string representation and uses the #EDataCalView's
* fields-of-interest to filter out unwanted information from ical strings
* sent over the bus.
@@ -1523,8 +1476,8 @@ call_match_and_notify_component (EDataCalView *view,
**/
void
e_cal_backend_notify_component_modified (ECalBackend *backend,
- const icalcomponent *old_component,
- const icalcomponent *new_component)
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component)
{
ECalBackendPrivate *priv;
struct component_call_data cd;
@@ -1536,35 +1489,11 @@ e_cal_backend_notify_component_modified (ECalBackend *backend,
return;
}
- cd.old_component = ecal_comp_from_icalcomp (old_component);
- cd.component = ecal_comp_from_icalcomp (new_component);
+ cd.old_component = old_component;
+ cd.new_component = new_component;
cd.id = NULL;
e_cal_backend_foreach_view (backend, call_match_and_notify_component, &cd);
-
- if (cd.old_component)
- g_object_unref (cd.old_component);
-
- if (cd.component)
- g_object_unref (cd.component);
-}
-
-/**
- * e_cal_backend_notify_components_modified:
- *
- * Like e_cal_backend_notify_objects_modified() except takes a list of
- * #icalcomponents instead of a ical string representations and uses the
- * #EDataCalView's fields-of-interest to filter out unwanted information
- * from ical strings sent over the bus.
- *
- * Since: 3.4
- **/
-void
-e_cal_backend_notify_components_modified (ECalBackend *backend,
- EDataCalView *view,
- const GSList *objects)
-{
- e_data_cal_view_notify_components_modified (view, objects);
}
static gboolean
@@ -1575,13 +1504,13 @@ component_removed_cb (EDataCalView *view,
g_return_val_if_fail (user_data != NULL, FALSE);
- if (cd->component == NULL) {
+ if (cd->new_component == NULL) {
/* if object == NULL, it means the object has been completely
* removed from the backend */
if (!cd->old_component || e_data_cal_view_component_matches (view, cd->old_component))
e_data_cal_view_notify_objects_removed_1 (view, cd->id);
} else
- match_view_and_notify_component (view, cd->old_component, cd->component);
+ match_view_and_notify_component (view, cd->old_component, cd->new_component);
return TRUE;
}
@@ -1591,13 +1520,13 @@ component_removed_cb (EDataCalView *view,
* @backend: an #ECalBackend
* @id: the Id of the removed object
* @old_component: the removed component
- * @component: the component after the removal. This only applies to recurrent
+ * @new_component: the component after the removal. This only applies to recurrent
* appointments that had an instance removed. In that case, this function
* notifies a modification instead of a removal.
*
* Notifies each of the backend's listeners about a removed object.
*
- * Like e_cal_backend_notify_object_removed() except takes an #icalcomponent
+ * Like e_cal_backend_notify_object_removed() except takes an #ECalComponent
* instead of an ical string representation and uses the #EDataCalView's
* fields-of-interest to filter out unwanted information from ical strings
* sent over the bus.
@@ -1607,8 +1536,8 @@ component_removed_cb (EDataCalView *view,
void
e_cal_backend_notify_component_removed (ECalBackend *backend,
const ECalComponentId *id,
- const icalcomponent *old_component,
- const icalcomponent *component)
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component)
{
ECalBackendPrivate *priv;
struct component_call_data cd;
@@ -1616,21 +1545,15 @@ e_cal_backend_notify_component_removed (ECalBackend *backend,
priv = backend->priv;
if (priv->notification_proxy) {
- e_cal_backend_notify_component_removed (priv->notification_proxy, id, old_component, component);
+ e_cal_backend_notify_component_removed (priv->notification_proxy, id, old_component, new_component);
return;
}
- cd.old_component = ecal_comp_from_icalcomp (old_component);
- cd.component = ecal_comp_from_icalcomp (component);
+ cd.old_component = old_component;
+ cd.new_component = new_component;
cd.id = id;
e_cal_backend_foreach_view (backend, component_removed_cb, &cd);
-
- if (cd.old_component)
- g_object_unref (cd.old_component);
-
- if (cd.component)
- g_object_unref (cd.component);
}
static gboolean
@@ -1655,6 +1578,8 @@ object_created_cb (EDataCalView *view,
* #e_data_cal_notify_object_created() calls this for you. You only need to
* call e_cal_backend_notify_object_created() yourself to report objects
* created by non-EDS clients.
+ *
+ * Deprecated: 3.4: Use e_cal_backend_notify_component_created() instead.
**/
void
e_cal_backend_notify_object_created (ECalBackend *backend,
@@ -1676,6 +1601,8 @@ e_cal_backend_notify_object_created (ECalBackend *backend,
* e_cal_backend_notify_objects_added:
*
* Since: 2.24
+ *
+ * Deprecated: 3.4: Use e_data_cal_view_notify_objects_added() instead.
**/
void
e_cal_backend_notify_objects_added (ECalBackend *backend,
@@ -1745,6 +1672,8 @@ call_match_and_notify_object (EDataCalView *view,
* #e_data_cal_notify_object_modified() calls this for you. You only need to
* call e_cal_backend_notify_object_modified() yourself to report objects
* modified by non-EDS clients.
+ *
+ * Deprecated: 3.4: Use e_cal_backend_notify_component_modified() instead.
**/
void
e_cal_backend_notify_object_modified (ECalBackend *backend,
@@ -1772,6 +1701,8 @@ e_cal_backend_notify_object_modified (ECalBackend *backend,
* e_cal_backend_notify_objects_modified:
*
* Since: 2.24
+ *
+ * Deprecated: 3.4: Use e_data_cal_view_notify_objects_modified() instead.
**/
void
e_cal_backend_notify_objects_modified (ECalBackend *backend,
@@ -1814,6 +1745,8 @@ object_removed_cb (EDataCalView *view,
* e_data_cal_notify_object_removed() calls this for you. You only need to
* call e_cal_backend_notify_object_removed() yourself to report objects
* removed by non-EDS clients.
+ *
+ * Deprecated: 3.4: Use e_cal_backend_notify_component_removed() instead.
**/
void
e_cal_backend_notify_object_removed (ECalBackend *backend,
@@ -1842,6 +1775,8 @@ e_cal_backend_notify_object_removed (ECalBackend *backend,
* e_cal_backend_notify_objects_removed:
*
* Since: 2.24
+ *
+ * Deprecated: 3.4: Use e_data_cal_view_notify_objects_removed() instead.
**/
void
e_cal_backend_notify_objects_removed (ECalBackend *backend,
@@ -2132,14 +2067,13 @@ e_cal_backend_empty_cache (ECalBackend *backend,
comps_in_cache;
comps_in_cache = comps_in_cache->next) {
ECalComponentId *id;
- ECalComponent *comp = comps_in_cache->data;
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+ ECalComponent *comp = comps_in_cache->data;
id = e_cal_component_get_id (comp);
e_cal_backend_cache_remove_component (cache, id->uid, id->rid);
- e_cal_backend_notify_component_removed (backend, id, icalcomp, NULL);
+ e_cal_backend_notify_component_removed (backend, id, comp, NULL);
e_cal_component_free_id (id);
g_object_unref (comp);
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index 6c064da..13cf488 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -225,18 +225,24 @@ icaltimezone * e_cal_backend_internal_get_timezone (ECalBackend *backend, const
void e_cal_backend_start_view (ECalBackend *backend, EDataCalView *view);
void e_cal_backend_stop_view (ECalBackend *backend, EDataCalView *view);
-void e_cal_backend_notify_component_created (ECalBackend *backend, const icalcomponent *component);
-void e_cal_backend_notify_components_added (ECalBackend *backend, EDataCalView *view, const GSList *components);
-void e_cal_backend_notify_component_modified (ECalBackend *backend, const icalcomponent *old_component, const icalcomponent *new_component);
-void e_cal_backend_notify_components_modified (ECalBackend *backend, EDataCalView *view, const GSList *components);
-void e_cal_backend_notify_component_removed (ECalBackend *backend, const ECalComponentId *id, const icalcomponent *old_component, const icalcomponent *component);
-
+void e_cal_backend_notify_component_created (ECalBackend *backend,
+ /* const */ ECalComponent *component);
+void e_cal_backend_notify_component_modified (ECalBackend *backend,
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component);
+void e_cal_backend_notify_component_removed (ECalBackend *backend,
+ const ECalComponentId *id,
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component);
+
+#ifndef E_CAL_DISABLE_DEPRECATED
void e_cal_backend_notify_object_created (ECalBackend *backend, const gchar *calobj);
void e_cal_backend_notify_objects_added (ECalBackend *backend, EDataCalView *view, const GSList *objects);
void e_cal_backend_notify_object_modified (ECalBackend *backend, const gchar *old_object, const gchar *object);
void e_cal_backend_notify_objects_modified (ECalBackend *backend, EDataCalView *view, const GSList *objects);
void e_cal_backend_notify_object_removed (ECalBackend *backend, const ECalComponentId *id, const gchar *old_object, const gchar *new_object);
void e_cal_backend_notify_objects_removed (ECalBackend *backend, EDataCalView *view, const GSList *ids);
+#endif
void e_cal_backend_notify_error (ECalBackend *backend, const gchar *message);
void e_cal_backend_notify_readonly (ECalBackend *backend, gboolean is_readonly);
diff --git a/calendar/libedata-cal/e-data-cal-view.c b/calendar/libedata-cal/e-data-cal-view.c
index e916df1..f767998 100644
--- a/calendar/libedata-cal/e-data-cal-view.c
+++ b/calendar/libedata-cal/e-data-cal-view.c
@@ -294,14 +294,12 @@ notify_add (EDataCalView *view,
static void
notify_add_component (EDataCalView *view,
- icalcomponent *icalcomp)
+ /* const */ ECalComponent *comp)
{
EDataCalViewPrivate *priv = view->priv;
- icalcomponent *icalclone;
- ECalComponent *comp;
gchar *obj;
- obj = e_data_cal_view_get_component_string (view, icalcomp);
+ obj = e_data_cal_view_get_component_string (view, comp);
send_pending_changes (view);
send_pending_removes (view);
@@ -311,14 +309,9 @@ notify_add_component (EDataCalView *view,
}
g_array_append_val (priv->adds, obj);
- comp = e_cal_component_new ();
- icalclone = icalcomponent_new_clone (icalcomp);
- e_cal_component_set_icalcomponent (comp, icalclone);
-
g_hash_table_insert (priv->ids,
e_cal_component_get_id (comp),
GUINT_TO_POINTER (1));
- g_object_unref (comp);
ensure_pending_flush_timeout (view);
}
@@ -343,7 +336,7 @@ notify_change (EDataCalView *view,
static void
notify_change_component (EDataCalView *view,
- icalcomponent *comp)
+ ECalComponent *comp)
{
gchar *obj;
@@ -833,6 +826,8 @@ filter_component (icalcomponent *icomponent,
icalcomponent *icomp;
gboolean fail = FALSE;
+ g_return_val_if_fail (icomponent != NULL, FALSE);
+
/* Open iCalendar string */
g_string_append (string, "BEGIN:");
@@ -893,7 +888,7 @@ filter_component (icalcomponent *icomponent,
/**
* e_data_cal_view_get_component_string:
* @view: A view object.
- * @component: The #icalcomponent to get the string for.
+ * @component: The #ECalComponent to get the string for.
*
* This function is similar to e_cal_component_get_as_string() except
* that it takes into account the fields-of-interest that @view is
@@ -906,32 +901,33 @@ filter_component (icalcomponent *icomponent,
*/
gchar *
e_data_cal_view_get_component_string (EDataCalView *view,
- icalcomponent *component)
+ /* const */ ECalComponent *component)
{
g_return_val_if_fail (E_IS_DATA_CAL_VIEW (view), NULL);
g_return_val_if_fail (component != NULL, NULL);
if (view->priv->fields_of_interest) {
GString *string = g_string_new ("");
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (component);
- if (filter_component (component, view->priv->fields_of_interest, string))
+ if (filter_component (icalcomp, view->priv->fields_of_interest, string))
return g_string_free (string, FALSE);
g_string_free (string, TRUE);
}
- return icalcomponent_as_ical_string_r (component);
+ return e_cal_component_get_as_string (component);
}
/**
* e_data_cal_view_notify_components_added:
* @view: A view object.
- * @components: List of components that have been added.
+ * @ecalcomponents: List of #ECalComponent-s that have been added.
*
* Notifies all view listeners of the addition of a list of components.
*
* Like e_data_cal_view_notify_objects_added() except takes a list
- * of #icalcomponents instead of ical string representations and uses the
+ * of #ECalComponent-s instead of ical string representations and uses the
* #EDataCalView's fields-of-interest to filter out unwanted information
* from ical strings sent over the bus.
*
@@ -939,7 +935,7 @@ e_data_cal_view_get_component_string (EDataCalView *view,
*/
void
e_data_cal_view_notify_components_added (EDataCalView *view,
- const GSList *components)
+ const GSList *ecalcomponents)
{
EDataCalViewPrivate *priv;
const GSList *l;
@@ -947,13 +943,15 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
priv = view->priv;
- if (components == NULL)
+ if (ecalcomponents == NULL)
return;
g_mutex_lock (priv->pending_mutex);
- for (l = components; l; l = l->next) {
- icalcomponent *comp = l->data;
+ for (l = ecalcomponents; l; l = l->next) {
+ ECalComponent *comp = l->data;
+
+ g_warn_if_fail (E_IS_CAL_COMPONENT (comp));
notify_add_component (view, comp);
}
@@ -964,11 +962,11 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
/**
* e_data_cal_view_notify_components_added_1:
* @view: A view object.
- * @component: The #icalcomponent that has been added.
+ * @component: The #ECalComponent that has been added.
*
* Notifies all the view listeners of the addition of a single object.
*
- * Like e_data_cal_view_notify_objects_added_1() except takes an #icalcomponent
+ * Like e_data_cal_view_notify_objects_added_1() except takes an #ECalComponent
* instead of an ical string representation and uses the #EDataCalView's
* fields-of-interest to filter out unwanted information from ical strings
* sent over the bus.
@@ -977,7 +975,7 @@ e_data_cal_view_notify_components_added (EDataCalView *view,
*/
void
e_data_cal_view_notify_components_added_1 (EDataCalView *view,
- const icalcomponent *component)
+ /* const */ ECalComponent *component)
{
GSList l = {NULL,};
@@ -991,12 +989,12 @@ e_data_cal_view_notify_components_added_1 (EDataCalView *view,
/**
* e_data_cal_view_notify_components_modified:
* @view: A view object.
- * @components: List of modified components.
+ * @ecalcomponents: List of modified #ECalComponent-s.
*
* Notifies all view listeners of the modification of a list of components.
*
* Like e_data_cal_view_notify_objects_modified() except takes a list of
- * #icalcomponents instead of a ical string representations and uses the
+ * #ECalComponents instead of a ical string representations and uses the
* #EDataCalView's fields-of-interest to filter out unwanted information
* from ical strings sent over the bus.
*
@@ -1004,7 +1002,7 @@ e_data_cal_view_notify_components_added_1 (EDataCalView *view,
*/
void
e_data_cal_view_notify_components_modified (EDataCalView *view,
- const GSList *components)
+ const GSList *ecalcomponents)
{
EDataCalViewPrivate *priv;
const GSList *l;
@@ -1012,14 +1010,15 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
g_return_if_fail (view && E_IS_DATA_CAL_VIEW (view));
priv = view->priv;
- if (components == NULL)
+ if (ecalcomponents == NULL)
return;
g_mutex_lock (priv->pending_mutex);
- for (l = components; l; l = l->next) {
- /* TODO: send add/remove/change as relevant, based on ->ids */
- icalcomponent *comp = l->data;
+ for (l = ecalcomponents; l; l = l->next) {
+ ECalComponent *comp = l->data;
+
+ g_warn_if_fail (E_IS_CAL_COMPONENT (comp));
notify_change_component (view, comp);
}
@@ -1030,12 +1029,12 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
/**
* e_data_cal_view_notify_components_modified_1:
* @view: A view object.
- * @component: The modified #icalcomponent.
+ * @component: The modified #ECalComponent.
*
* Notifies all view listeners of the modification of @component.
*
* Like e_data_cal_view_notify_objects_modified_1() except takes an
- * #icalcomponent instead of an ical string representation and uses the
+ * #ECalComponent instead of an ical string representation and uses the
* #EDataCalView's fields-of-interest to filter out unwanted information
* from ical strings sent over the bus.
*
@@ -1043,7 +1042,7 @@ e_data_cal_view_notify_components_modified (EDataCalView *view,
*/
void
e_data_cal_view_notify_components_modified_1 (EDataCalView *view,
- const icalcomponent *component)
+ /* const */ ECalComponent *component)
{
GSList l = {NULL,};
@@ -1061,8 +1060,8 @@ e_data_cal_view_notify_components_modified_1 (EDataCalView *view,
*
* Notifies all view listeners of the addition of a list of objects.
*
- * If possible e_data_cal_view_notify_components_added() should be used
- * instead.
+ * Deprecated: 3.4: If possible e_data_cal_view_notify_components_added()
+ * should be used instead.
*/
void
e_data_cal_view_notify_objects_added (EDataCalView *view,
@@ -1093,8 +1092,8 @@ e_data_cal_view_notify_objects_added (EDataCalView *view,
*
* Notifies all the view listeners of the addition of a single object.
*
- * If possible e_data_cal_view_notify_components_added_1() should be used
- * instead.
+ * Deprecated: 3.4: If possible e_data_cal_view_notify_components_added_1()
+ * should be used instead.
*/
void
e_data_cal_view_notify_objects_added_1 (EDataCalView *view,
@@ -1116,8 +1115,8 @@ e_data_cal_view_notify_objects_added_1 (EDataCalView *view,
*
* Notifies all view listeners of the modification of a list of objects.
*
- * If possible e_data_cal_view_notify_components_modified() should be used
- * instead.
+ * Deprecated: 3.4: If possible e_data_cal_view_notify_components_modified()
+ * should be used instead.
*/
void
e_data_cal_view_notify_objects_modified (EDataCalView *view,
@@ -1149,8 +1148,8 @@ e_data_cal_view_notify_objects_modified (EDataCalView *view,
*
* Notifies all view listeners of the modification of a single object.
*
- * If possible e_data_cal_view_notify_components_modified_1() should be used
- * instead.
+ * Deprecated: 3.4: If possible e_data_cal_view_notify_components_modified_1()
+ * should be used instead.
*/
void
e_data_cal_view_notify_objects_modified_1 (EDataCalView *view,
diff --git a/calendar/libedata-cal/e-data-cal-view.h b/calendar/libedata-cal/e-data-cal-view.h
index 2434ced..4ec6c0a 100644
--- a/calendar/libedata-cal/e-data-cal-view.h
+++ b/calendar/libedata-cal/e-data-cal-view.h
@@ -58,17 +58,20 @@ gboolean e_data_cal_view_is_completed (EDataCalView *view);
gboolean e_data_cal_view_is_stopped (EDataCalView *view);
GHashTable * e_data_cal_view_get_fields_of_interest (EDataCalView *view);
-gchar *e_data_cal_view_get_component_string (EDataCalView *view, icalcomponent *component);
+gchar * e_data_cal_view_get_component_string (EDataCalView *view, /* const */ ECalComponent *component);
-void e_data_cal_view_notify_components_added (EDataCalView *view, const GSList *components);
-void e_data_cal_view_notify_components_added_1 (EDataCalView *view, const icalcomponent *component);
-void e_data_cal_view_notify_components_modified (EDataCalView *view, const GSList *components);
-void e_data_cal_view_notify_components_modified_1 (EDataCalView *view, const icalcomponent *component);
+void e_data_cal_view_notify_components_added (EDataCalView *view, const GSList *ecalcomponents);
+void e_data_cal_view_notify_components_added_1 (EDataCalView *view, /* const */ ECalComponent *component);
+void e_data_cal_view_notify_components_modified (EDataCalView *view, const GSList *ecalcomponents);
+void e_data_cal_view_notify_components_modified_1 (EDataCalView *view, /* const */ ECalComponent *component);
+#ifndef E_CAL_DISABLE_DEPRECATED
void e_data_cal_view_notify_objects_added (EDataCalView *view, const GSList *objects);
void e_data_cal_view_notify_objects_added_1 (EDataCalView *view, const gchar *object);
void e_data_cal_view_notify_objects_modified (EDataCalView *view, const GSList *objects);
void e_data_cal_view_notify_objects_modified_1 (EDataCalView *view, const gchar *object);
+#endif
+
void e_data_cal_view_notify_objects_removed (EDataCalView *view, const GSList *ids);
void e_data_cal_view_notify_objects_removed_1 (EDataCalView *view, const ECalComponentId *id);
void e_data_cal_view_notify_progress (EDataCalView *view, gint percent, const gchar *message);
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index c9f0517..02edd41 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -1167,7 +1167,7 @@ e_data_cal_respond_get_free_busy (EDataCal *cal,
* @cal: A calendar client interface.
* @error: Operation error, if any, automatically freed if passed it.
* @uid: UID of the object created.
- * @component: The newly created #icalcomponent.
+ * @new_component: The newly created #ECalComponent.
*
* Notifies listeners of the completion of the create_object method call.
*
@@ -1178,7 +1178,7 @@ e_data_cal_respond_create_object (EDataCal *cal,
guint32 opid,
GError *error,
const gchar *uid,
- icalcomponent *component)
+ /* const */ ECalComponent *new_component)
{
gchar *gdbus_uid = NULL;
@@ -1193,15 +1193,15 @@ e_data_cal_respond_create_object (EDataCal *cal,
if (error)
g_error_free (error);
else
- e_cal_backend_notify_component_created (cal->priv->backend, component);
+ e_cal_backend_notify_component_created (cal->priv->backend, new_component);
}
/**
* e_data_cal_respond_modify_object:
* @cal: A calendar client interface.
* @error: Operation error, if any, automatically freed if passed it.
- * @old_component: The old #icalcomponent.
- * @component: The new #icalcomponent.
+ * @old_component: The old #ECalComponent.
+ * @new_component: The new #ECalComponent.
*
* Notifies listeners of the completion of the modify_object method call.
*
@@ -1211,8 +1211,8 @@ void
e_data_cal_respond_modify_object (EDataCal *cal,
guint32 opid,
GError *error,
- icalcomponent *old_component,
- icalcomponent *component)
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component)
{
op_complete (cal, opid);
@@ -1224,7 +1224,7 @@ e_data_cal_respond_modify_object (EDataCal *cal,
if (error)
g_error_free (error);
else
- e_cal_backend_notify_component_modified (cal->priv->backend, old_component, component);
+ e_cal_backend_notify_component_modified (cal->priv->backend, old_component, new_component);
}
/**
@@ -1232,8 +1232,8 @@ e_data_cal_respond_modify_object (EDataCal *cal,
* @cal: A calendar client interface.
* @error: Operation error, if any, automatically freed if passed it.
* @id: ID of the removed object.
- * @old_component: The old #icalcomponent.
- * @component: The new #icalcomponent. This will not be NULL only
+ * @old_component: The old #ECalComponent.
+ * @new_component: The new #ECalComponent. This will not be NULL only
* when removing instances of a recurring appointment.
*
* Notifies listeners of the completion of the remove_object method call.
@@ -1245,8 +1245,8 @@ e_data_cal_respond_remove_object (EDataCal *cal,
guint32 opid,
GError *error,
const ECalComponentId *id,
- icalcomponent *old_component,
- icalcomponent *component)
+ /* const */ ECalComponent *old_component,
+ /* const */ ECalComponent *new_component)
{
op_complete (cal, opid);
@@ -1258,7 +1258,7 @@ e_data_cal_respond_remove_object (EDataCal *cal,
if (error)
g_error_free (error);
else
- e_cal_backend_notify_component_removed (cal->priv->backend, id, old_component, component);
+ e_cal_backend_notify_component_removed (cal->priv->backend, id, old_component, new_component);
}
/**
diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h
index 1cb32e7..f9c5ecd 100644
--- a/calendar/libedata-cal/e-data-cal.h
+++ b/calendar/libedata-cal/e-data-cal.h
@@ -136,9 +136,9 @@ void e_data_cal_respond_set_backend_property (EDataCal *cal, guint32 opid, GEr
void e_data_cal_respond_get_object (EDataCal *cal, guint32 opid, GError *error, const gchar *object);
void e_data_cal_respond_get_object_list (EDataCal *cal, guint32 opid, GError *error, const GSList *objects);
void e_data_cal_respond_get_free_busy (EDataCal *cal, guint32 opid, GError *error);
-void e_data_cal_respond_create_object (EDataCal *cal, guint32 opid, GError *error, const gchar *uid, icalcomponent *component);
-void e_data_cal_respond_modify_object (EDataCal *cal, guint32 opid, GError *error, icalcomponent *old_component, icalcomponent *component);
-void e_data_cal_respond_remove_object (EDataCal *cal, guint32 opid, GError *error, const ECalComponentId *id, icalcomponent *old_component, icalcomponent *component);
+void e_data_cal_respond_create_object (EDataCal *cal, guint32 opid, GError *error, const gchar *uid, /*const */ ECalComponent *new_component);
+void e_data_cal_respond_modify_object (EDataCal *cal, guint32 opid, GError *error, /* const */ ECalComponent *old_component, /* const */ ECalComponent *new_component);
+void e_data_cal_respond_remove_object (EDataCal *cal, guint32 opid, GError *error, const ECalComponentId *id, /* const */ ECalComponent *old_component, /* const */ ECalComponent *new_component);
void e_data_cal_respond_receive_objects (EDataCal *cal, guint32 opid, GError *error);
void e_data_cal_respond_send_objects (EDataCal *cal, guint32 opid, GError *error, const GSList *users, const gchar *calobj);
void e_data_cal_respond_get_attachment_uris (EDataCal *cal, guint32 opid, GError *error, const GSList *attachment_uris);
diff --git a/configure.ac b/configure.ac
index 9cc661b..4292c45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ LIBECAL_CURRENT=13
LIBECAL_REVISION=2
LIBECAL_AGE=2
-LIBEDATACAL_CURRENT=14
+LIBEDATACAL_CURRENT=15
LIBEDATACAL_REVISION=0
LIBEDATACAL_AGE=0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]