1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
|
/*
* e-cal-backend.h
*
* This library is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
#if !defined (__LIBEDATA_CAL_H_INSIDE__) && !defined (LIBEDATA_CAL_COMPILATION)
#error "Only <libedata-cal/libedata-cal.h> should be included directly."
#endif
#ifndef E_CAL_BACKEND_H
#define E_CAL_BACKEND_H
#include <libecal/libecal.h>
#include <libebackend/libebackend.h>
#include <libedata-cal/e-data-cal.h>
/* Standard GObject macros */
#define E_TYPE_CAL_BACKEND \
(e_cal_backend_get_type ())
#define E_CAL_BACKEND(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_CAL_BACKEND, ECalBackend))
#define E_CAL_BACKEND_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_CAL_BACKEND, ECalBackendClass))
#define E_IS_CAL_BACKEND(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_CAL_BACKEND))
#define E_IS_CAL_BACKEND_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_CAL_BACKEND))
#define E_CAL_BACKEND_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_CAL_BACKEND, ECalBackendClass))
/**
* CLIENT_BACKEND_PROPERTY_CAPABILITIES:
*
* FIXME: Document me.
*
* Since: 3.2
**/
#define CLIENT_BACKEND_PROPERTY_CAPABILITIES "capabilities"
/**
* CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS:
*
* FIXME: Document me.
*
* Since: 3.2
**/
#define CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS "cal-email-address"
/**
* CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS:
*
* FIXME: Document me.
*
* Since: 3.2
**/
#define CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS "alarm-email-address"
/**
* CAL_BACKEND_PROPERTY_DEFAULT_OBJECT:
*
* FIXME: Document me.
*
* Since: 3.2
**/
#define CAL_BACKEND_PROPERTY_DEFAULT_OBJECT "default-object"
/**
* CAL_BACKEND_PROPERTY_REVISION:
*
* The current overall revision string, this can be used as
* a quick check to see if data has changed at all since the
* last time the calendar revision was observed.
*
* Since: 3.4
**/
#define CAL_BACKEND_PROPERTY_REVISION "revision"
G_BEGIN_DECLS
struct _ECalBackendCache;
typedef struct _ECalBackend ECalBackend;
typedef struct _ECalBackendClass ECalBackendClass;
typedef struct _ECalBackendPrivate ECalBackendPrivate;
/**
* ECalBackend:
*
* Contains only private data that should be read and manipulated using the
* functions below.
*/
struct _ECalBackend {
/*< private >*/
EBackend parent;
ECalBackendPrivate *priv;
};
/**
* ECalBackendClass:
* @use_serial_dispatch_queue: Whether a serial dispatch queue should
* be used for this backend or not. The default is %TRUE.
* @get_backend_property: Fetch a property value by name from the backend
* @open: Open the backend
* @refresh: Refresh the backend
* @get_object: Fetch a calendar object
* @get_object_list: FIXME: Document me
* @get_free_busy: FIXME: Document me
* @create_objects: FIXME: Document me
* @modify_objects: FIXME: Document me
* @remove_objects: FIXME: Document me
* @receive_objects: FIXME: Document me
* @send_objects: FIXME: Document me
* @get_attachment_uris: FIXME: Document me
* @discard_alarm: FIXME: Document me
* @get_timezone: FIXME: Document me
* @add_timezone: FIXME: Document me
* @start_view: Start up the specified view
* @stop_view: Stop the specified view
* @closed: A signal notifying that the backend was closed
* @shutdown: A signal notifying that the backend is being shut down
*
* Class structure for the #ECalBackend class.
*
* These virtual methods must be implemented when writing
* a calendar backend.
*/
struct _ECalBackendClass {
/*< private >*/
EBackendClass parent_class;
/*< public >*/
/* Set this to TRUE to use a serial dispatch queue, instead
* of a concurrent dispatch queue. A serial dispatch queue
* executes one method at a time in the order in which they
* were called. This is generally slower than a concurrent
* dispatch queue, but helps avoid thread-safety issues. */
gboolean use_serial_dispatch_queue;
/* Virtual methods */
gchar * (*get_backend_property) (ECalBackend *backend,
const gchar *prop_name);
void (*open) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
gboolean only_if_exists);
void (*refresh) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable);
void (*get_object) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const gchar *uid,
const gchar *rid);
void (*get_object_list) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const gchar *sexp);
void (*get_free_busy) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const GSList *users,
time_t start,
time_t end);
void (*create_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const GSList *calobjs);
void (*modify_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const GSList *calobjs,
ECalObjModType mod);
void (*remove_objects) (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
GCancellable *cancellable,
const GSList *ids,
ECalObjModType mod);
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);
void (*start_view) (ECalBackend *backend,
EDataCalView *view);
void (*stop_view) (ECalBackend *backend,
EDataCalView *view);
/* Signals */
void (*closed) (ECalBackend *backend,
const gchar *sender);
void (*shutdown) (ECalBackend *backend);
};
GType e_cal_backend_get_type (void) G_GNUC_CONST;
icalcomponent_kind
e_cal_backend_get_kind (ECalBackend *backend);
EDataCal * e_cal_backend_ref_data_cal (ECalBackend *backend);
void e_cal_backend_set_data_cal (ECalBackend *backend,
EDataCal *data_cal);
GProxyResolver *
e_cal_backend_ref_proxy_resolver
(ECalBackend *backend);
ESourceRegistry *
e_cal_backend_get_registry (ECalBackend *backend);
gboolean e_cal_backend_get_writable (ECalBackend *backend);
void e_cal_backend_set_writable (ECalBackend *backend,
gboolean writable);
gboolean e_cal_backend_is_opened (ECalBackend *backend);
gboolean e_cal_backend_is_readonly (ECalBackend *backend);
const gchar * e_cal_backend_get_cache_dir (ECalBackend *backend);
gchar * e_cal_backend_dup_cache_dir (ECalBackend *backend);
void e_cal_backend_set_cache_dir (ECalBackend *backend,
const gchar *cache_dir);
gchar * e_cal_backend_create_cache_filename
(ECalBackend *backend,
const gchar *uid,
const gchar *filename,
gint fileindex);
void e_cal_backend_add_view (ECalBackend *backend,
EDataCalView *view);
void e_cal_backend_remove_view (ECalBackend *backend,
EDataCalView *view);
GList * e_cal_backend_list_views (ECalBackend *backend);
gchar * e_cal_backend_get_backend_property
(ECalBackend *backend,
const gchar *prop_name);
gboolean e_cal_backend_open_sync (ECalBackend *backend,
GCancellable *cancellable,
GError **error);
void e_cal_backend_open (ECalBackend *backend,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_open_finish (ECalBackend *backend,
GAsyncResult *result,
GError **error);
gboolean e_cal_backend_refresh_sync (ECalBackend *backend,
GCancellable *cancellable,
GError **error);
void e_cal_backend_refresh (ECalBackend *backend,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_refresh_finish (ECalBackend *backend,
GAsyncResult *result,
GError **error);
gchar * e_cal_backend_get_object_sync (ECalBackend *backend,
const gchar *uid,
const gchar *rid,
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_object (ECalBackend *backend,
const gchar *uid,
const gchar *rid,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * e_cal_backend_get_object_finish (ECalBackend *backend,
GAsyncResult *result,
GError **error);
gboolean e_cal_backend_get_object_list_sync
(ECalBackend *backend,
const gchar *query,
GQueue *out_objects,
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_object_list (ECalBackend *backend,
const gchar *query,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_get_object_list_finish
(ECalBackend *backend,
GAsyncResult *result,
GQueue *out_objects,
GError **error);
gboolean e_cal_backend_get_free_busy_sync
(ECalBackend *backend,
time_t start,
time_t end,
const gchar * const *users,
GSList **out_freebusy,
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_free_busy (ECalBackend *backend,
time_t start,
time_t end,
const gchar * const *users,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_get_free_busy_finish
(ECalBackend *backend,
GAsyncResult *result,
GSList **out_freebusy,
GError **error);
gboolean e_cal_backend_create_objects_sync
(ECalBackend *backend,
const gchar * const *calobjs,
GQueue *out_uids,
GCancellable *cancellable,
GError **error);
void e_cal_backend_create_objects (ECalBackend *backend,
const gchar * const *calobjs,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_create_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GQueue *out_uids,
GError **error);
gboolean e_cal_backend_modify_objects_sync
(ECalBackend *backend,
const gchar * const *calobjs,
ECalObjModType mod,
GCancellable *cancellable,
GError **error);
void e_cal_backend_modify_objects (ECalBackend *backend,
const gchar * const *calobjs,
ECalObjModType mod,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_modify_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
gboolean e_cal_backend_remove_objects_sync
(ECalBackend *backend,
GList *component_ids,
ECalObjModType mod,
GCancellable *cancellable,
GError **error);
void e_cal_backend_remove_objects (ECalBackend *backend,
GList *component_ids,
ECalObjModType mod,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_remove_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
gboolean e_cal_backend_receive_objects_sync
(ECalBackend *backend,
const gchar *calobj,
GCancellable *cancellable,
GError **error);
void e_cal_backend_receive_objects (ECalBackend *backend,
const gchar *calobj,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_receive_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
gchar * e_cal_backend_send_objects_sync (ECalBackend *backend,
const gchar *calobj,
GQueue *out_users,
GCancellable *cancellable,
GError **error);
void e_cal_backend_send_objects (ECalBackend *backend,
const gchar *calobj,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * e_cal_backend_send_objects_finish
(ECalBackend *backend,
GAsyncResult *result,
GQueue *out_users,
GError **error);
gboolean e_cal_backend_get_attachment_uris_sync
(ECalBackend *backend,
const gchar *uid,
const gchar *rid,
GQueue *out_attachment_uris,
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_attachment_uris
(ECalBackend *backend,
const gchar *uid,
const gchar *rid,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_get_attachment_uris_finish
(ECalBackend *backend,
GAsyncResult *result,
GQueue *out_attachment_uris,
GError **error);
gboolean e_cal_backend_discard_alarm_sync
(ECalBackend *backend,
const gchar *uid,
const gchar *rid,
const gchar *alarm_uid,
GCancellable *cancellable,
GError **error);
void e_cal_backend_discard_alarm (ECalBackend *backend,
const gchar *uid,
const gchar *rid,
const gchar *alarm_uid,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_discard_alarm_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
gchar * e_cal_backend_get_timezone_sync (ECalBackend *backend,
const gchar *tzid,
GCancellable *cancellable,
GError **error);
void e_cal_backend_get_timezone (ECalBackend *backend,
const gchar *tzid,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * e_cal_backend_get_timezone_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
gboolean e_cal_backend_add_timezone_sync (ECalBackend *backend,
const gchar *tzobject,
GCancellable *cancellable,
GError **error);
void e_cal_backend_add_timezone (ECalBackend *backend,
const gchar *tzobject,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean e_cal_backend_add_timezone_finish
(ECalBackend *backend,
GAsyncResult *result,
GError **error);
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,
ECalComponent *component);
void e_cal_backend_notify_component_modified
(ECalBackend *backend,
ECalComponent *old_component,
ECalComponent *new_component);
void e_cal_backend_notify_component_removed
(ECalBackend *backend,
const ECalComponentId *id,
ECalComponent *old_component,
ECalComponent *new_component);
void e_cal_backend_notify_error (ECalBackend *backend,
const gchar *message);
void e_cal_backend_notify_property_changed
(ECalBackend *backend,
const gchar *prop_name,
const gchar *prop_value);
void e_cal_backend_empty_cache (ECalBackend *backend,
struct _ECalBackendCache *cache);
GSimpleAsyncResult *
e_cal_backend_prepare_for_completion
(ECalBackend *backend,
guint opid,
GQueue **result_queue);
/**
* ECalBackendCustomOpFunc:
* @cal_backend: an #ECalBackend
* @user_data: a function user data, as provided to e_cal_backend_schedule_custom_operation()
* @cancellable: an optional #GCancellable, as provided to e_cal_backend_schedule_custom_operation()
* @error: return location for a #GError, or %NULL
*
* A callback prototype being called in a dedicated thread, scheduled
* by e_cal_backend_schedule_custom_operation().
*
* Since: 3.26
**/
typedef void (* ECalBackendCustomOpFunc) (ECalBackend *cal_backend,
gpointer user_data,
GCancellable *cancellable,
GError **error);
void e_cal_backend_schedule_custom_operation
(ECalBackend *cal_backend,
GCancellable *use_cancellable,
ECalBackendCustomOpFunc func,
gpointer user_data,
GDestroyNotify user_data_free);
G_END_DECLS
#endif /* E_CAL_BACKEND_H */
|