[evolution-data-server/rbradford-wip-ecal-async-api: 2/5] e-cal: Implement e_cal_modify_object_async
- From: Rob Bradford <rbradford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/rbradford-wip-ecal-async-api: 2/5] e-cal: Implement e_cal_modify_object_async
- Date: Tue, 3 Aug 2010 14:31:11 +0000 (UTC)
commit f75fdf9122f047fb87ac05b31d829d668cfacc0c
Author: Rob Bradford <rob linux intel com>
Date: Tue Aug 3 14:24:58 2010 +0100
e-cal: Implement e_cal_modify_object_async
calendar/libecal/e-cal.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++
calendar/libecal/e-cal.h | 8 +++++
2 files changed, 73 insertions(+), 0 deletions(-)
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index b367a82..5600961 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -4186,3 +4186,68 @@ e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error)
/* FIXME Fill in error */
return FALSE;
}
+
+typedef struct {
+ ECal *ecal;
+ gpointer callback;
+ gpointer closure;
+ gpointer data;
+} AsyncData;
+
+static void
+modify_object_reply_cb (GObject *gdbus_ecal,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *error = NULL;
+ AsyncData *data = user_data;
+ ECalAsyncCallback cb = data->callback;
+
+ e_gdbus_cal_call_modify_object_finish (E_GDBUS_CAL (gdbus_ecal), res, &error);
+
+ unwrap_gerror (&error);
+ if (cb)
+ cb (data->ecal, error, data->closure);
+
+ if (error)
+ g_error_free (error);
+
+ g_object_unref (data->ecal);
+ g_slice_free (AsyncData, data);
+}
+
+gboolean
+e_cal_modify_object_async (ECal *ecal,
+ icalcomponent *icalcomp,
+ CalObjModType mod,
+ ECalAsyncCallback cb,
+ gpointer closure,
+ GError **error)
+{
+ ECalPrivate *priv;
+ gchar *obj;
+ AsyncData *data;
+
+ e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
+ e_return_error_if_fail (icalcomp, E_CALENDAR_STATUS_INVALID_ARG);
+ e_return_error_if_fail (icalcomponent_is_valid (icalcomp), E_CALENDAR_STATUS_INVALID_ARG);
+ e_return_error_if_fail (mod & CALOBJ_MOD_ALL, E_CALENDAR_STATUS_INVALID_ARG);
+ priv = ecal->priv;
+ e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+
+ if (priv->load_state != E_CAL_LOAD_LOADED) {
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
+ }
+
+ obj = icalcomponent_as_ical_string_r (icalcomp);
+
+ data = g_slice_new0 (AsyncData);
+ data->ecal = g_object_ref (ecal);
+ data->callback = cb;
+ data->closure = closure;
+
+ e_gdbus_cal_call_modify_object (priv->gdbus_cal, obj, mod, NULL, modify_object_reply_cb, data);
+
+ g_free (obj);
+ return TRUE;
+}
diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h
index 996f185..f005268 100644
--- a/calendar/libecal/e-cal.h
+++ b/calendar/libecal/e-cal.h
@@ -216,6 +216,14 @@ const gchar * e_cal_get_local_attachment_store (ECal *ecal);
gboolean e_cal_get_recurrences_no_master (ECal *ecal);
gboolean e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid, GSList **list, GError **error);
+
+gboolean e_cal_modify_object_async (ECal *ecal,
+ icalcomponent *icalcomp,
+ CalObjModType mod,
+ ECalAsyncCallback cb,
+ gpointer closure,
+ GError **error);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]