1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * This library is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation.
6  *
7  * This library is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
10  * for more details.
11  *
12  * You should have received a copy of the GNU Lesser General Public License
13  * along with this library. If not, see <http://www.gnu.org/licenses/>.
14  *
15  */
16 
17 #if !defined (__LIBEDATA_CAL_H_INSIDE__) && !defined (LIBEDATA_CAL_COMPILATION)
18 #error "Only <libedata-cal/libedata-cal.h> should be included directly."
19 #endif
20 
21 #ifndef E_CAL_BACKEND_SYNC_H
22 #define E_CAL_BACKEND_SYNC_H
23 
24 #include <libedata-cal/e-cal-backend.h>
25 
26 /* Standard GObject macros */
27 #define E_TYPE_CAL_BACKEND_SYNC \
28 	(e_cal_backend_sync_get_type ())
29 #define E_CAL_BACKEND_SYNC(obj) \
30 	(G_TYPE_CHECK_INSTANCE_CAST \
31 	((obj), E_TYPE_CAL_BACKEND_SYNC, ECalBackendSync))
32 #define E_CAL_BACKEND_SYNC_CLASS(cls) \
33 	(G_TYPE_CHECK_CLASS_CAST \
34 	((cls), E_TYPE_CAL_BACKEND_SYNC, ECalBackendSyncClass))
35 #define E_IS_CAL_BACKEND_SYNC(obj) \
36 	(G_TYPE_CHECK_INSTANCE_TYPE \
37 	((obj), E_TYPE_CAL_BACKEND_SYNC))
38 #define E_IS_CAL_BACKEND_SYNC_CLASS(cls) \
39 	(G_TYPE_CHECK_CLASS_TYPE \
40 	((cls), E_TYPE_CAL_BACKEND_SYNC))
41 #define E_CAL_BACKEND_SYNC_GET_CLASS(cls) \
42 	(G_TYPE_INSTANCE_GET_CLASS \
43 	((cls), E_TYPE_CAL_BACKEND_SYNC, ECalBackendSyncClass))
44 
45 G_BEGIN_DECLS
46 
47 typedef struct _ECalBackendSync ECalBackendSync;
48 typedef struct _ECalBackendSyncClass ECalBackendSyncClass;
49 typedef struct _ECalBackendSyncPrivate ECalBackendSyncPrivate;
50 
51 /**
52  * ECalBackendSync:
53  *
54  * Contains only private data that should be read and manipulated using the
55  * functions below.
56  **/
57 struct _ECalBackendSync {
58 	/*< private >*/
59 	ECalBackend parent;
60 	ECalBackendSyncPrivate *priv;
61 };
62 
63 /**
64  * ECalBackendSyncClass:
65  * @open_sync: Open the calendar
66  * @refresh_sync: Refresh the calendar
67  * @get_object_sync: Get single object
68  * @get_object_list_sync: Get multiple objects at once
69  * @get_free_busy_sync: Get Free/Busy objects
70  * @create_objects_sync: Create objects
71  * @modify_objects_sync: Modify objects
72  * @remove_objects_sync: Remove objects
73  * @receive_objects_sync: Receive objects
74  * @send_objects_sync: Send objects
75  * @get_attachment_uris_sync: Get attachments uris for given object
76  * @discard_alarm_sync: Discard alarm
77  * @get_timezone_sync: Get specified timezone
78  * @add_timezone_sync: Add specified timezone
79  *
80  * Base class structure for the #ECalBackendSync class
81  *
82  * Since: 3.4
83  **/
84 struct _ECalBackendSyncClass {
85 	/*< private >*/
86 	ECalBackendClass parent_class;
87 
88 	/*< public >*/
89 	/* Virtual methods */
90 	void		(*open_sync)		(ECalBackendSync *backend,
91 						 EDataCal *cal,
92 						 GCancellable *cancellable,
93 						 GError **error);
94 	void		(*refresh_sync)		(ECalBackendSync *backend,
95 						 EDataCal *cal,
96 						 GCancellable *cancellable,
97 						 GError **error);
98 
99 	void		(*get_object_sync)	(ECalBackendSync *backend,
100 						 EDataCal *cal,
101 						 GCancellable *cancellable,
102 						 const gchar *uid,
103 						 const gchar *rid,
104 						 gchar **calobj,
105 						 GError **error);
106 	void		(*get_object_list_sync)	(ECalBackendSync *backend,
107 						 EDataCal *cal,
108 						 GCancellable *cancellable,
109 						 const gchar *sexp,
110 						 GSList **calobjs,
111 						 GError **error);
112 	void		(*get_free_busy_sync)	(ECalBackendSync *backend,
113 						 EDataCal *cal,
114 						 GCancellable *cancellable,
115 						 const GSList *users,
116 						 time_t start,
117 						 time_t end,
118 						 GSList **freebusyobjs,
119 						 GError **error);
120 	void		(*create_objects_sync)	(ECalBackendSync *backend,
121 						 EDataCal *cal,
122 						 GCancellable *cancellable,
123 						 const GSList *calobjs,
124 						 ECalOperationFlags opflags,
125 						 GSList **uids,
126 						 GSList **new_components,
127 						 GError **error);
128 	void		(*modify_objects_sync)	(ECalBackendSync *backend,
129 						 EDataCal *cal,
130 						 GCancellable *cancellable,
131 						 const GSList *calobjs,
132 						 ECalObjModType mod,
133 						 ECalOperationFlags opflags,
134 						 GSList **old_components,
135 						 GSList **new_components,
136 						 GError **error);
137 	void		(*remove_objects_sync)	(ECalBackendSync *backend,
138 						 EDataCal *cal,
139 						 GCancellable *cancellable,
140 						 const GSList *ids,
141 						 ECalObjModType mod,
142 						 ECalOperationFlags opflags,
143 						 GSList **old_components,
144 						 GSList **new_components,
145 						 GError **error);
146 	void		(*receive_objects_sync)	(ECalBackendSync *backend,
147 						 EDataCal *cal,
148 						 GCancellable *cancellable,
149 						 const gchar *calobj,
150 						 ECalOperationFlags opflags,
151 						 GError **error);
152 	void		(*send_objects_sync)	(ECalBackendSync *backend,
153 						 EDataCal *cal,
154 						 GCancellable *cancellable,
155 						 const gchar *calobj,
156 						 ECalOperationFlags opflags,
157 						 GSList **users,
158 						 gchar **modified_calobj,
159 						 GError **error);
160 	void		(*get_attachment_uris_sync)
161 						(ECalBackendSync *backend,
162 						 EDataCal *cal,
163 						 GCancellable *cancellable,
164 						 const gchar *uid,
165 						 const gchar *rid,
166 						 GSList **attachments,
167 						 GError **error);
168 	void		(*discard_alarm_sync)	(ECalBackendSync *backend,
169 						 EDataCal *cal,
170 						 GCancellable *cancellable,
171 						 const gchar *uid,
172 						 const gchar *rid,
173 						 const gchar *auid,
174 						 ECalOperationFlags opflags,
175 						 GError **error);
176 	void		(*get_timezone_sync)	(ECalBackendSync *backend,
177 						 EDataCal *cal,
178 						 GCancellable *cancellable,
179 						 const gchar *tzid,
180 						 gchar **tzobject,
181 						 GError **error);
182 	void		(*add_timezone_sync)	(ECalBackendSync *backend,
183 						 EDataCal *cal,
184 						 GCancellable *cancellable,
185 						 const gchar *tzobject,
186 						 GError **error);
187 
188 	/* Padding for future expansion */
189 	gpointer reserved_padding[20];
190 };
191 
192 GType		e_cal_backend_sync_get_type	(void) G_GNUC_CONST;
193 void		e_cal_backend_sync_open		(ECalBackendSync *backend,
194 						 EDataCal *cal,
195 						 GCancellable *cancellable,
196 						 GError **error);
197 void		e_cal_backend_sync_refresh	(ECalBackendSync *backend,
198 						 EDataCal *cal,
199 						 GCancellable *cancellable,
200 						 GError **error);
201 void		e_cal_backend_sync_get_object	(ECalBackendSync *backend,
202 						 EDataCal *cal,
203 						 GCancellable *cancellable,
204 						 const gchar *uid,
205 						 const gchar *rid,
206 						 gchar **calobj,
207 						 GError **error);
208 void		e_cal_backend_sync_get_object_list
209 						(ECalBackendSync *backend,
210 						 EDataCal *cal,
211 						 GCancellable *cancellable,
212 						 const gchar *sexp,
213 						 GSList **calobjs,
214 						 GError **error);
215 void		e_cal_backend_sync_get_free_busy
216 						(ECalBackendSync *backend,
217 						 EDataCal *cal,
218 						 GCancellable *cancellable,
219 						 const GSList *users,
220 						 time_t start,
221 						 time_t end,
222 						 GSList **freebusyobjects,
223 						 GError **error);
224 void		e_cal_backend_sync_create_objects
225 						(ECalBackendSync *backend,
226 						 EDataCal *cal,
227 						 GCancellable *cancellable,
228 						 const GSList *calobjs,
229 						 ECalOperationFlags opflags,
230 						 GSList **uids,
231 						 GSList **new_components,
232 						 GError **error);
233 void		e_cal_backend_sync_modify_objects
234 						(ECalBackendSync *backend,
235 						 EDataCal *cal,
236 						 GCancellable *cancellable,
237 						 const GSList *calobjs,
238 						 ECalObjModType mod,
239 						 ECalOperationFlags opflags,
240 						 GSList **old_components,
241 						 GSList **new_components,
242 						 GError **error);
243 void		e_cal_backend_sync_remove_objects
244 						(ECalBackendSync *backend,
245 						 EDataCal *cal,
246 						 GCancellable *cancellable,
247 						 const GSList *ids,
248 						 ECalObjModType mod,
249 						 ECalOperationFlags opflags,
250 						 GSList **old_components,
251 						 GSList **new_components,
252 						 GError **error);
253 void		e_cal_backend_sync_receive_objects
254 						(ECalBackendSync *backend,
255 						 EDataCal *cal,
256 						 GCancellable *cancellable,
257 						 const gchar *calobj,
258 						 ECalOperationFlags opflags,
259 						 GError **error);
260 void		e_cal_backend_sync_send_objects	(ECalBackendSync *backend,
261 						 EDataCal *cal,
262 						 GCancellable *cancellable,
263 						 const gchar *calobj,
264 						 ECalOperationFlags opflags,
265 						 GSList **users,
266 						 gchar **modified_calobj,
267 						 GError **error);
268 void		e_cal_backend_sync_get_attachment_uris
269 						(ECalBackendSync *backend,
270 						 EDataCal *cal,
271 						 GCancellable *cancellable,
272 						 const gchar *uid,
273 						 const gchar *rid,
274 						 GSList **attachments,
275 						 GError **error);
276 void		e_cal_backend_sync_discard_alarm
277 						(ECalBackendSync *backend,
278 						 EDataCal *cal,
279 						 GCancellable *cancellable,
280 						 const gchar *uid,
281 						 const gchar *rid,
282 						 const gchar *auid,
283 						 ECalOperationFlags opflags,
284 						 GError **error);
285 void		e_cal_backend_sync_get_timezone	(ECalBackendSync *backend,
286 						 EDataCal *cal,
287 						 GCancellable *cancellable,
288 						 const gchar *tzid,
289 						 gchar **tzobject,
290 						 GError **error);
291 void		e_cal_backend_sync_add_timezone	(ECalBackendSync *backend,
292 						 EDataCal *cal,
293 						 GCancellable *cancellable,
294 						 const gchar *tzobject,
295 						 GError **error);
296 
297 G_END_DECLS
298 
299 #endif /* E_CAL_BACKEND_SYNC_H */
300