1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* Evolution calendar client interface object
4 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
5 * Copyright (C) 2009 Intel Corporation
7 * Authors: Federico Mena-Quintero <federico@ximian.com>
8 * Rodrigo Moya <rodrigo@ximian.com>
9 * Ross Burton <ross@linux.intel.com>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of version 2 of the GNU Lesser General Public
13 * License as published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #include <libical/ical.h>
30 #include <glib/gi18n-lib.h>
33 #include <libedataserver/e-credentials.h>
34 #include <libedataserver/e-data-server-util.h>
35 #include <libedataserver/e-operation-pool.h>
37 #include "e-data-cal.h"
38 #include "e-data-cal-enumtypes.h"
39 #include "e-gdbus-cal.h"
41 #define E_DATA_CAL_GET_PRIVATE(obj) \
42 (G_TYPE_INSTANCE_GET_PRIVATE \
43 ((obj), E_TYPE_DATA_CAL, EDataCalPrivate))
45 #define EDC_ERROR(_code) e_data_cal_create_error (_code, NULL)
46 #define EDC_ERROR_EX(_code, _msg) e_data_cal_create_error (_code, _msg)
48 struct _EDataCalPrivate {
49 EGdbusCal *gdbus_object;
53 GStaticRecMutex pending_ops_lock;
54 GHashTable *pending_ops; /* opid to GCancellable for still running operations */
62 static EOperationPool *ops_pool = NULL;
69 OP_GET_BACKEND_PROPERTY,
70 OP_SET_BACKEND_PROPERTY,
79 OP_GET_ATTACHMENT_URIS,
91 guint32 id; /* operation id */
92 EDataCal *cal; /* calendar */
93 GCancellable *cancellable;
97 gboolean only_if_exists;
99 ECredentials *credentials;
101 /* OP_GET_ATTACHMENT_URIS */
106 /* OP_DISCARD_ALARM */
112 /* OP_GET_OBJECT_LIST */
115 /* OP_GET_FREE_BUSY */
120 /* OP_CREATE_OBJECTS */
122 /* OP_RECEIVE_OBJECTS */
123 /* OP_SEND_OBJECTS */
127 /* OP_MODIFY_OBJECTS */
130 EDataCalObjModType mod;
132 /* OP_REMOVE_OBJECTS */
135 EDataCalObjModType mod;
137 /* OP_GET_TIMEZONE */
139 /* OP_ADD_TIMEZONE */
141 /* OP_CANCEL_OPERATION */
143 /* OP_GET_BACKEND_PROPERTY */
145 /* OP_SET_BACKEND_PROPERTY */
158 G_DEFINE_TYPE (EDataCal, e_data_cal, G_TYPE_OBJECT);
160 /* Function to get a new EDataCalView path, used by get_view below */
162 construct_calview_path (void)
164 static guint counter = 1;
165 return g_strdup_printf ("/org/gnome/evolution/dataserver/CalendarView/%d/%d", getpid(), counter++);
169 cancel_ops_cb (gpointer opid,
170 gpointer cancellable,
173 g_return_if_fail (cancellable != NULL);
175 g_cancellable_cancel (cancellable);
179 operation_thread (gpointer data,
182 OperationData *op = data;
183 ECalBackend *backend;
185 backend = e_data_cal_get_backend (op->cal);
189 e_cal_backend_open (backend, op->cal, op->id, op->cancellable, op->d.only_if_exists);
192 e_cal_backend_remove (backend, op->cal, op->id, op->cancellable);
195 e_cal_backend_refresh (backend, op->cal, op->id, op->cancellable);
197 case OP_GET_BACKEND_PROPERTY:
198 e_cal_backend_get_backend_property (backend, op->cal, op->id, op->cancellable, op->d.prop_name);
199 g_free (op->d.prop_name);
201 case OP_SET_BACKEND_PROPERTY:
202 e_cal_backend_set_backend_property (backend, op->cal, op->id, op->cancellable, op->d.sbp.prop_name, op->d.sbp.prop_value);
203 g_free (op->d.sbp.prop_name);
204 g_free (op->d.sbp.prop_value);
207 e_cal_backend_get_object (backend, op->cal, op->id, op->cancellable, op->d.ur.uid, op->d.ur.rid && *op->d.ur.rid ? op->d.ur.rid : NULL);
208 g_free (op->d.ur.uid);
209 g_free (op->d.ur.rid);
211 case OP_GET_OBJECT_LIST:
212 e_cal_backend_get_object_list (backend, op->cal, op->id, op->cancellable, op->d.sexp);
215 case OP_GET_FREE_BUSY:
216 e_cal_backend_get_free_busy (backend, op->cal, op->id, op->cancellable, op->d.fb.users, op->d.fb.start, op->d.fb.end);
217 g_slist_free_full (op->d.fb.users, g_free);
219 case OP_CREATE_OBJECTS:
220 e_cal_backend_create_objects (backend, op->cal, op->id, op->cancellable, op->d.calobjs);
221 g_slist_free_full (op->d.calobjs, g_free);
223 case OP_MODIFY_OBJECTS:
224 e_cal_backend_modify_objects (backend, op->cal, op->id, op->cancellable, op->d.mo.calobjs, op->d.mo.mod);
225 g_slist_free_full (op->d.mo.calobjs, g_free);
227 case OP_REMOVE_OBJECTS:
228 e_cal_backend_remove_objects (backend, op->cal, op->id, op->cancellable, op->d.ro.ids, op->d.ro.mod);
229 g_slist_free_full (op->d.ro.ids, (GDestroyNotify) e_cal_component_free_id);
231 case OP_RECEIVE_OBJECTS:
232 e_cal_backend_receive_objects (backend, op->cal, op->id, op->cancellable, op->d.co.calobj);
233 g_free (op->d.co.calobj);
235 case OP_SEND_OBJECTS:
236 e_cal_backend_send_objects (backend, op->cal, op->id, op->cancellable, op->d.co.calobj);
237 g_free (op->d.co.calobj);
239 case OP_GET_ATTACHMENT_URIS:
240 e_cal_backend_get_attachment_uris (backend, op->cal, op->id, op->cancellable, op->d.ur.uid, op->d.ur.rid && *op->d.ur.rid ? op->d.ur.rid : NULL);
241 g_free (op->d.ur.uid);
242 g_free (op->d.ur.rid);
244 case OP_DISCARD_ALARM:
245 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);
246 g_free (op->d.ura.uid);
247 g_free (op->d.ura.rid);
248 g_free (op->d.ura.auid);
253 ECalBackendSExp *obj_sexp;
255 GError *error = NULL;
257 /* we handle this entirely here, since it doesn't require any
258 * backend involvement now that we have e_cal_view_start to
259 * actually kick off the search. */
261 obj_sexp = e_cal_backend_sexp_new (op->d.sexp);
264 e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (InvalidQuery), NULL);
268 view = e_data_cal_view_new (backend, obj_sexp);
269 g_object_unref (obj_sexp);
272 e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (OtherError), NULL);
276 path = construct_calview_path ();
277 e_data_cal_view_register_gdbus_object (view, e_gdbus_cal_stub_get_connection (op->cal->priv->gdbus_object), path, &error);
280 g_object_unref (view);
282 e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR_EX (OtherError, error->message), NULL);
283 g_error_free (error);
289 e_cal_backend_add_view (backend, view);
291 e_data_cal_respond_get_view (op->cal, op->id, EDC_ERROR (Success), path);
297 case OP_GET_TIMEZONE:
298 e_cal_backend_get_timezone (backend, op->cal, op->id, op->cancellable, op->d.tzid);
301 case OP_ADD_TIMEZONE:
302 e_cal_backend_add_timezone (backend, op->cal, op->id, op->cancellable, op->d.tzobject);
303 g_free (op->d.tzobject);
305 case OP_AUTHENTICATE:
306 e_cal_backend_authenticate_user (backend, op->cancellable, op->d.credentials);
307 e_credentials_free (op->d.credentials);
309 case OP_CANCEL_OPERATION:
310 g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
312 if (g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid))) {
313 GCancellable *cancellable = g_hash_table_lookup (op->cal->priv->pending_ops, GUINT_TO_POINTER (op->d.opid));
315 g_cancellable_cancel (cancellable);
318 g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
321 /* close just cancels all pending ops and frees data cal */
322 e_cal_backend_remove_client (backend, op->cal);
324 g_static_rec_mutex_lock (&op->cal->priv->pending_ops_lock);
325 g_hash_table_foreach (op->cal->priv->pending_ops, cancel_ops_cb, NULL);
326 g_static_rec_mutex_unlock (&op->cal->priv->pending_ops_lock);
330 g_object_unref (op->cal);
331 g_object_unref (op->cancellable);
332 g_slice_free (OperationData, op);
335 static OperationData *
336 op_new (OperationID op,
341 data = g_slice_new0 (OperationData);
343 data->cal = g_object_ref (cal);
344 data->id = e_operation_pool_reserve_opid (ops_pool);
345 data->cancellable = g_cancellable_new ();
347 g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
348 g_hash_table_insert (cal->priv->pending_ops, GUINT_TO_POINTER (data->id), g_object_ref (data->cancellable));
349 g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
355 op_complete (EDataCal *cal,
358 g_return_if_fail (cal != NULL);
360 e_operation_pool_release_opid (ops_pool, opid);
362 g_static_rec_mutex_lock (&cal->priv->pending_ops_lock);
363 g_hash_table_remove (cal->priv->pending_ops, GUINT_TO_POINTER (opid));
364 g_static_rec_mutex_unlock (&cal->priv->pending_ops_lock);
367 /* Create the EDataCal error quark */
369 e_data_cal_error_quark (void)
371 #define ERR_PREFIX "org.gnome.evolution.dataserver.Calendar."
373 static const GDBusErrorEntry entries[] = {
374 { Success, ERR_PREFIX "Success" },
375 { Busy, ERR_PREFIX "Busy" },
376 { RepositoryOffline, ERR_PREFIX "RepositoryOffline" },
377 { PermissionDenied, ERR_PREFIX "PermissionDenied" },
378 { InvalidRange, ERR_PREFIX "InvalidRange" },
379 { ObjectNotFound, ERR_PREFIX "ObjectNotFound" },
380 { InvalidObject, ERR_PREFIX "InvalidObject" },
381 { ObjectIdAlreadyExists, ERR_PREFIX "ObjectIdAlreadyExists" },
382 { AuthenticationFailed, ERR_PREFIX "AuthenticationFailed" },
383 { AuthenticationRequired, ERR_PREFIX "AuthenticationRequired" },
384 { UnsupportedField, ERR_PREFIX "UnsupportedField" },
385 { UnsupportedMethod, ERR_PREFIX "UnsupportedMethod" },
386 { UnsupportedAuthenticationMethod, ERR_PREFIX "UnsupportedAuthenticationMethod" },
387 { TLSNotAvailable, ERR_PREFIX "TLSNotAvailable" },
388 { NoSuchCal, ERR_PREFIX "NoSuchCal" },
389 { UnknownUser, ERR_PREFIX "UnknownUser" },
390 { OfflineUnavailable, ERR_PREFIX "OfflineUnavailable" },
391 { SearchSizeLimitExceeded, ERR_PREFIX "SearchSizeLimitExceeded" },
392 { SearchTimeLimitExceeded, ERR_PREFIX "SearchTimeLimitExceeded" },
393 { InvalidQuery, ERR_PREFIX "InvalidQuery" },
394 { QueryRefused, ERR_PREFIX "QueryRefused" },
395 { CouldNotCancel, ERR_PREFIX "CouldNotCancel" },
396 { OtherError, ERR_PREFIX "OtherError" },
397 { InvalidServerVersion, ERR_PREFIX "InvalidServerVersion" },
398 { InvalidArg, ERR_PREFIX "InvalidArg" },
399 { NotSupported, ERR_PREFIX "NotSupported" },
400 { NotOpened, ERR_PREFIX "NotOpened" }
405 static volatile gsize quark_volatile = 0;
407 g_dbus_error_register_error_domain ("e-data-cal-error", &quark_volatile, entries, G_N_ELEMENTS (entries));
409 return (GQuark) quark_volatile;
413 * e_data_cal_status_to_string:
418 e_data_cal_status_to_string (EDataCalCallStatus status)
421 static struct _statuses {
422 EDataCalCallStatus status;
425 { Success, N_("Success") },
426 { Busy, N_("Backend is busy") },
427 { RepositoryOffline, N_("Repository offline") },
428 { PermissionDenied, N_("Permission denied") },
429 { InvalidRange, N_("Invalid range") },
430 { ObjectNotFound, N_("Object not found") },
431 { InvalidObject, N_("Invalid object") },
432 { ObjectIdAlreadyExists, N_("Object ID already exists") },
433 { AuthenticationFailed, N_("Authentication Failed") },
434 { AuthenticationRequired, N_("Authentication Required") },
435 { UnsupportedField, N_("Unsupported field") },
436 { UnsupportedMethod, N_("Unsupported method") },
437 { UnsupportedAuthenticationMethod, N_("Unsupported authentication method") },
438 { TLSNotAvailable, N_("TLS not available") },
439 { NoSuchCal, N_("Calendar does not exist") },
440 { UnknownUser, N_("Unknown user") },
441 { OfflineUnavailable, N_("Not available in offline mode") },
442 { SearchSizeLimitExceeded, N_("Search size limit exceeded") },
443 { SearchTimeLimitExceeded, N_("Search time limit exceeded") },
444 { InvalidQuery, N_("Invalid query") },
445 { QueryRefused, N_("Query refused") },
446 { CouldNotCancel, N_("Could not cancel") },
447 /* { OtherError, N_("Other error") }, */
448 { InvalidServerVersion, N_("Invalid server version") },
449 { InvalidArg, N_("Invalid argument") },
450 /* Translators: The string for NOT_SUPPORTED error */
451 { NotSupported, N_("Not supported") },
452 { NotOpened, N_("Backend is not opened yet") }
455 for (i = 0; i < G_N_ELEMENTS (statuses); i++) {
456 if (statuses[i].status == status)
457 return _(statuses[i].msg);
460 return _("Other error");
464 * e_data_cal_create_error:
469 e_data_cal_create_error (EDataCalCallStatus status,
470 const gchar *custom_msg)
472 if (status == Success)
475 return g_error_new_literal (E_DATA_CAL_ERROR, status, custom_msg ? custom_msg : e_data_cal_status_to_string (status));
479 * e_data_cal_create_error_fmt:
484 e_data_cal_create_error_fmt (EDataCalCallStatus status,
485 const gchar *custom_msg_fmt,
493 return e_data_cal_create_error (status, NULL);
495 va_start (ap, custom_msg_fmt);
496 custom_msg = g_strdup_vprintf (custom_msg_fmt, ap);
499 error = e_data_cal_create_error (status, custom_msg);
507 data_cal_return_error (GDBusMethodInvocation *invocation,
508 const GError *perror,
509 const gchar *error_fmt)
513 g_return_if_fail (perror != NULL);
515 error = g_error_new (E_DATA_CAL_ERROR, perror->code, error_fmt, perror->message);
517 g_dbus_method_invocation_return_gerror (invocation, error);
519 g_error_free (error);
523 * e_data_cal_register_gdbus_object:
525 * Registers GDBus object of this EDataCal.
530 e_data_cal_register_gdbus_object (EDataCal *cal,
531 GDBusConnection *connection,
532 const gchar *object_path,
535 g_return_val_if_fail (cal != NULL, 0);
536 g_return_val_if_fail (E_IS_DATA_CAL (cal), 0);
537 g_return_val_if_fail (connection != NULL, 0);
538 g_return_val_if_fail (object_path != NULL, 0);
540 return e_gdbus_cal_register_object (cal->priv->gdbus_object, connection, object_path, error);
544 impl_Cal_open (EGdbusCal *object,
545 GDBusMethodInvocation *invocation,
546 gboolean in_only_if_exists,
551 op = op_new (OP_OPEN, cal);
552 op->d.only_if_exists = in_only_if_exists;
554 e_gdbus_cal_complete_open (cal->priv->gdbus_object, invocation, op->id);
555 e_operation_pool_push (ops_pool, op);
561 impl_Cal_remove (EGdbusCal *object,
562 GDBusMethodInvocation *invocation,
567 op = op_new (OP_REMOVE, cal);
569 e_gdbus_cal_complete_remove (cal->priv->gdbus_object, invocation, op->id);
570 e_operation_pool_push (ops_pool, op);
576 impl_Cal_refresh (EGdbusCal *object,
577 GDBusMethodInvocation *invocation,
582 op = op_new (OP_REFRESH, cal);
584 e_gdbus_cal_complete_refresh (cal->priv->gdbus_object, invocation, op->id);
585 e_operation_pool_push (ops_pool, op);
591 impl_Cal_get_backend_property (EGdbusCal *object,
592 GDBusMethodInvocation *invocation,
593 const gchar *in_prop_name,
598 op = op_new (OP_GET_BACKEND_PROPERTY, cal);
599 op->d.prop_name = g_strdup (in_prop_name);
601 e_gdbus_cal_complete_get_backend_property (cal->priv->gdbus_object, invocation, op->id);
602 e_operation_pool_push (ops_pool, op);
608 impl_Cal_set_backend_property (EGdbusCal *object,
609 GDBusMethodInvocation *invocation,
610 const gchar * const *in_prop_name_value,
615 op = op_new (OP_SET_BACKEND_PROPERTY, cal);
616 g_return_val_if_fail (e_gdbus_cal_decode_set_backend_property (in_prop_name_value, &op->d.sbp.prop_name, &op->d.sbp.prop_value), FALSE);
618 e_gdbus_cal_complete_set_backend_property (cal->priv->gdbus_object, invocation, op->id);
619 e_operation_pool_push (ops_pool, op);
625 impl_Cal_get_object (EGdbusCal *object,
626 GDBusMethodInvocation *invocation,
627 const gchar * const *in_uid_rid,
632 op = op_new (OP_GET_OBJECT, cal);
633 g_return_val_if_fail (e_gdbus_cal_decode_get_object (in_uid_rid, &op->d.ur.uid, &op->d.ur.rid), FALSE);
635 e_gdbus_cal_complete_get_object (cal->priv->gdbus_object, invocation, op->id);
636 e_operation_pool_push (ops_pool, op);
642 impl_Cal_get_object_list (EGdbusCal *object,
643 GDBusMethodInvocation *invocation,
644 const gchar *in_sexp,
649 op = op_new (OP_GET_OBJECT_LIST, cal);
650 op->d.sexp = g_strdup (in_sexp);
652 e_gdbus_cal_complete_get_object_list (cal->priv->gdbus_object, invocation, op->id);
653 e_operation_pool_push (ops_pool, op);
659 impl_Cal_get_free_busy (EGdbusCal *object,
660 GDBusMethodInvocation *invocation,
661 const gchar * const *in_start_end_userlist,
667 op = op_new (OP_GET_FREE_BUSY, cal);
668 g_return_val_if_fail (e_gdbus_cal_decode_get_free_busy (in_start_end_userlist, &start, &end, &op->d.fb.users), FALSE);
670 op->d.fb.start = (time_t) start;
671 op->d.fb.end = (time_t) end;
673 e_gdbus_cal_complete_get_free_busy (cal->priv->gdbus_object, invocation, op->id);
674 e_operation_pool_push (ops_pool, op);
680 impl_Cal_create_objects (EGdbusCal *object,
681 GDBusMethodInvocation *invocation,
682 const gchar * const *in_calobjs,
687 op = op_new (OP_CREATE_OBJECTS, cal);
688 op->d.calobjs = e_util_strv_to_slist (in_calobjs);
690 e_gdbus_cal_complete_create_objects (cal->priv->gdbus_object, invocation, op->id);
691 e_operation_pool_push (ops_pool, op);
697 impl_Cal_modify_objects (EGdbusCal *object,
698 GDBusMethodInvocation *invocation,
699 const gchar * const *in_mod_calobjs,
705 op = op_new (OP_MODIFY_OBJECTS, cal);
706 g_return_val_if_fail (e_gdbus_cal_decode_modify_objects (in_mod_calobjs, &op->d.mo.calobjs, &mod), FALSE);
709 e_gdbus_cal_complete_modify_objects (cal->priv->gdbus_object, invocation, op->id);
710 e_operation_pool_push (ops_pool, op);
716 impl_Cal_remove_objects (EGdbusCal *object,
717 GDBusMethodInvocation *invocation,
718 const gchar * const *in_mod_ids,
724 op = op_new (OP_REMOVE_OBJECTS, cal);
725 g_return_val_if_fail (e_gdbus_cal_decode_remove_objects (in_mod_ids, &op->d.ro.ids, &mod), FALSE);
728 e_gdbus_cal_complete_remove_objects (cal->priv->gdbus_object, invocation, op->id);
729 e_operation_pool_push (ops_pool, op);
735 impl_Cal_receive_objects (EGdbusCal *object,
736 GDBusMethodInvocation *invocation,
737 const gchar *in_calobj,
742 op = op_new (OP_RECEIVE_OBJECTS, cal);
743 op->d.co.calobj = g_strdup (in_calobj);
745 e_gdbus_cal_complete_receive_objects (cal->priv->gdbus_object, invocation, op->id);
746 e_operation_pool_push (ops_pool, op);
752 impl_Cal_send_objects (EGdbusCal *object,
753 GDBusMethodInvocation *invocation,
754 const gchar *in_calobj,
759 op = op_new (OP_SEND_OBJECTS, cal);
760 op->d.co.calobj = g_strdup (in_calobj);
762 e_gdbus_cal_complete_send_objects (cal->priv->gdbus_object, invocation, op->id);
763 e_operation_pool_push (ops_pool, op);
769 impl_Cal_get_attachment_uris (EGdbusCal *object,
770 GDBusMethodInvocation *invocation,
771 const gchar * const *in_uid_rid,
776 op = op_new (OP_GET_ATTACHMENT_URIS, cal);
777 g_return_val_if_fail (e_gdbus_cal_decode_get_attachment_uris (in_uid_rid, &op->d.ur.uid, &op->d.ur.rid), FALSE);
779 e_gdbus_cal_complete_get_attachment_uris (cal->priv->gdbus_object, invocation, op->id);
780 e_operation_pool_push (ops_pool, op);
786 impl_Cal_discard_alarm (EGdbusCal *object,
787 GDBusMethodInvocation *invocation,
788 const gchar * const *in_uid_rid_auid,
793 op = op_new (OP_DISCARD_ALARM, cal);
794 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);
796 e_gdbus_cal_complete_discard_alarm (cal->priv->gdbus_object, invocation, op->id);
797 e_operation_pool_push (ops_pool, op);
803 impl_Cal_get_view (EGdbusCal *object,
804 GDBusMethodInvocation *invocation,
805 const gchar *in_sexp,
810 op = op_new (OP_GET_VIEW, cal);
811 op->d.sexp = g_strdup (in_sexp);
813 e_gdbus_cal_complete_get_view (cal->priv->gdbus_object, invocation, op->id);
814 e_operation_pool_push (ops_pool, op);
820 impl_Cal_get_timezone (EGdbusCal *object,
821 GDBusMethodInvocation *invocation,
822 const gchar *in_tzid,
827 op = op_new (OP_GET_TIMEZONE, cal);
828 op->d.tzid = g_strdup (in_tzid);
830 e_gdbus_cal_complete_get_timezone (cal->priv->gdbus_object, invocation, op->id);
831 e_operation_pool_push (ops_pool, op);
837 impl_Cal_add_timezone (EGdbusCal *object,
838 GDBusMethodInvocation *invocation,
839 const gchar *in_tzobject,
844 op = op_new (OP_ADD_TIMEZONE, cal);
845 op->d.tzobject = g_strdup (in_tzobject);
847 e_gdbus_cal_complete_add_timezone (cal->priv->gdbus_object, invocation, op->id);
848 e_operation_pool_push (ops_pool, op);
854 impl_Cal_authenticate_user (EGdbusCal *object,
855 GDBusMethodInvocation *invocation,
856 const gchar * const *in_credentials,
861 if (in_credentials == NULL) {
862 GError *error = e_data_cal_create_error (InvalidArg, NULL);
863 /* Translators: This is prefix to a detailed error message */
864 data_cal_return_error (invocation, error, _("Cannot authenticate user: "));
865 g_error_free (error);
869 op = op_new (OP_AUTHENTICATE, cal);
870 op->d.credentials = e_credentials_new_strv (in_credentials);
872 e_gdbus_cal_complete_authenticate_user (cal->priv->gdbus_object, invocation, NULL);
873 e_operation_pool_push (ops_pool, op);
879 impl_Cal_cancel_operation (EGdbusCal *object,
880 GDBusMethodInvocation *invocation,
886 op = op_new (OP_CANCEL_OPERATION, cal);
887 op->d.opid = in_opid;
889 e_gdbus_cal_complete_cancel_operation (cal->priv->gdbus_object, invocation, NULL);
890 e_operation_pool_push (ops_pool, op);
896 impl_Cal_cancel_all (EGdbusCal *object,
897 GDBusMethodInvocation *invocation,
902 op = op_new (OP_CANCEL_ALL, cal);
904 e_gdbus_cal_complete_cancel_all (cal->priv->gdbus_object, invocation, NULL);
905 e_operation_pool_push (ops_pool, op);
911 impl_Cal_close (EGdbusCal *object,
912 GDBusMethodInvocation *invocation,
917 op = op_new (OP_CLOSE, cal);
918 /* unref here makes sure the cal is freed in a separate thread */
919 g_object_unref (cal);
921 e_gdbus_cal_complete_close (cal->priv->gdbus_object, invocation, NULL);
922 e_operation_pool_push (ops_pool, op);
927 /* free returned pointer with g_strfreev() */
929 gslist_to_strv (const GSList *lst)
935 seq = g_new0 (gchar *, g_slist_length ((GSList *) lst) + 1);
936 for (l = lst, i = 0; l; l = l->next, i++) {
937 seq[i] = e_util_utf8_make_valid (l->data);
944 * e_data_cal_respond_open:
945 * @cal: A calendar client interface.
946 * @error: Operation error, if any, automatically freed if passed it.
948 * Notifies listeners of the completion of the open method call.
953 e_data_cal_respond_open (EDataCal *cal,
957 op_complete (cal, opid);
959 /* Translators: This is prefix to a detailed error message */
960 g_prefix_error (&error, "%s", _("Cannot open calendar: "));
962 e_gdbus_cal_emit_open_done (cal->priv->gdbus_object, opid, error);
965 g_error_free (error);
969 * e_data_cal_respond_remove:
970 * @cal: A calendar client interface.
971 * @error: Operation error, if any, automatically freed if passed it.
973 * Notifies listeners of the completion of the remove method call.
978 e_data_cal_respond_remove (EDataCal *cal,
982 op_complete (cal, opid);
984 /* Translators: This is prefix to a detailed error message */
985 g_prefix_error (&error, "%s", _("Cannot remove calendar: "));
987 e_gdbus_cal_emit_remove_done (cal->priv->gdbus_object, opid, error);
990 g_error_free (error);
992 e_cal_backend_set_is_removed (cal->priv->backend, TRUE);
996 * e_data_cal_respond_refresh:
997 * @cal: A calendar client interface.
998 * @error: Operation error, if any, automatically freed if passed it.
1000 * Notifies listeners of the completion of the refresh method call.
1005 e_data_cal_respond_refresh (EDataCal *cal,
1009 op_complete (cal, opid);
1011 /* Translators: This is prefix to a detailed error message */
1012 g_prefix_error (&error, "%s", _("Cannot refresh calendar: "));
1014 e_gdbus_cal_emit_refresh_done (cal->priv->gdbus_object, opid, error);
1017 g_error_free (error);
1021 * e_data_cal_respond_get_backend_property:
1022 * @cal: A calendar client interface.
1023 * @error: Operation error, if any, automatically freed if passed it.
1024 * @prop_value: Value of a property
1026 * Notifies listeners of the completion of the get_backend_property method call.
1031 e_data_cal_respond_get_backend_property (EDataCal *cal,
1034 const gchar *prop_value)
1036 gchar *gdbus_prop_value = NULL;
1038 op_complete (cal, opid);
1040 /* Translators: This is prefix to a detailed error message */
1041 g_prefix_error (&error, "%s", _("Cannot retrieve backend property: "));
1043 e_gdbus_cal_emit_get_backend_property_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (prop_value, &gdbus_prop_value));
1045 g_free (gdbus_prop_value);
1047 g_error_free (error);
1051 * e_data_cal_respond_set_backend_property:
1052 * @cal: A calendar client interface.
1053 * @error: Operation error, if any, automatically freed if passed it.
1055 * Notifies listeners of the completion of the set_backend_property method call.
1060 e_data_cal_respond_set_backend_property (EDataCal *cal,
1064 op_complete (cal, opid);
1066 /* Translators: This is prefix to a detailed error message */
1067 g_prefix_error (&error, "%s", _("Cannot set backend property: "));
1069 e_gdbus_cal_emit_set_backend_property_done (cal->priv->gdbus_object, opid, error);
1072 g_error_free (error);
1076 * e_data_cal_respond_get_object:
1077 * @cal: A calendar client interface.
1078 * @error: Operation error, if any, automatically freed if passed it.
1079 * @object: The object retrieved as an iCalendar string.
1081 * Notifies listeners of the completion of the get_object method call.
1086 e_data_cal_respond_get_object (EDataCal *cal,
1089 const gchar *object)
1091 gchar *gdbus_object = NULL;
1093 op_complete (cal, opid);
1095 /* Translators: This is prefix to a detailed error message */
1096 g_prefix_error (&error, "%s", _("Cannot retrieve calendar object path: "));
1098 e_gdbus_cal_emit_get_object_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (object, &gdbus_object));
1100 g_free (gdbus_object);
1102 g_error_free (error);
1106 * e_data_cal_respond_get_object_list:
1107 * @cal: A calendar client interface.
1108 * @error: Operation error, if any, automatically freed if passed it.
1109 * @objects: List of retrieved objects.
1111 * Notifies listeners of the completion of the get_object_list method call.
1116 e_data_cal_respond_get_object_list (EDataCal *cal,
1119 const GSList *objects)
1121 gchar **strv_objects;
1123 op_complete (cal, opid);
1125 /* Translators: This is prefix to a detailed error message */
1126 g_prefix_error (&error, "%s", _("Cannot retrieve calendar object list: "));
1128 strv_objects = gslist_to_strv (objects);
1130 e_gdbus_cal_emit_get_object_list_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_objects);
1132 g_strfreev (strv_objects);
1134 g_error_free (error);
1138 * e_data_cal_respond_get_free_busy:
1139 * @cal: A calendar client interface.
1140 * @error: Operation error, if any, automatically freed if passed it.
1142 * Notifies listeners of the completion of the get_free_busy method call.
1143 * To pass actual free/busy objects to the client use e_data_cal_report_free_busy_data().
1148 e_data_cal_respond_get_free_busy (EDataCal *cal,
1152 op_complete (cal, opid);
1154 /* Translators: This is prefix to a detailed error message */
1155 g_prefix_error (&error, "%s", _("Cannot retrieve calendar free/busy list: "));
1157 e_gdbus_cal_emit_get_free_busy_done (cal->priv->gdbus_object, opid, error);
1160 g_error_free (error);
1164 * e_data_cal_respond_create_objects:
1165 * @cal: A calendar client interface.
1166 * @error: Operation error, if any, automatically freed if passed it.
1167 * @uids: UIDs of the objects created.
1168 * @new_components: The newly created #ECalComponent objects.
1170 * Notifies listeners of the completion of the create_objects method call.
1175 e_data_cal_respond_create_objects (EDataCal *cal,
1179 /* const */ GSList *new_components)
1181 gchar **array = NULL;
1185 op_complete (cal, opid);
1187 array = g_new0 (gchar *, g_slist_length ((GSList *) uids) + 1);
1188 for (l = uids; l != NULL; l = l->next) {
1189 array[i++] = e_util_utf8_make_valid (l->data);
1192 /* Translators: This is prefix to a detailed error message */
1193 g_prefix_error (&error, "%s", _("Cannot create calendar object: "));
1195 e_gdbus_cal_emit_create_objects_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) array);
1199 g_error_free (error);
1201 for (l = new_components; l; l = l->next) {
1202 e_cal_backend_notify_component_created (cal->priv->backend, l->data);
1208 * e_data_cal_respond_modify_objects:
1209 * @cal: A calendar client interface.
1210 * @error: Operation error, if any, automatically freed if passed it.
1211 * @old_components: The old #ECalComponents.
1212 * @new_components: The new #ECalComponents.
1214 * Notifies listeners of the completion of the modify_objects method call.
1219 e_data_cal_respond_modify_objects (EDataCal *cal,
1222 /* const */ GSList *old_components,
1223 /* const */ GSList *new_components)
1225 op_complete (cal, opid);
1227 /* Translators: This is prefix to a detailed error message */
1228 g_prefix_error (&error, "%s", _("Cannot modify calendar object: "));
1230 e_gdbus_cal_emit_modify_objects_done (cal->priv->gdbus_object, opid, error);
1233 g_error_free (error);
1235 const GSList *lold = old_components, *lnew = new_components;
1236 while (lold && lnew) {
1237 e_cal_backend_notify_component_modified (cal->priv->backend, lold->data, lnew->data);
1245 * e_data_cal_respond_remove_objects:
1246 * @cal: A calendar client interface.
1247 * @error: Operation error, if any, automatically freed if passed it.
1248 * @ids: IDs of the removed objects.
1249 * @old_components: The old #ECalComponents.
1250 * @new_components: The new #ECalComponents. They will not be NULL only
1251 * when removing instances of recurring appointments.
1253 * Notifies listeners of the completion of the remove_objects method call.
1258 e_data_cal_respond_remove_objects (EDataCal *cal,
1262 /* const */ GSList *old_components,
1263 /* const */ GSList *new_components)
1265 op_complete (cal, opid);
1267 /* Translators: This is prefix to a detailed error message */
1268 g_prefix_error (&error, "%s", _("Cannot remove calendar object: "));
1270 e_gdbus_cal_emit_remove_objects_done (cal->priv->gdbus_object, opid, error);
1273 g_error_free (error);
1275 const GSList *lid = ids, *lold = old_components, *lnew = new_components;
1276 while (lid && lold) {
1277 e_cal_backend_notify_component_removed (cal->priv->backend, lid->data, lold->data, lnew ? lnew->data : NULL);
1289 * e_data_cal_respond_receive_objects:
1290 * @cal: A calendar client interface.
1291 * @error: Operation error, if any, automatically freed if passed it.
1293 * Notifies listeners of the completion of the receive_objects method call.
1298 e_data_cal_respond_receive_objects (EDataCal *cal,
1302 op_complete (cal, opid);
1304 /* Translators: This is prefix to a detailed error message */
1305 g_prefix_error (&error, "%s", _("Cannot receive calendar objects: "));
1307 e_gdbus_cal_emit_receive_objects_done (cal->priv->gdbus_object, opid, error);
1310 g_error_free (error);
1314 * e_data_cal_respond_send_objects:
1315 * @cal: A calendar client interface.
1316 * @error: Operation error, if any, automatically freed if passed it.
1317 * @users: List of users.
1318 * @calobj: An iCalendar string representing the object sent.
1320 * Notifies listeners of the completion of the send_objects method call.
1325 e_data_cal_respond_send_objects (EDataCal *cal,
1328 const GSList *users,
1329 const gchar *calobj)
1331 gchar **strv_users_calobj;
1333 op_complete (cal, opid);
1335 /* Translators: This is prefix to a detailed error message */
1336 g_prefix_error (&error, "%s", _("Cannot send calendar objects: "));
1338 strv_users_calobj = e_gdbus_cal_encode_send_objects (calobj, users);
1340 e_gdbus_cal_emit_send_objects_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_users_calobj);
1342 g_strfreev (strv_users_calobj);
1344 g_error_free (error);
1348 * e_data_cal_respond_get_attachment_uris:
1349 * @cal: A calendar client interface.
1350 * @error: Operation error, if any, automatically freed if passed it.
1351 * @attachment_uris: List of retrieved attachment uri's.
1353 * Notifies listeners of the completion of the get_attachment_uris method call.
1358 e_data_cal_respond_get_attachment_uris (EDataCal *cal,
1361 const GSList *attachment_uris)
1363 gchar **strv_attachment_uris;
1365 op_complete (cal, opid);
1367 /* Translators: This is prefix to a detailed error message */
1368 g_prefix_error (&error, "%s", _("Could not retrieve attachment uris: "));
1370 strv_attachment_uris = gslist_to_strv (attachment_uris);
1372 e_gdbus_cal_emit_get_attachment_uris_done (cal->priv->gdbus_object, opid, error, (const gchar * const *) strv_attachment_uris);
1374 g_strfreev (strv_attachment_uris);
1376 g_error_free (error);
1380 * e_data_cal_respond_discard_alarm:
1381 * @cal: A calendar client interface.
1382 * @error: Operation error, if any, automatically freed if passed it.
1384 * Notifies listeners of the completion of the discard_alarm method call.
1389 e_data_cal_respond_discard_alarm (EDataCal *cal,
1393 op_complete (cal, opid);
1395 /* Translators: This is prefix to a detailed error message */
1396 g_prefix_error (&error, "%s", _("Could not discard reminder: "));
1398 e_gdbus_cal_emit_discard_alarm_done (cal->priv->gdbus_object, opid, error);
1401 g_error_free (error);
1405 * e_data_cal_respond_get_view:
1406 * @cal: A calendar client interface.
1407 * @error: Operation error, if any, automatically freed if passed it.
1408 * @view_path: The new live view path.
1410 * Notifies listeners of the completion of the get_view method call.
1415 e_data_cal_respond_get_view (EDataCal *cal,
1418 const gchar *view_path)
1420 gchar *gdbus_view_path = NULL;
1422 op_complete (cal, opid);
1424 /* Translators: This is prefix to a detailed error message */
1425 g_prefix_error (&error, "%s", _("Could not get calendar view path: "));
1427 e_gdbus_cal_emit_get_view_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (view_path, &gdbus_view_path));
1429 g_free (gdbus_view_path);
1431 g_error_free (error);
1435 * e_data_cal_respond_get_timezone:
1436 * @cal: A calendar client interface.
1437 * @error: Operation error, if any, automatically freed if passed it.
1438 * @tzobject: The requested timezone as an iCalendar string.
1440 * Notifies listeners of the completion of the get_timezone method call.
1445 e_data_cal_respond_get_timezone (EDataCal *cal,
1448 const gchar *tzobject)
1450 gchar *gdbus_tzobject = NULL;
1452 op_complete (cal, opid);
1454 /* Translators: This is prefix to a detailed error message */
1455 g_prefix_error (&error, "%s", _("Could not retrieve calendar time zone: "));
1457 e_gdbus_cal_emit_get_timezone_done (cal->priv->gdbus_object, opid, error, e_util_ensure_gdbus_string (tzobject, &gdbus_tzobject));
1459 g_free (gdbus_tzobject);
1461 g_error_free (error);
1465 * e_data_cal_respond_add_timezone:
1466 * @cal: A calendar client interface.
1467 * @error: Operation error, if any, automatically freed if passed it.
1469 * Notifies listeners of the completion of the add_timezone method call.
1474 e_data_cal_respond_add_timezone (EDataCal *cal,
1478 op_complete (cal, opid);
1480 /* Translators: This is prefix to a detailed error message */
1481 g_prefix_error (&error, "%s", _("Could not add calendar time zone: "));
1483 e_gdbus_cal_emit_add_timezone_done (cal->priv->gdbus_object, opid, error);
1486 g_error_free (error);
1490 * e_data_cal_report_error:
1492 * FIXME: Document me.
1497 e_data_cal_report_error (EDataCal *cal,
1498 const gchar *message)
1500 g_return_if_fail (cal != NULL);
1501 g_return_if_fail (message != NULL);
1503 e_gdbus_cal_emit_backend_error (cal->priv->gdbus_object, message);
1507 * e_data_cal_report_readonly:
1509 * FIXME: Document me.
1514 e_data_cal_report_readonly (EDataCal *cal,
1517 g_return_if_fail (cal != NULL);
1519 e_gdbus_cal_emit_readonly (cal->priv->gdbus_object, readonly);
1523 * e_data_cal_report_online:
1525 * FIXME: Document me.
1530 e_data_cal_report_online (EDataCal *cal,
1533 g_return_if_fail (cal != NULL);
1535 e_gdbus_cal_emit_online (cal->priv->gdbus_object, is_online);
1539 * e_data_cal_report_auth_required:
1541 * FIXME: Document me.
1546 e_data_cal_report_auth_required (EDataCal *cal,
1547 const ECredentials *credentials)
1549 gchar *empty_strv[2];
1550 gchar **strv = NULL;
1552 /* credentilas contains extra information for a source for which
1553 * authentication is requested. This parameter can be NULL to
1554 * indicate "for this calendar". */
1556 g_return_if_fail (cal != NULL);
1558 empty_strv[0] = NULL;
1559 empty_strv[1] = NULL;
1562 strv = e_credentials_to_strv (credentials);
1564 e_gdbus_cal_emit_auth_required (cal->priv->gdbus_object, (const gchar * const *) (strv ? strv : empty_strv));
1570 * e_data_cal_report_opened:
1572 * Reports to associated client that opening phase of the cal is finished.
1573 * error being NULL means successfully, otherwise reports an error which
1574 * happened during opening phase. By opening phase is meant a process
1575 * including successfull authentication to the server/storage.
1580 e_data_cal_report_opened (EDataCal *cal,
1581 const GError *error)
1585 strv_error = e_gdbus_templates_encode_error (error);
1587 e_gdbus_cal_emit_opened (cal->priv->gdbus_object, (const gchar * const *) strv_error);
1589 g_strfreev (strv_error);
1593 * e_data_cal_report_free_busy_data:
1595 * FIXME: Document me.
1600 e_data_cal_report_free_busy_data (EDataCal *cal,
1601 const GSList *freebusy)
1603 gchar **strv_freebusy;
1605 g_return_if_fail (cal != NULL);
1607 strv_freebusy = gslist_to_strv (freebusy);
1609 e_gdbus_cal_emit_free_busy_data (cal->priv->gdbus_object, (const gchar * const *) strv_freebusy);
1611 g_strfreev (strv_freebusy);
1615 * e_data_cal_report_backend_property_changed:
1617 * Notifies client about certain property value change
1622 e_data_cal_report_backend_property_changed (EDataCal *cal,
1623 const gchar *prop_name,
1624 const gchar *prop_value)
1628 g_return_if_fail (cal != NULL);
1629 g_return_if_fail (prop_name != NULL);
1630 g_return_if_fail (*prop_name != '\0');
1631 g_return_if_fail (prop_value != NULL);
1633 strv = e_gdbus_templates_encode_two_strings (prop_name, prop_value);
1634 g_return_if_fail (strv != NULL);
1636 e_gdbus_cal_emit_backend_property_changed (cal->priv->gdbus_object, (const gchar * const *) strv);
1642 data_cal_set_backend (EDataCal *cal,
1643 ECalBackend *backend)
1645 g_return_if_fail (E_IS_CAL_BACKEND (backend));
1646 g_return_if_fail (cal->priv->backend == NULL);
1648 cal->priv->backend = g_object_ref (backend);
1652 data_cal_set_property (GObject *object,
1654 const GValue *value,
1657 switch (property_id) {
1659 data_cal_set_backend (
1660 E_DATA_CAL (object),
1661 g_value_get_object (value));
1665 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1669 data_cal_get_property (GObject *object,
1674 switch (property_id) {
1676 g_value_set_object (
1678 e_data_cal_get_backend (
1679 E_DATA_CAL (object)));
1683 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
1687 data_cal_dispose (GObject *object)
1689 EDataCalPrivate *priv;
1691 priv = E_DATA_CAL_GET_PRIVATE (object);
1693 if (priv->backend) {
1694 g_object_unref (priv->backend);
1695 priv->backend = NULL;
1698 /* Chain up to parent's dispose() method. */
1699 G_OBJECT_CLASS (e_data_cal_parent_class)->dispose (object);
1703 data_cal_finalize (GObject *object)
1705 EDataCalPrivate *priv;
1707 priv = E_DATA_CAL_GET_PRIVATE (object);
1709 if (priv->pending_ops) {
1710 g_hash_table_destroy (priv->pending_ops);
1711 priv->pending_ops = NULL;
1714 g_static_rec_mutex_free (&priv->pending_ops_lock);
1716 if (priv->gdbus_object) {
1717 g_object_unref (priv->gdbus_object);
1718 priv->gdbus_object = NULL;
1721 /* Chain up to parent's finalize() method. */
1722 G_OBJECT_CLASS (e_data_cal_parent_class)->finalize (object);
1726 e_data_cal_class_init (EDataCalClass *class)
1728 GObjectClass *object_class;
1730 g_type_class_add_private (class, sizeof (EDataCalPrivate));
1732 object_class = G_OBJECT_CLASS (class);
1733 object_class->set_property = data_cal_set_property;
1734 object_class->get_property = data_cal_get_property;
1735 object_class->dispose = data_cal_dispose;
1736 object_class->finalize = data_cal_finalize;
1738 g_object_class_install_property (
1741 g_param_spec_object (
1744 "The backend driving this connection",
1747 G_PARAM_CONSTRUCT_ONLY |
1748 G_PARAM_STATIC_STRINGS));
1751 ops_pool = e_operation_pool_new (10, operation_thread, NULL);
1755 e_data_cal_init (EDataCal *ecal)
1757 EGdbusCal *gdbus_object;
1759 ecal->priv = E_DATA_CAL_GET_PRIVATE (ecal);
1761 ecal->priv->gdbus_object = e_gdbus_cal_stub_new ();
1762 ecal->priv->pending_ops = g_hash_table_new_full (
1763 g_direct_hash, g_direct_equal, NULL, g_object_unref);
1764 g_static_rec_mutex_init (&ecal->priv->pending_ops_lock);
1766 gdbus_object = ecal->priv->gdbus_object;
1768 gdbus_object, "handle-open",
1769 G_CALLBACK (impl_Cal_open), ecal);
1771 gdbus_object, "handle-authenticate-user",
1772 G_CALLBACK (impl_Cal_authenticate_user), ecal);
1774 gdbus_object, "handle-remove",
1775 G_CALLBACK (impl_Cal_remove), ecal);
1777 gdbus_object, "handle-refresh",
1778 G_CALLBACK (impl_Cal_refresh), ecal);
1780 gdbus_object, "handle-get-backend-property",
1781 G_CALLBACK (impl_Cal_get_backend_property), ecal);
1783 gdbus_object, "handle-set-backend-property",
1784 G_CALLBACK (impl_Cal_set_backend_property), ecal);
1786 gdbus_object, "handle-get-object",
1787 G_CALLBACK (impl_Cal_get_object), ecal);
1789 gdbus_object, "handle-get-object-list",
1790 G_CALLBACK (impl_Cal_get_object_list), ecal);
1792 gdbus_object, "handle-get-free-busy",
1793 G_CALLBACK (impl_Cal_get_free_busy), ecal);
1795 gdbus_object, "handle-create-objects",
1796 G_CALLBACK (impl_Cal_create_objects), ecal);
1798 gdbus_object, "handle-modify-objects",
1799 G_CALLBACK (impl_Cal_modify_objects), ecal);
1801 gdbus_object, "handle-remove-objects",
1802 G_CALLBACK (impl_Cal_remove_objects), ecal);
1804 gdbus_object, "handle-receive-objects",
1805 G_CALLBACK (impl_Cal_receive_objects), ecal);
1807 gdbus_object, "handle-send-objects",
1808 G_CALLBACK (impl_Cal_send_objects), ecal);
1810 gdbus_object, "handle-get-attachment-uris",
1811 G_CALLBACK (impl_Cal_get_attachment_uris), ecal);
1813 gdbus_object, "handle-discard-alarm",
1814 G_CALLBACK (impl_Cal_discard_alarm), ecal);
1816 gdbus_object, "handle-get-view",
1817 G_CALLBACK (impl_Cal_get_view), ecal);
1819 gdbus_object, "handle-get-timezone",
1820 G_CALLBACK (impl_Cal_get_timezone), ecal);
1822 gdbus_object, "handle-add-timezone",
1823 G_CALLBACK (impl_Cal_add_timezone), ecal);
1825 gdbus_object, "handle-cancel-operation",
1826 G_CALLBACK (impl_Cal_cancel_operation), ecal);
1828 gdbus_object, "handle-cancel-all",
1829 G_CALLBACK (impl_Cal_cancel_all), ecal);
1831 gdbus_object, "handle-close",
1832 G_CALLBACK (impl_Cal_close), ecal);
1836 e_data_cal_new (ECalBackend *backend)
1838 g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
1840 return g_object_new (E_TYPE_DATA_CAL, "backend", backend, NULL);
1844 e_data_cal_get_backend (EDataCal *cal)
1846 g_return_val_if_fail (E_IS_DATA_CAL (cal), NULL);
1848 return cal->priv->backend;