1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * The Evolution addressbook client object.
6 * Chris Toshok (toshok@ximian.com)
8 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
11 #if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION)
12 #error "Only <libebook/libebook.h> should be included directly."
18 /* e-book deprecated since 3.2, use e-book-client instead */
19 #ifndef E_BOOK_DISABLE_DEPRECATED
21 #include <libedataserver/libedataserver.h>
23 #include <libebook/e-contact.h>
24 #include <libebook/e-book-query.h>
25 #include <libebook/e-book-view.h>
26 #include <libebook/e-book-types.h>
28 #define E_TYPE_BOOK (e_book_get_type ())
29 #define E_BOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK, EBook))
30 #define E_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_BOOK, EBookClass))
31 #define E_IS_BOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK))
32 #define E_IS_BOOK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK))
33 #define E_BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK, EBookClass))
37 typedef struct _EBook EBook;
38 typedef struct _EBookClass EBookClass;
39 typedef struct _EBookPrivate EBookPrivate;
41 #ifndef E_BOOK_DISABLE_DEPRECATED
42 typedef void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure);
50 typedef void (*EBookAsyncCallback) (EBook *book, const GError *error, gpointer closure);
53 * EBookOpenProgressCallback:
57 typedef void (*EBookOpenProgressCallback) (EBook *book,
58 const gchar *status_message,
61 #ifndef E_BOOK_DISABLE_DEPRECATED
62 typedef void (*EBookIdCallback) (EBook *book, EBookStatus status, const gchar *id, gpointer closure);
63 typedef void (*EBookContactCallback) (EBook *book, EBookStatus status, EContact *contact, gpointer closure);
64 typedef void (*EBookListCallback) (EBook *book, EBookStatus status, GList *list, gpointer closure);
65 typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure);
66 typedef void (*EBookEListCallback) (EBook *book, EBookStatus status, EList *list, gpointer closure);
70 * EBookIdAsyncCallback:
74 typedef void (*EBookIdAsyncCallback) (EBook *book, const GError *error, const gchar *id, gpointer closure);
77 * EBookContactAsyncCallback:
81 typedef void (*EBookContactAsyncCallback) (EBook *book, const GError *error, EContact *contact, gpointer closure);
84 * EBookListAsyncCallback:
88 typedef void (*EBookListAsyncCallback) (EBook *book, const GError *error, GList *list, gpointer closure);
91 * EBookBookViewAsyncCallback:
95 typedef void (*EBookBookViewAsyncCallback) (EBook *book, const GError *error, EBookView *book_view, gpointer closure);
98 * EBookEListAsyncCallback:
102 typedef void (*EBookEListAsyncCallback) (EBook *book, const GError *error, EList *list, gpointer closure);
116 void (* writable_status) (EBook *book, gboolean writable);
117 void (* connection_status) (EBook *book, gboolean connected);
118 void (* backend_died) (EBook *book);
120 /* Padding for future expansion */
121 void (*_ebook_reserved0) (void);
122 void (*_ebook_reserved1) (void);
123 void (*_ebook_reserved2) (void);
124 void (*_ebook_reserved3) (void);
125 void (*_ebook_reserved4) (void);
128 /* Creating a new addressbook. */
129 EBook *e_book_new (ESource *source, GError **error);
131 /* loading addressbooks */
132 gboolean e_book_open (EBook *book,
133 gboolean only_if_exists,
136 #ifndef E_BOOK_DISABLE_DEPRECATED
137 gboolean e_book_async_open (EBook *book,
138 gboolean only_if_exists,
139 EBookCallback open_response,
143 gboolean e_book_open_async (EBook *book,
144 gboolean only_if_exists,
145 EBookAsyncCallback open_response,
148 gboolean e_book_remove (EBook *book,
150 #ifndef E_BOOK_DISABLE_DEPRECATED
151 gboolean e_book_async_remove (EBook *book,
156 gboolean e_book_remove_async (EBook *book,
157 EBookAsyncCallback cb,
160 gboolean e_book_get_required_fields (EBook *book,
164 #ifndef E_BOOK_DISABLE_DEPRECATED
165 gboolean e_book_async_get_required_fields (EBook *book,
166 EBookEListCallback cb,
170 gboolean e_book_get_required_fields_async (EBook *book,
171 EBookEListAsyncCallback cb,
174 gboolean e_book_get_supported_fields (EBook *book,
178 #ifndef E_BOOK_DISABLE_DEPRECATED
179 gboolean e_book_async_get_supported_fields (EBook *book,
180 EBookEListCallback cb,
184 gboolean e_book_get_supported_fields_async (EBook *book,
185 EBookEListAsyncCallback cb,
188 gboolean e_book_get_supported_auth_methods (EBook *book,
189 GList **auth_methods,
192 #ifndef E_BOOK_DISABLE_DEPRECATED
193 gboolean e_book_async_get_supported_auth_methods (EBook *book,
194 EBookEListCallback cb,
198 gboolean e_book_get_supported_auth_methods_async (EBook *book,
199 EBookEListAsyncCallback cb,
202 /* Fetching contacts. */
203 gboolean e_book_get_contact (EBook *book,
208 #ifndef E_BOOK_DISABLE_DEPRECATED
209 gboolean e_book_async_get_contact (EBook *book,
211 EBookContactCallback cb,
215 gboolean e_book_get_contact_async (EBook *book,
217 EBookContactAsyncCallback cb,
220 /* Deleting contacts. */
221 gboolean e_book_remove_contact (EBook *book,
225 #ifndef E_BOOK_DISABLE_DEPRECATED
226 gboolean e_book_async_remove_contact (EBook *book,
230 gboolean e_book_async_remove_contact_by_id (EBook *book,
236 gboolean e_book_remove_contact_async (EBook *book,
238 EBookAsyncCallback cb,
240 gboolean e_book_remove_contact_by_id_async (EBook *book,
242 EBookAsyncCallback cb,
245 gboolean e_book_remove_contacts (EBook *book,
249 #ifndef E_BOOK_DISABLE_DEPRECATED
250 gboolean e_book_async_remove_contacts (EBook *book,
256 gboolean e_book_remove_contacts_async (EBook *book,
258 EBookAsyncCallback cb,
261 /* Adding contacts. */
262 gboolean e_book_add_contact (EBook *book,
266 #ifndef E_BOOK_DISABLE_DEPRECATED
267 gboolean e_book_async_add_contact (EBook *book,
273 gboolean e_book_add_contact_async (EBook *book,
275 EBookIdAsyncCallback cb,
278 /* Modifying contacts. */
279 gboolean e_book_commit_contact (EBook *book,
283 #ifndef E_BOOK_DISABLE_DEPRECATED
284 gboolean e_book_async_commit_contact (EBook *book,
290 gboolean e_book_commit_contact_async (EBook *book,
292 EBookAsyncCallback cb,
295 /* Returns a live view of a query. */
296 gboolean e_book_get_book_view (EBook *book,
298 GList *requested_fields,
300 EBookView **book_view,
303 #ifndef E_BOOK_DISABLE_DEPRECATED
304 gboolean e_book_async_get_book_view (EBook *book,
306 GList *requested_fields,
308 EBookBookViewCallback cb,
312 gboolean e_book_get_book_view_async (EBook *book,
314 GList *requested_fields,
316 EBookBookViewAsyncCallback cb,
319 /* Returns a static snapshot of a query. */
320 gboolean e_book_get_contacts (EBook *book,
325 #ifndef E_BOOK_DISABLE_DEPRECATED
326 gboolean e_book_async_get_contacts (EBook *book,
328 EBookListCallback cb,
332 gboolean e_book_get_contacts_async (EBook *book,
334 EBookListAsyncCallback cb,
337 /* Needed for syncing */
338 gboolean e_book_get_changes (EBook *book,
339 const gchar *changeid,
343 #ifndef E_BOOK_DISABLE_DEPRECATED
344 gboolean e_book_async_get_changes (EBook *book,
345 const gchar *changeid,
346 EBookListCallback cb,
350 gboolean e_book_get_changes_async (EBook *book,
351 const gchar *changeid,
352 EBookListAsyncCallback cb,
355 void e_book_free_change_list (GList *change_list);
357 ESource *e_book_get_source (EBook *book);
359 const gchar *e_book_get_static_capabilities (EBook *book,
361 gboolean e_book_check_static_capability (EBook *book,
363 gboolean e_book_is_opened (EBook *book);
364 gboolean e_book_is_writable (EBook *book);
366 gboolean e_book_is_online (EBook *book);
368 /* Cancel a pending operation. */
369 gboolean e_book_cancel (EBook *book,
372 gboolean e_book_cancel_async_op (EBook *book,
376 gboolean e_book_get_self (ESourceRegistry *registry, EContact **contact, EBook **book, GError **error);
377 gboolean e_book_set_self (EBook *book, EContact *contact, GError **error);
378 gboolean e_book_is_self (EContact *contact);
380 GType e_book_get_type (void);
384 #endif /* E_BOOK_DISABLE_DEPRECATED */
386 #endif /* __E_BOOK_H__ */