[evolution-kolab: 10/13] Bug #672996 - Calendar API changed (for 3.5.x)
- From: Christian Hilberg <chilberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab: 10/13] Bug #672996 - Calendar API changed (for 3.5.x)
- Date: Fri, 25 May 2012 16:38:44 +0000 (UTC)
commit be65734eef2f1a67c0dad6b8ad1facb29d04aa28
Author: Christian Hilberg <hilberg kernelconcepts de>
Date: Fri May 25 17:42:32 2012 +0200
Bug #672996 - Calendar API changed (for 3.5.x)
* applied patch created by Milan Crha
* fixes ECalBackendKolab for upstream
API changes
src/calendar/e-cal-backend-kolab.c | 153 +++++++++++++++++++++---------------
1 files changed, 89 insertions(+), 64 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 3f31abe..b89df86 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -864,32 +864,32 @@ e_cal_backend_kolab_get_free_busy (ECalBackendSync *backend,
}
/**
- * e_cal_backend_kolab_create_object:
+ * e_cal_backend_kolab_create_objects:
* @backend: (sync) kolab calendar backend object.
* @cal: An EDataCal object.
* @cancellable: A cancellation stack
- * @calobj: Contains the event to be created in the calendar as iCalendar string.
- * @uid: Return value of the created events uid.
- * @new_component: The newly created component, serialized as ical component string.
+ * @calobjs: Contains the events to be created in the calendar as iCalendar string.
+ * @uids: Return values of the created events uid.
+ * @new_components: The newly created components, serialized as ECalComponent objects.
* @err: A GError placeholder.
*
* Creates a new calendar entry in the Kolab calendar. This method gets called
* when Evolution requests a new entry to be saved in the calendar.
*/
static void
-e_cal_backend_kolab_create_object (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *calobj,
- gchar **uid,
- ECalComponent **new_component,
- GError **error)
+e_cal_backend_kolab_create_objects (ECalBackendSync *backend,
+ EDataCal *cal,
+ GCancellable *cancellable,
+ const GSList *calobjs,
+ GSList **uids,
+ GSList **new_components,
+ GError **error)
{
ECalBackendKolab *self = NULL;
ECalBackendKolabPrivate *priv = NULL;
ECalComponent *ecalcomp = NULL;
ECalComponent *tzcomp = NULL;
- const gchar *tmp_uid = NULL;
+ const gchar *tmp_uid = NULL, *calobj;
GError *tmp_err = NULL;
gboolean ok = FALSE;
@@ -897,10 +897,16 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_KOLAB (backend), InvalidArg);
e_return_data_cal_error_if_fail (E_IS_DATA_CAL (cal), InvalidArg);
/* cancellable may be NULL */
- e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (uid != NULL && *uid == NULL, InvalidArg);
- e_return_data_cal_error_if_fail (new_component != NULL && *new_component == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (calobjs != NULL && calobjs->data != NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (uids != NULL && *uids == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (new_components != NULL && *new_components == NULL, InvalidArg);
+
+ if (calobjs->next) {
+ g_propagate_error (error, e_data_cal_create_error (UnsupportedMethod, "Kolab does not support bulk additions"));
+ return;
+ }
+ calobj = calobjs->data;
self = E_CAL_BACKEND_KOLAB (backend);
priv = E_CAL_BACKEND_KOLAB_PRIVATE (self);
@@ -1000,15 +1006,15 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
}
/**
- * e_cal_backend_kolab_modify_object:
+ * e_cal_backend_kolab_modify_objects:
* @backend: An ECalBackendSync object.
* @cal: An EDataCal object.
* @cancellable: A cancellation stack.
- * @calobj: Object to be modified.
+ * @calobjs: Objects to be modified.
* @mod: Type of modification to be done.
- * @old_component: Placeholder for returning the old object as it was stored on the
+ * @old_components: Placeholder for returning the old objects as it was stored on the
* backend.
- * @new_component: Placeholder for returning the new object as it has been stored
+ * @new_components: Placeholder for returning the new objects as it has been stored
* on the backend.
* @err: A GError placeholder.
*
@@ -1016,21 +1022,21 @@ e_cal_backend_kolab_create_object (ECalBackendSync *backend,
* does not exist on the calendar, it will be issued as new event.
*/
static void
-e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *calobj,
- CalObjModType mod,
- ECalComponent **old_component,
- ECalComponent **new_component,
- GError **error)
+e_cal_backend_kolab_modify_objects (ECalBackendSync *backend,
+ EDataCal *cal,
+ GCancellable *cancellable,
+ const GSList *calobjs,
+ CalObjModType mod,
+ GSList **old_components,
+ GSList **new_components,
+ GError **error)
{
ECalBackendKolab *self = NULL;
ECalBackendKolabPrivate *priv = NULL;
ECalComponent *ecalcomp = NULL;
ECalComponent *oldcomp = NULL;
ECalComponent *ecaltz = NULL;
- const gchar *uid = NULL;
+ const gchar *uid = NULL, *calobj;
gboolean is_instance = FALSE;
gboolean ok = FALSE;
GError *tmp_err = NULL;
@@ -1039,10 +1045,16 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_KOLAB (backend), InvalidArg);
e_return_data_cal_error_if_fail (E_IS_DATA_CAL (cal), InvalidArg);
/* cancellable may be NULL */
- e_return_data_cal_error_if_fail (calobj != NULL, InvalidArg);
- e_return_data_cal_error_if_fail (old_component != NULL && *old_component == NULL, InvalidArg);
- e_return_data_cal_error_if_fail (new_component != NULL && *new_component == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (calobjs != NULL && calobjs->data != NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (old_components != NULL && *old_components == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (new_components != NULL && *new_components == NULL, InvalidArg);
+
+ if (calobjs->next) {
+ g_propagate_error (error, e_data_cal_create_error (UnsupportedMethod, "Kolab does not support bulk modifications"));
+ return;
+ }
+ calobj = calobjs->data;
self = E_CAL_BACKEND_KOLAB (backend);
priv = E_CAL_BACKEND_KOLAB_PRIVATE (self);
@@ -1085,7 +1097,7 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
return;
}
- *old_component = oldcomp;
+ *old_components = g_slist_append (NULL, oldcomp);
/* Is this correct? Perhaps _get_tz (..., oldcomp) is needed.
* This depends on wether evolution sends the timezone, if modification
* to the timezone has been made. In any other case the timezone
@@ -1128,7 +1140,8 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
g_object_unref (ecaltz);
g_object_unref (newcomp);
g_object_unref (oldcomp);
- *old_component = NULL;
+ g_slist_free (*old_components);
+ *old_components = NULL;
return;
}
@@ -1149,11 +1162,12 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
g_object_unref (ecaltz);
g_object_unref (newcomp);
g_object_unref (oldcomp);
- *old_component = NULL;
+ g_slist_free (*old_components);
+ *old_components = NULL;
return;
}
e_cal_backend_notify_component_modified (E_CAL_BACKEND (backend),
- *old_component,
+ (*old_components)->data,
newcomp);
g_object_unref (newcomp);
if (oldtz != NULL)
@@ -1173,7 +1187,7 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
return;
}
- *new_component = ecalcomp;
+ *new_components = g_slist_append (NULL, ecalcomp);
if (is_instance) {
e_cal_backend_notify_component_created (E_CAL_BACKEND (backend),
ecalcomp);
@@ -1184,17 +1198,15 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
}
/**
- * e_cal_backend_kolab_remove_object:
+ * e_cal_backend_kolab_remove_objects:
* @backend: An ECalBackendSync object.
* @cal: An EDataCal object.
* @cancellable: A cancellation stack.
- * @uid: UID of the object to remove.
- * @rid: Recurrence ID of the instance to remove, or NULL if removing the
- * whole object.
+ * @id: a #GSList of #ECalComponentId-s of the objects to remove.
* @mod: Type of removal.
- * @old_component: Placeholder for returning the old object as it was stored on the
+ * @old_components: Placeholder for returning the old objects as they were stored on the
* backend.
- * @new_component: Placeholder for returning the object after it has been modified (when
+ * @new_components: Placeholder for returning the objects after they have been modified (when
* removing individual instances). If removing the whole object, this will be
* NULL.
* @err: A GError placeholder.
@@ -1203,15 +1215,14 @@ e_cal_backend_kolab_modify_object (ECalBackendSync *backend,
* backend will notify all of its clients about the change.
*/
static void
-e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *uid,
- const gchar *rid,
- CalObjModType mod,
- ECalComponent **old_component,
- ECalComponent **new_component,
- GError **error)
+e_cal_backend_kolab_remove_objects (ECalBackendSync *backend,
+ EDataCal *cal,
+ GCancellable *cancellable,
+ const GSList *ids,
+ CalObjModType mod,
+ GSList **old_components,
+ GSList **new_components,
+ GError **error)
{
ECalBackendKolab *self = NULL;
ECalBackendKolabPrivate *priv = NULL;
@@ -1219,6 +1230,7 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
ECalComponent *newcomp = NULL;
ECalComponent *oldtz = NULL;
ECalComponentId *id = NULL;
+ const gchar *uid, *rid;
KolabSettingsHandler *ksettings = NULL;
gchar *sourcename = NULL;
GError *tmp_err = NULL;
@@ -1229,10 +1241,20 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
e_return_data_cal_error_if_fail (E_IS_CAL_BACKEND_KOLAB (backend), InvalidArg);
e_return_data_cal_error_if_fail (E_IS_DATA_CAL (cal), InvalidArg);
/* cancellable may be NULL */
- e_return_data_cal_error_if_fail (uid != NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (ids != NULL && ids->data != NULL, InvalidArg);
/* rid may be NULL */
- e_return_data_cal_error_if_fail (old_component != NULL && *old_component == NULL, InvalidArg);
- e_return_data_cal_error_if_fail (new_component != NULL && *new_component == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (old_components != NULL && *old_components == NULL, InvalidArg);
+ e_return_data_cal_error_if_fail (new_components != NULL && *new_components == NULL, InvalidArg);
+
+ if (ids->next) {
+ g_propagate_error (error, e_data_cal_create_error (UnsupportedMethod, "Kolab does not support bulk removals"));
+ return;
+ }
+
+ id = ids->data;
+ uid = id->uid;
+ rid = id->rid;
+ id = NULL;
self = E_CAL_BACKEND_KOLAB (backend);
priv = E_CAL_BACKEND_KOLAB_PRIVATE (self);
@@ -1270,7 +1292,7 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
return;
}
- *old_component = oldcomp;
+ *old_components = g_slist_append (NULL, oldcomp);
id = e_cal_component_get_id (oldcomp);
switch (mod) {
@@ -1298,10 +1320,11 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
e_cal_component_free_id (id);
g_object_unref (newcomp);
g_object_unref (oldcomp);
- *old_component = NULL;
+ g_slist_free (*old_components);
+ *old_components = NULL;
return;
}
- *new_component = newcomp;
+ *new_components = g_slist_append (NULL, newcomp);
break;
case CALOBJ_MOD_THISANDPRIOR: /* not supported by backend, should not be reached */
g_warning ("%s()[%u]: removing this and prior not supported.",
@@ -1328,7 +1351,8 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
g_error_free (tmp_err);
e_cal_component_free_id (id);
g_object_unref (oldcomp);
- *old_component = NULL;
+ g_slist_free (*old_components);
+ *old_components = NULL;
return;
}
}
@@ -1343,7 +1367,8 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
e_cal_component_free_id (id);
g_free (sourcename);
g_object_unref (oldcomp);
- *old_component = NULL;
+ g_slist_free (*old_components);
+ *old_components = NULL;
return;
}
if (trigger_needed) {
@@ -1361,8 +1386,8 @@ e_cal_backend_kolab_remove_object (ECalBackendSync *backend,
e_cal_backend_notify_component_removed (E_CAL_BACKEND (backend),
id,
- *old_component,
- *new_component);
+ (*old_components)->data,
+ (*new_components)->data);
e_cal_component_free_id (id);
}
@@ -2020,9 +2045,9 @@ e_cal_backend_kolab_class_init (ECalBackendKolabClass *klass)
sync_class->get_object_sync = e_cal_backend_kolab_get_object;
sync_class->get_object_list_sync = e_cal_backend_kolab_get_object_list;
sync_class->get_free_busy_sync = e_cal_backend_kolab_get_free_busy;
- sync_class->create_object_sync = e_cal_backend_kolab_create_object;
- sync_class->modify_object_sync = e_cal_backend_kolab_modify_object;
- sync_class->remove_object_sync = e_cal_backend_kolab_remove_object;
+ sync_class->create_objects_sync = e_cal_backend_kolab_create_objects;
+ sync_class->modify_objects_sync = e_cal_backend_kolab_modify_objects;
+ sync_class->remove_objects_sync = e_cal_backend_kolab_remove_objects;
sync_class->receive_objects_sync = e_cal_backend_kolab_receive_objects;
sync_class->send_objects_sync = e_cal_backend_kolab_send_objects;
sync_class->get_attachment_uris_sync = e_cal_backend_kolab_get_attachment_uris;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]