[evolution-data-server/eclient] Re-implement discardAlarm method and its e_cal_client_discard_alarm()



commit ca2033174ad537a3e5ad35b28c57a968105713af
Author: Milan Crha <mcrha redhat com>
Date:   Fri May 13 15:26:15 2011 +0200

    Re-implement discardAlarm method and its e_cal_client_discard_alarm()

 calendar/libecal/e-cal-client.c            |   92 ++++++++++++++++++++++++++++
 calendar/libecal/e-cal-client.h            |    4 +
 calendar/libecal/e-cal.c                   |    2 +-
 calendar/libedata-cal/e-cal-backend-sync.c |   33 ++++++++++
 calendar/libedata-cal/e-cal-backend-sync.h |    2 +
 calendar/libedata-cal/e-cal-backend.c      |   30 +++++++++
 calendar/libedata-cal/e-cal-backend.h      |    2 +
 calendar/libedata-cal/e-data-cal.c         |   52 +++++++++++++++-
 calendar/libedata-cal/e-data-cal.h         |    1 +
 calendar/libegdbus/e-gdbus-cal.c           |   64 +++++++++++++++++++
 calendar/libegdbus/e-gdbus-cal.h           |   11 +++
 11 files changed, 291 insertions(+), 2 deletions(-)
---
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index 215e736..3cb33f1 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -3348,6 +3348,98 @@ e_cal_client_get_attachment_uris_sync (ECalClient *client, const gchar *uid, con
 }
 
 /**
+ * e_cal_client_discard_alarm:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @rid: Recurrence identifier
+ * @auid: Alarm identifier to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @callback: callback to call when a result is ready
+ * @user_data: user data for the @callback
+ *
+ * Removes alarm @auid from a given component identified by @uid and @rid.
+ * The call is finished by e_cal_client_discard_alarm_finish() from
+ * the @callback.
+ *
+ * Since: 3.2
+ **/
+void
+e_cal_client_discard_alarm (ECalClient *client, const gchar *uid, const gchar *rid, const gchar *auid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	gchar **strv;
+
+	g_return_if_fail (uid != NULL);
+	g_return_if_fail (auid != NULL);
+
+	strv = e_gdbus_cal_encode_discard_alarm (uid, rid, auid);
+
+	e_client_proxy_call_strv (E_CLIENT (client), (const gchar * const *) strv, cancellable, callback, user_data, e_cal_client_discard_alarm,
+			e_gdbus_cal_call_discard_alarm,
+			e_gdbus_cal_call_discard_alarm_finish, NULL, NULL, NULL, NULL);
+
+	g_strfreev (strv);
+}
+
+/**
+ * e_cal_client_discard_alarm_finish:
+ * @client: an #ECalClient
+ * @result: a #GAsyncResult
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Finishes previous call of e_cal_client_discard_alarm().
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_discard_alarm_finish (ECalClient *client, GAsyncResult *result, GError **error)
+{
+	return e_client_proxy_call_finish_void (E_CLIENT (client), result, error, e_cal_client_discard_alarm);
+}
+
+/**
+ * e_cal_client_discard_alarm_sync:
+ * @client: an #ECalClient
+ * @uid: Unique identifier for a calendar component
+ * @rid: Recurrence identifier
+ * @auid: Alarm identifier to remove
+ * @cancellable: a #GCancellable; can be %NULL
+ * @error: (out): a #GError to set an error, if any
+ *
+ * Removes alarm @auid from a given component identified by @uid and @rid.
+ *
+ * Returns: %TRUE if successful, %FALSE otherwise.
+ *
+ * Since: 3.2
+ **/
+gboolean
+e_cal_client_discard_alarm_sync (ECalClient *client, const gchar *uid, const gchar *rid, const gchar *auid, GCancellable *cancellable, GError **error)
+{
+	gboolean res;
+	gchar **strv;
+
+	g_return_val_if_fail (client != NULL, FALSE);
+	g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
+	g_return_val_if_fail (client->priv != NULL, FALSE);
+	g_return_val_if_fail (uid != NULL, FALSE);
+	g_return_val_if_fail (auid != NULL, FALSE);
+
+	if (!client->priv->gdbus_cal) {
+		set_proxy_gone_error (error);
+		return FALSE;
+	}
+
+	strv = e_gdbus_cal_encode_discard_alarm (uid, rid, auid);
+
+	res = e_client_proxy_call_sync_strv__void (E_CLIENT (client), (const gchar * const *) strv, cancellable, error, e_gdbus_cal_call_discard_alarm_sync);
+
+	g_strfreev (strv);
+
+	return res;
+}
+
+/**
  * e_cal_client_get_view:
  * @client: an #ECalClient
  * @sexp: an S-expression representing the query.
diff --git a/calendar/libecal/e-cal-client.h b/calendar/libecal/e-cal-client.h
index 53f9cfa..00278cd 100644
--- a/calendar/libecal/e-cal-client.h
+++ b/calendar/libecal/e-cal-client.h
@@ -173,6 +173,10 @@ void		e_cal_client_get_attachment_uris		(ECalClient *client, const gchar *uid, c
 gboolean	e_cal_client_get_attachment_uris_finish		(ECalClient *client, GAsyncResult *result, GSList **attachment_uris, GError **error);
 gboolean	e_cal_client_get_attachment_uris_sync		(ECalClient *client, const gchar *uid, const gchar *rid, GSList **attachment_uris, GCancellable *cancellable, GError **error);
 
+void		e_cal_client_discard_alarm			(ECalClient *client, const gchar *uid, const gchar *rid, const gchar *auid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_cal_client_discard_alarm_finish		(ECalClient *client, GAsyncResult *result, GError **error);
+gboolean	e_cal_client_discard_alarm_sync			(ECalClient *client, const gchar *uid, const gchar *rid, const gchar *auid, GCancellable *cancellable, GError **error);
+
 void		e_cal_client_get_view				(ECalClient *client, const gchar *sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
 gboolean	e_cal_client_get_view_finish			(ECalClient *client, GAsyncResult *result, ECalClientView **view, GError **error);
 gboolean	e_cal_client_get_view_sync			(ECalClient *client, const gchar *sexp, ECalClientView **view, GCancellable *cancellable, GError **error);
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index cd6cf0b..9a2d37c 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -3588,7 +3588,7 @@ e_cal_get_alarms_for_object (ECal *ecal, const ECalComponentId *id,
  *
  * Returns: TRUE if the operation was successful, FALSE otherwise.
  *
- * Deprecated: 3.2: This function has been dropped completely.
+ * Deprecated: 3.2: Use e_cal_client_discard_alarm_sync() instead.
  */
 gboolean
 e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const gchar *auid, GError **error)
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 29f6984..b214c4a 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -397,6 +397,28 @@ e_cal_backend_sync_get_attachment_uris (ECalBackendSync *backend, EDataCal *cal,
 }
 
 /**
+ * e_cal_backend_sync_discard_alarm:
+ * @backend: An ECalBackendSync object.
+ * @cal: An EDataCal object.
+ * @cancellable: a #GCancellable for the operation
+ * @uid: Unique id of the calendar object.
+ * @rid: Recurrence id of the calendar object.
+ * @auid: Alarm ID to remove.
+ * @error: Out parameter for a #GError.
+ *
+ * Calls the discard_alarm_sync method on the given backend.
+ **/
+void
+e_cal_backend_sync_discard_alarm (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid, GError **error)
+{
+	e_return_data_cal_error_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
+	e_return_data_cal_error_if_fail (uid, InvalidArg);
+	e_return_data_cal_error_if_fail (auid, InvalidArg);
+
+	LOCK_WRAPPER (discard_alarm_sync, (backend, cal, cancellable, uid, rid, auid, error));
+}
+
+/**
  * e_cal_backend_sync_get_timezone:
  * @backend: An ECalBackendSync object.
  * @cal: An EDataCal object.
@@ -660,6 +682,16 @@ cal_backend_get_attachment_uris (ECalBackend *backend, EDataCal *cal, guint32 op
 }
 
 static void
+cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid)
+{
+	GError *error = NULL;
+
+	e_cal_backend_sync_discard_alarm (E_CAL_BACKEND_SYNC (backend), cal, cancellable, uid, rid, auid, &error);
+
+	e_data_cal_respond_discard_alarm (cal, opid, error);
+}
+
+static void
 cal_backend_get_timezone (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid)
 {
 	GError *error = NULL;
@@ -835,6 +867,7 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *klass)
 	backend_class->receive_objects		= cal_backend_receive_objects;
 	backend_class->send_objects		= cal_backend_send_objects;
 	backend_class->get_attachment_uris	= cal_backend_get_attachment_uris;
+	backend_class->discard_alarm		= cal_backend_discard_alarm;
 	backend_class->get_timezone		= cal_backend_get_timezone;
 	backend_class->add_timezone		= cal_backend_add_timezone;
 	backend_class->internal_get_timezone	= cal_backend_internal_get_timezone;
diff --git a/calendar/libedata-cal/e-cal-backend-sync.h b/calendar/libedata-cal/e-cal-backend-sync.h
index d0bb5ed..17f6cca 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.h
+++ b/calendar/libedata-cal/e-cal-backend-sync.h
@@ -47,6 +47,7 @@ struct _ECalBackendSyncClass {
 	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);
+	void	(* discard_alarm_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid, GError **error);
 	void	(* get_timezone_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error);
 	void	(* add_timezone_sync)		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobject, GError **error);
 };
@@ -70,6 +71,7 @@ void	e_cal_backend_sync_remove_object	(ECalBackendSync *backend, EDataCal *cal,
 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);
+void	e_cal_backend_sync_discard_alarm	(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid, GError **error);
 void	e_cal_backend_sync_get_timezone		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzid, gchar **tzobject, GError **error);
 void	e_cal_backend_sync_add_timezone		(ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *tzobject, GError **error);
 
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index 5556d13..7823d58 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -1136,6 +1136,36 @@ e_cal_backend_get_attachment_uris (ECalBackend *backend, EDataCal *cal, guint32
 }
 
 /**
+ * e_cal_backend_discard_alarm:
+ * @backend: an #ECalBackend
+ * @cal: an #EDataCal
+ * @opid: the ID to use for this operation
+ * @cancellable: a #GCancellable for the operation
+ * @uid: Unique identifier for a calendar object.
+ * @rid: ID for the object's recurrence to discard alarm in.
+ * @auid: Unique identifier of the alarm itself.
+ *
+ * Discards alarm @auid from the object identified by @uid and @rid.
+ * This might be finished with e_data_cal_respond_discard_alarm().
+ * Default implementation of this method returns Not Supported error.
+ **/
+void
+e_cal_backend_discard_alarm (ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid)
+{
+	g_return_if_fail (backend != NULL);
+	g_return_if_fail (E_IS_CAL_BACKEND (backend));
+	g_return_if_fail (uid != NULL);
+	g_return_if_fail (auid != NULL);
+
+	if (!E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm) {
+		e_data_cal_respond_discard_alarm (cal, opid, e_data_cal_create_error (NotSupported, NULL));
+		return;
+	}
+
+	(* E_CAL_BACKEND_GET_CLASS (backend)->discard_alarm) (backend, cal, opid, cancellable, uid, rid, auid);
+}
+
+/**
  * e_cal_backend_get_timezone:
  * @backend: an #ECalBackend
  * @cal: an #EDataCal
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index fdbd849..5b33152 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -84,6 +84,7 @@ struct _ECalBackendClass {
 	void	(* receive_objects)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
 	void	(* send_objects)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
 	void	(* get_attachment_uris)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+	void	(* discard_alarm)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid);
 	void	(* get_timezone)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid);
 	void	(* add_timezone)		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject);
 
@@ -136,6 +137,7 @@ void		e_cal_backend_remove_object		(ECalBackend *backend, EDataCal *cal, guint32
 void		e_cal_backend_receive_objects		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
 void		e_cal_backend_send_objects		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *calobj);
 void		e_cal_backend_get_attachment_uris	(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid);
+void		e_cal_backend_discard_alarm		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *uid, const gchar *rid, const gchar *auid);
 void		e_cal_backend_get_timezone		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzid);
 void		e_cal_backend_add_timezone		(ECalBackend *backend, EDataCal *cal, guint32 opid, GCancellable *cancellable, const gchar *tzobject);
 icaltimezone *	e_cal_backend_internal_get_timezone	(ECalBackend *backend, const gchar *tzid);
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index 6f4d52d..c8f8292 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -72,6 +72,7 @@ typedef enum {
 	OP_RECEIVE_OBJECTS,
 	OP_SEND_OBJECTS,
 	OP_GET_ATTACHMENT_URIS,
+	OP_DISCARD_ALARM,
 	OP_GET_VIEW,
 	OP_GET_TIMEZONE,
 	OP_ADD_TIMEZONE,
@@ -97,6 +98,12 @@ typedef struct {
 			gchar *uid;
 			gchar *rid;
 		} ur;
+		/* OP_DISCARD_ALARM */
+		struct _ura {
+			gchar *uid;
+			gchar *rid;
+			gchar *auid;
+		} ura;
 		/* OP_GET_OBJECT_LIST */
 		/* OP_GET_VIEW */
 		gchar *sexp;
@@ -230,6 +237,12 @@ operation_thread (gpointer data, gpointer user_data)
 		g_free (op->d.ur.uid);
 		g_free (op->d.ur.rid);
 		break;
+	case OP_DISCARD_ALARM:
+		e_cal_backend_discard_alarm (backend, op->cal, op->id, op->cancellable, op->d.ura.uid, op->d.ura.rid && *op->d.ura.rid ? op->d.ura.rid : NULL, op->d.ura.auid);
+		g_free (op->d.ura.uid);
+		g_free (op->d.ura.rid);
+		g_free (op->d.ura.auid);
+		break;
 	case OP_GET_VIEW:
 		if (op->d.sexp) {
 			EDataCalView *view;
@@ -766,6 +779,20 @@ impl_Cal_getAttachmentUris (EGdbusCal *object, GDBusMethodInvocation *invocation
 }
 
 static gboolean
+impl_Cal_discardAlarm (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid_auid, EDataCal *cal)
+{
+	OperationData *op;
+
+	op = op_new (OP_DISCARD_ALARM, cal);
+	g_return_val_if_fail (e_gdbus_cal_decode_discard_alarm (in_uid_rid_auid, &op->d.ura.uid, &op->d.ura.rid, &op->d.ura.auid), FALSE);
+
+	e_gdbus_cal_complete_discard_alarm (cal->priv->gdbus_object, invocation, op->id);
+	e_operation_pool_push (ops_pool, op);
+
+	return TRUE;
+}
+
+static gboolean
 impl_Cal_getView (EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp, EDataCal *cal)
 {
 	OperationData *op;
@@ -1204,7 +1231,8 @@ e_data_cal_respond_send_objects (EDataCal *cal, guint32 opid, GError *error, con
  * @error: Operation error, if any, automatically freed if passed it.
  * @attachment_uris: List of retrieved attachment uri's.
  *
- * Notifies listeners of the completion of the get_attachment_uris method call.+ */
+ * Notifies listeners of the completion of the get_attachment_uris method call.
+ **/
 void
 e_data_cal_respond_get_attachment_uris (EDataCal *cal, guint32 opid, GError *error, const GSList *attachment_uris)
 {
@@ -1225,6 +1253,27 @@ e_data_cal_respond_get_attachment_uris (EDataCal *cal, guint32 opid, GError *err
 }
 
 /**
+ * e_data_cal_respond_discard_alarm:
+ * @cal: A calendar client interface.
+ * @error: Operation error, if any, automatically freed if passed it.
+ *
+ * Notifies listeners of the completion of the discard_alarm method call.
+ **/
+void
+e_data_cal_respond_discard_alarm (EDataCal *cal, guint32 opid, GError *error)
+{
+	op_complete (cal, opid);
+
+	/* Translators: This is prefix to a detailed error message */
+	g_prefix_error (&error, "%s", _("Could not discard alarm: "));
+
+	e_gdbus_cal_emit_discard_alarm_done (cal->priv->gdbus_object, opid, error);
+
+	if (error)
+		g_error_free (error);
+}
+
+/**
  * e_data_cal_respond_get_view:
  * @cal: A calendar client interface.
  * @error: Operation error, if any, automatically freed if passed it.
@@ -1384,6 +1433,7 @@ e_data_cal_init (EDataCal *ecal)
 	g_signal_connect (gdbus_object, "handle-receive-objects", G_CALLBACK (impl_Cal_receiveObjects), ecal);
 	g_signal_connect (gdbus_object, "handle-send-objects", G_CALLBACK (impl_Cal_sendObjects), ecal);
 	g_signal_connect (gdbus_object, "handle-get-attachment-uris", G_CALLBACK (impl_Cal_getAttachmentUris), ecal);
+	g_signal_connect (gdbus_object, "handle-discard-alarm", G_CALLBACK (impl_Cal_discardAlarm), ecal);
 	g_signal_connect (gdbus_object, "handle-get-view", G_CALLBACK (impl_Cal_getView), ecal);
 	g_signal_connect (gdbus_object, "handle-get-timezone", G_CALLBACK (impl_Cal_getTimezone), ecal);
 	g_signal_connect (gdbus_object, "handle-add-timezone", G_CALLBACK (impl_Cal_addTimezone), ecal);
diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h
index ae03c9e..3a538ef 100644
--- a/calendar/libedata-cal/e-data-cal.h
+++ b/calendar/libedata-cal/e-data-cal.h
@@ -145,6 +145,7 @@ void		e_data_cal_respond_remove_object		(EDataCal *cal, guint32 opid, GError *er
 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 *attachments);
+void		e_data_cal_respond_discard_alarm		(EDataCal *cal, guint32 opid, GError *error);
 void		e_data_cal_respond_get_view			(EDataCal *cal, guint32 opid, GError *error, const gchar *view_path);
 void		e_data_cal_respond_get_timezone			(EDataCal *cal, guint32 opid, GError *error, const gchar *tzobject);
 void		e_data_cal_respond_add_timezone			(EDataCal *cal, guint32 opid, GError *error);
diff --git a/calendar/libegdbus/e-gdbus-cal.c b/calendar/libegdbus/e-gdbus-cal.c
index 4acf899..54a89e0 100644
--- a/calendar/libegdbus/e-gdbus-cal.c
+++ b/calendar/libegdbus/e-gdbus-cal.c
@@ -71,6 +71,8 @@ enum
 	__SEND_OBJECTS_DONE_SIGNAL,
 	__GET_ATTACHMENT_URIS_METHOD,
 	__GET_ATTACHMENT_URIS_DONE_SIGNAL,
+	__DISCARD_ALARM_METHOD,
+	__DISCARD_ALARM_DONE_SIGNAL,
 	__GET_VIEW_METHOD,
 	__GET_VIEW_DONE_SIGNAL,
 	__GET_TIMEZONE_METHOD,
@@ -146,6 +148,7 @@ E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME,
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, receive_objects)
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, send_objects)
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRV	(GDBUS_CAL_INTERFACE_NAME, get_attachment_uris)
+E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, discard_alarm)
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_view)
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_STRING	(GDBUS_CAL_INTERFACE_NAME, get_timezone)
 E_DECLARE_GDBUS_METHOD_DONE_EMISSION_HOOK_ASYNC_VOID	(GDBUS_CAL_INTERFACE_NAME, add_timezone)
@@ -182,6 +185,7 @@ e_gdbus_cal_default_init (EGdbusCalIface *iface)
 	E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID	(EGdbusCalIface, "receiveObjects",		receive_objects, __RECEIVE_OBJECTS_METHOD, __RECEIVE_OBJECTS_DONE_SIGNAL)
 	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRV	(EGdbusCalIface, "sendObjects",			send_objects, __SEND_OBJECTS_METHOD, __SEND_OBJECTS_DONE_SIGNAL)
 	E_INIT_GDBUS_METHOD_ASYNC_STRV__STRV	(EGdbusCalIface, "getAttachmentUris",		get_attachment_uris, __GET_ATTACHMENT_URIS_METHOD, __GET_ATTACHMENT_URIS_DONE_SIGNAL)
+	E_INIT_GDBUS_METHOD_ASYNC_STRV__VOID	(EGdbusCalIface, "discardAlarm",		discard_alarm, __DISCARD_ALARM_METHOD, __DISCARD_ALARM_DONE_SIGNAL)
 	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusCalIface, "getView",			get_view, __GET_VIEW_METHOD, __GET_VIEW_DONE_SIGNAL)
 	E_INIT_GDBUS_METHOD_ASYNC_STRING__STRING(EGdbusCalIface, "getTimezone",			get_timezone, __GET_TIMEZONE_METHOD, __GET_TIMEZONE_DONE_SIGNAL)
 	E_INIT_GDBUS_METHOD_ASYNC_STRING__VOID	(EGdbusCalIface, "addTimezone",			add_timezone, __ADD_TIMEZONE_METHOD, __ADD_TIMEZONE_DONE_SIGNAL)
@@ -721,6 +725,61 @@ e_gdbus_cal_call_get_attachment_uris_sync (GDBusProxy *proxy, const gchar * cons
 		e_gdbus_cal_call_get_attachment_uris_finish);
 }
 
+/* free returned pointer with g_strfreev() */
+gchar **
+e_gdbus_cal_encode_discard_alarm (const gchar *in_uid, const gchar *in_rid, const gchar *in_auid)
+{
+	gchar **strv;
+
+	strv = g_new0 (gchar *, 4);
+	strv[0] = e_util_utf8_make_valid (in_uid ? in_uid : "");
+	strv[1] = e_util_utf8_make_valid (in_rid ? in_rid : "");
+	strv[2] = e_util_utf8_make_valid (in_auid ? in_auid : "");
+	strv[3] = NULL;
+
+	return strv;
+}
+
+/* free out_uid, out_rid and out_auid with g_free() */
+gboolean
+e_gdbus_cal_decode_discard_alarm (const gchar * const *in_strv, gchar **out_uid, gchar **out_rid, gchar **out_auid)
+{
+	g_return_val_if_fail (in_strv != NULL, FALSE);
+	g_return_val_if_fail (in_strv[0] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[1] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[2] != NULL, FALSE);
+	g_return_val_if_fail (in_strv[3] == NULL, FALSE);
+	g_return_val_if_fail (out_uid != NULL, FALSE);
+	g_return_val_if_fail (out_rid != NULL, FALSE);
+	g_return_val_if_fail (out_auid != NULL, FALSE);
+
+	*out_uid = g_strdup (in_strv[0]);
+	*out_rid = g_strdup (in_strv[1]);
+	*out_auid = g_strdup (in_strv[2]);
+
+	return TRUE;
+}
+
+void
+e_gdbus_cal_call_discard_alarm (GDBusProxy *proxy, const gchar * const *in_uid_rid_auid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
+{
+	e_gdbus_proxy_call_strv ("discardAlarm", e_gdbus_cal_call_discard_alarm, E_GDBUS_ASYNC_OP_KEEPER (proxy), in_uid_rid_auid, cancellable, callback, user_data);
+}
+
+gboolean
+e_gdbus_cal_call_discard_alarm_finish (GDBusProxy *proxy, GAsyncResult *result, GError **error)
+{
+	return e_gdbus_proxy_finish_call_void (E_GDBUS_ASYNC_OP_KEEPER (proxy), result, error, e_gdbus_cal_call_discard_alarm);
+}
+
+gboolean
+e_gdbus_cal_call_discard_alarm_sync (GDBusProxy *proxy, const gchar * const *in_uid_rid_auid, GCancellable *cancellable, GError **error)
+{
+	return e_gdbus_proxy_call_sync_strv__void (proxy, in_uid_rid_auid, cancellable, error,
+		e_gdbus_cal_call_discard_alarm,
+		e_gdbus_cal_call_discard_alarm_finish);
+}
+
 void
 e_gdbus_cal_call_get_view (GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
 {
@@ -864,6 +923,7 @@ DECLARE_EMIT_DONE_SIGNAL_0 (remove_object,		__REMOVE_OBJECT_DONE_SIGNAL)
 DECLARE_EMIT_DONE_SIGNAL_0 (receive_objects,		__RECEIVE_OBJECTS_DONE_SIGNAL)
 DECLARE_EMIT_DONE_SIGNAL_1 (send_objects,		__SEND_OBJECTS_DONE_SIGNAL, const gchar * const *)
 DECLARE_EMIT_DONE_SIGNAL_1 (get_attachment_uris,	__GET_ATTACHMENT_URIS_DONE_SIGNAL, const gchar * const *)
+DECLARE_EMIT_DONE_SIGNAL_0 (discard_alarm,		__DISCARD_ALARM_DONE_SIGNAL)
 DECLARE_EMIT_DONE_SIGNAL_1 (get_view,			__GET_VIEW_DONE_SIGNAL, const gchar *)
 DECLARE_EMIT_DONE_SIGNAL_1 (get_timezone,		__GET_TIMEZONE_DONE_SIGNAL, const gchar *)
 DECLARE_EMIT_DONE_SIGNAL_0 (add_timezone,		__ADD_TIMEZONE_DONE_SIGNAL)
@@ -922,6 +982,7 @@ E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, removeObject, uid_rid_mod, "as")
 E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, receiveObjects, object, "s")
 E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, sendObjects, object, "s", object_users, "as")
 E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getAttachmentUris, uid_rid, "as", attachments, "as")
+E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, discardAlarm, uid_rid_auid, "as")
 E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getView, sexp, "s", view_path, "s")
 E_DECLARE_GDBUS_ASYNC_METHOD_1_WITH_RETURN	(cal, getTimezone, tzid, "s", tzobject, "s")
 E_DECLARE_GDBUS_ASYNC_METHOD_1			(cal, addTimezone, tzobject, "s")
@@ -947,6 +1008,7 @@ static const GDBusMethodInfo * const e_gdbus_cal_method_info_pointers[] =
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, receiveObjects),
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, sendObjects),
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getAttachmentUris),
+	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, discardAlarm),
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getView),
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, getTimezone),
 	&E_DECLARED_GDBUS_METHOD_INFO_NAME (cal, addTimezone),
@@ -979,6 +1041,7 @@ static const GDBusSignalInfo * const e_gdbus_cal_signal_info_pointers[] =
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, receiveObjects_done),
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, sendObjects_done),
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getAttachmentUris_done),
+	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, discardAlarm_done),
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getView_done),
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, getTimezone_done),
 	&E_DECLARED_GDBUS_SIGNAL_INFO_NAME (cal, addTimezone_done),
@@ -1202,6 +1265,7 @@ e_gdbus_cal_proxy_init (EGdbusCalProxy *proxy)
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (receive_objects);
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (send_objects);
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRV   (get_attachment_uris);
+	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (discard_alarm);
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_view);
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_STRING (get_timezone);
 	E_GDBUS_CONNECT_METHOD_DONE_SIGNAL_VOID   (add_timezone);
diff --git a/calendar/libegdbus/e-gdbus-cal.h b/calendar/libegdbus/e-gdbus-cal.h
index 760b88e..79bbb90 100644
--- a/calendar/libegdbus/e-gdbus-cal.h
+++ b/calendar/libegdbus/e-gdbus-cal.h
@@ -155,6 +155,9 @@ struct _EGdbusCalIface
 	gboolean (*handle_get_attachment_uris)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid);
 	void	 (*get_attachment_uris_done)		(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar ***out_attachments);
 
+	gboolean (*handle_discard_alarm)		(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar * const *in_uid_rid_auid);
+	void	 (*discard_alarm_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error);
+
 	gboolean (*handle_get_view)			(EGdbusCal *object, GDBusMethodInvocation *invocation, const gchar *in_sexp);
 	void	 (*get_view_done)			(EGdbusCal *object, guint arg_opid, const GError *arg_error, gchar **out_view_path);
 
@@ -244,6 +247,12 @@ void		e_gdbus_cal_call_get_attachment_uris		(GDBusProxy *proxy, const gchar * co
 gboolean	e_gdbus_cal_call_get_attachment_uris_finish	(GDBusProxy *proxy, GAsyncResult *result, gchar ***out_attachments, GError **error);
 gboolean	e_gdbus_cal_call_get_attachment_uris_sync	(GDBusProxy *proxy, const gchar * const *in_uid_rid, gchar ***out_attachments, GCancellable *cancellable, GError **error);
 
+gchar **	e_gdbus_cal_encode_discard_alarm		(const gchar *in_uid, const gchar *in_rid, const gchar *in_auid);
+gboolean	e_gdbus_cal_decode_discard_alarm		(const gchar * const *in_strv, gchar **out_uid, gchar **out_rid, gchar **out_auid);
+void		e_gdbus_cal_call_discard_alarm			(GDBusProxy *proxy, const gchar * const *in_uid_rid_auid, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+gboolean	e_gdbus_cal_call_discard_alarm_finish		(GDBusProxy *proxy, GAsyncResult *result, GError **error);
+gboolean	e_gdbus_cal_call_discard_alarm_sync		(GDBusProxy *proxy, const gchar * const *in_uid_rid_auid, GCancellable *cancellable, GError **error);
+
 void		e_gdbus_cal_call_get_view			(GDBusProxy *proxy, const gchar *in_sexp, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
 gboolean	e_gdbus_cal_call_get_view_finish		(GDBusProxy *proxy, GAsyncResult *result, gchar **out_view_path, GError **error);
 gboolean	e_gdbus_cal_call_get_view_sync			(GDBusProxy *proxy, const gchar *in_sexp, gchar **out_view_path, GCancellable *cancellable, GError **error);
@@ -284,6 +293,7 @@ gboolean	e_gdbus_cal_call_close_sync			(GDBusProxy *proxy, GCancellable *cancell
 #define e_gdbus_cal_complete_receive_objects		e_gdbus_complete_async_method
 #define e_gdbus_cal_complete_send_objects		e_gdbus_complete_async_method
 #define e_gdbus_cal_complete_get_attachment_uris	e_gdbus_complete_async_method
+#define e_gdbus_cal_complete_discard_alarm		e_gdbus_complete_async_method
 #define e_gdbus_cal_complete_get_view			e_gdbus_complete_async_method
 #define e_gdbus_cal_complete_get_timezone		e_gdbus_complete_async_method
 #define e_gdbus_cal_complete_add_timezone		e_gdbus_complete_async_method
@@ -307,6 +317,7 @@ void e_gdbus_cal_emit_remove_object_done		(EGdbusCal *object, guint arg_opid, co
 void e_gdbus_cal_emit_receive_objects_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
 void e_gdbus_cal_emit_send_objects_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_calobj_users);
 void e_gdbus_cal_emit_get_attachment_uris_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar * const *out_attachments);
+void e_gdbus_cal_emit_discard_alarm_done		(EGdbusCal *object, guint arg_opid, const GError *arg_error);
 void e_gdbus_cal_emit_get_view_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_view_path);
 void e_gdbus_cal_emit_get_timezone_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error, const gchar *out_object);
 void e_gdbus_cal_emit_add_timezone_done			(EGdbusCal *object, guint arg_opid, const GError *arg_error);



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