1 /* 2 * e-book-client.h 3 * 4 * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com) 5 * Copyright (C) 2012 Intel Corporation 6 * 7 * This library is free software: you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation. 10 * 11 * This library is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 * for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with this library. If not, see <http://www.gnu.org/licenses/>. 18 * 19 */ 20 21 #if !defined (__LIBEBOOK_H_INSIDE__) && !defined (LIBEBOOK_COMPILATION) 22 #error "Only <libebook/libebook.h> should be included directly." 23 #endif 24 25 #ifndef E_BOOK_CLIENT_H 26 #define E_BOOK_CLIENT_H 27 28 #include <libedataserver/libedataserver.h> 29 30 #include <libebook/e-book-client-view.h> 31 #include <libebook/e-book-client-cursor.h> 32 #include <libebook-contacts/libebook-contacts.h> 33 34 /* Standard GObject macros */ 35 #define E_TYPE_BOOK_CLIENT \ 36 (e_book_client_get_type ()) 37 #define E_BOOK_CLIENT(obj) \ 38 (G_TYPE_CHECK_INSTANCE_CAST \ 39 ((obj), E_TYPE_BOOK_CLIENT, EBookClient)) 40 #define E_BOOK_CLIENT_CLASS(cls) \ 41 (G_TYPE_CHECK_CLASS_CAST \ 42 ((cls), E_TYPE_BOOK_CLIENT, EBookClientClass)) 43 #define E_IS_BOOK_CLIENT(obj) \ 44 (G_TYPE_CHECK_INSTANCE_TYPE \ 45 ((obj), E_TYPE_BOOK_CLIENT)) 46 #define E_IS_BOOK_CLIENT_CLASS(cls) \ 47 (G_TYPE_CHECK_CLASS_TYPE \ 48 ((cls), E_TYPE_BOOK_CLIENT)) 49 #define E_BOOK_CLIENT_GET_CLASS(obj) \ 50 (G_TYPE_INSTANCE_GET_CLASS \ 51 ((obj), E_TYPE_BOOK_CLIENT, EBookClientClass)) 52 53 G_BEGIN_DECLS 54 55 typedef struct _EBookClient EBookClient; 56 typedef struct _EBookClientClass EBookClientClass; 57 typedef struct _EBookClientPrivate EBookClientPrivate; 58 59 /** 60 * EBookClient: 61 * 62 * Contains only private data that should be read and manipulated using the 63 * functions below. 64 * 65 * Since: 3.2 66 **/ 67 struct _EBookClient { 68 /*< private >*/ 69 EClient parent; 70 EBookClientPrivate *priv; 71 }; 72 73 /** 74 * EBookClientClass: 75 * 76 * Class structure for the #EBookClient class. 77 * 78 * Since: 3.2 79 **/ 80 struct _EBookClientClass { 81 /*< private >*/ 82 EClientClass parent_class; 83 }; 84 85 GType e_book_client_get_type (void) G_GNUC_CONST; 86 EClient * e_book_client_connect_sync (ESource *source, 87 guint32 wait_for_connected_seconds, 88 GCancellable *cancellable, 89 GError **error); 90 void e_book_client_connect (ESource *source, 91 guint32 wait_for_connected_seconds, 92 GCancellable *cancellable, 93 GAsyncReadyCallback callback, 94 gpointer user_data); 95 EClient * e_book_client_connect_finish (GAsyncResult *result, 96 GError **error); 97 EClient * e_book_client_connect_direct_sync 98 (ESourceRegistry *registry, 99 ESource *source, 100 guint32 wait_for_connected_seconds, 101 GCancellable *cancellable, 102 GError **error); 103 void e_book_client_connect_direct (ESource *source, 104 guint32 wait_for_connected_seconds, 105 GCancellable *cancellable, 106 GAsyncReadyCallback callback, 107 gpointer user_data); 108 EClient * e_book_client_connect_direct_finish 109 (GAsyncResult *result, 110 GError **error); 111 gboolean e_book_client_get_self (ESourceRegistry *registry, 112 EContact **out_contact, 113 EBookClient **out_client, 114 GError **error); 115 gboolean e_book_client_set_self (EBookClient *client, 116 EContact *contact, 117 GError **error); 118 gboolean e_book_client_is_self (EContact *contact); 119 void e_book_client_add_contact (EBookClient *client, 120 EContact *contact, 121 guint32 opflags, /* bit-or of EBookOperationFlags */ 122 GCancellable *cancellable, 123 GAsyncReadyCallback callback, 124 gpointer user_data); 125 gboolean e_book_client_add_contact_finish 126 (EBookClient *client, 127 GAsyncResult *result, 128 gchar **out_added_uid, 129 GError **error); 130 gboolean e_book_client_add_contact_sync (EBookClient *client, 131 EContact *contact, 132 guint32 opflags, /* bit-or of EBookOperationFlags */ 133 gchar **out_added_uid, 134 GCancellable *cancellable, 135 GError **error); 136 void e_book_client_add_contacts (EBookClient *client, 137 GSList *contacts, 138 guint32 opflags, /* bit-or of EBookOperationFlags */ 139 GCancellable *cancellable, 140 GAsyncReadyCallback callback, 141 gpointer user_data); 142 gboolean e_book_client_add_contacts_finish 143 (EBookClient *client, 144 GAsyncResult *result, 145 GSList **out_added_uids, 146 GError **error); 147 gboolean e_book_client_add_contacts_sync (EBookClient *client, 148 GSList *contacts, 149 guint32 opflags, /* bit-or of EBookOperationFlags */ 150 GSList **out_added_uids, 151 GCancellable *cancellable, 152 GError **error); 153 void e_book_client_modify_contact (EBookClient *client, 154 EContact *contact, 155 guint32 opflags, /* bit-or of EBookOperationFlags */ 156 GCancellable *cancellable, 157 GAsyncReadyCallback callback, 158 gpointer user_data); 159 gboolean e_book_client_modify_contact_finish 160 (EBookClient *client, 161 GAsyncResult *result, 162 GError **error); 163 gboolean e_book_client_modify_contact_sync 164 (EBookClient *client, 165 EContact *contact, 166 guint32 opflags, /* bit-or of EBookOperationFlags */ 167 GCancellable *cancellable, 168 GError **error); 169 void e_book_client_modify_contacts (EBookClient *client, 170 GSList *contacts, 171 guint32 opflags, /* bit-or of EBookOperationFlags */ 172 GCancellable *cancellable, 173 GAsyncReadyCallback callback, 174 gpointer user_data); 175 gboolean e_book_client_modify_contacts_finish 176 (EBookClient *client, 177 GAsyncResult *result, 178 GError **error); 179 gboolean e_book_client_modify_contacts_sync 180 (EBookClient *client, 181 GSList *contacts, 182 guint32 opflags, /* bit-or of EBookOperationFlags */ 183 GCancellable *cancellable, 184 GError **error); 185 void e_book_client_remove_contact (EBookClient *client, 186 EContact *contact, 187 guint32 opflags, /* bit-or of EBookOperationFlags */ 188 GCancellable *cancellable, 189 GAsyncReadyCallback callback, 190 gpointer user_data); 191 gboolean e_book_client_remove_contact_finish 192 (EBookClient *client, 193 GAsyncResult *result, 194 GError **error); 195 gboolean e_book_client_remove_contact_sync 196 (EBookClient *client, 197 EContact *contact, 198 guint32 opflags, /* bit-or of EBookOperationFlags */ 199 GCancellable *cancellable, 200 GError **error); 201 void e_book_client_remove_contact_by_uid 202 (EBookClient *client, 203 const gchar *uid, 204 guint32 opflags, /* bit-or of EBookOperationFlags */ 205 GCancellable *cancellable, 206 GAsyncReadyCallback callback, 207 gpointer user_data); 208 gboolean e_book_client_remove_contact_by_uid_finish 209 (EBookClient *client, 210 GAsyncResult *result, 211 GError **error); 212 gboolean e_book_client_remove_contact_by_uid_sync 213 (EBookClient *client, 214 const gchar *uid, 215 guint32 opflags, /* bit-or of EBookOperationFlags */ 216 GCancellable *cancellable, 217 GError **error); 218 void e_book_client_remove_contacts (EBookClient *client, 219 const GSList *uids, 220 guint32 opflags, /* bit-or of EBookOperationFlags */ 221 GCancellable *cancellable, 222 GAsyncReadyCallback callback, 223 gpointer user_data); 224 gboolean e_book_client_remove_contacts_finish 225 (EBookClient *client, 226 GAsyncResult *result, 227 GError **error); 228 gboolean e_book_client_remove_contacts_sync 229 (EBookClient *client, 230 const GSList *uids, 231 guint32 opflags, /* bit-or of EBookOperationFlags */ 232 GCancellable *cancellable, 233 GError **error); 234 void e_book_client_get_contact (EBookClient *client, 235 const gchar *uid, 236 GCancellable *cancellable, 237 GAsyncReadyCallback callback, 238 gpointer user_data); 239 gboolean e_book_client_get_contact_finish 240 (EBookClient *client, 241 GAsyncResult *result, 242 EContact **out_contact, 243 GError **error); 244 gboolean e_book_client_get_contact_sync (EBookClient *client, 245 const gchar *uid, 246 EContact **out_contact, 247 GCancellable *cancellable, 248 GError **error); 249 void e_book_client_get_contacts (EBookClient *client, 250 const gchar *sexp, 251 GCancellable *cancellable, 252 GAsyncReadyCallback callback, 253 gpointer user_data); 254 gboolean e_book_client_get_contacts_finish 255 (EBookClient *client, 256 GAsyncResult *result, 257 GSList **out_contacts, 258 GError **error); 259 gboolean e_book_client_get_contacts_sync (EBookClient *client, 260 const gchar *sexp, 261 GSList **out_contacts, 262 GCancellable *cancellable, 263 GError **error); 264 void e_book_client_get_contacts_uids (EBookClient *client, 265 const gchar *sexp, 266 GCancellable *cancellable, 267 GAsyncReadyCallback callback, 268 gpointer user_data); 269 gboolean e_book_client_get_contacts_uids_finish 270 (EBookClient *client, 271 GAsyncResult *result, 272 GSList **out_contact_uids, 273 GError **error); 274 gboolean e_book_client_get_contacts_uids_sync 275 (EBookClient *client, 276 const gchar *sexp, 277 GSList **out_contact_uids, 278 GCancellable *cancellable, 279 GError **error); 280 void e_book_client_get_view (EBookClient *client, 281 const gchar *sexp, 282 GCancellable *cancellable, 283 GAsyncReadyCallback callback, 284 gpointer user_data); 285 gboolean e_book_client_get_view_finish (EBookClient *client, 286 GAsyncResult *result, 287 EBookClientView **out_view, 288 GError **error); 289 gboolean e_book_client_get_view_sync (EBookClient *client, 290 const gchar *sexp, 291 EBookClientView **out_view, 292 GCancellable *cancellable, 293 GError **error); 294 void e_book_client_get_cursor (EBookClient *client, 295 const gchar *sexp, 296 const EContactField *sort_fields, 297 const EBookCursorSortType *sort_types, 298 guint n_fields, 299 GCancellable *cancellable, 300 GAsyncReadyCallback callback, 301 gpointer user_data); 302 gboolean e_book_client_get_cursor_finish (EBookClient *client, 303 GAsyncResult *result, 304 EBookClientCursor **out_cursor, 305 GError **error); 306 gboolean e_book_client_get_cursor_sync (EBookClient *client, 307 const gchar *sexp, 308 const EContactField *sort_fields, 309 const EBookCursorSortType *sort_types, 310 guint n_fields, 311 EBookClientCursor **out_cursor, 312 GCancellable *cancellable, 313 GError **error); 314 const gchar * e_book_client_get_locale (EBookClient *client); 315 316 #ifndef EDS_DISABLE_DEPRECATED 317 318 EBookClient * e_book_client_new (ESource *source, 319 GError **error); 320 #endif /* E_BOOK_DISABLE_DEPRECATED */ 321 322 G_END_DECLS 323 324 #endif /* E_BOOK_CLIENT_H */ 325