1 /* 2 * e-collection-backend.h 3 * 4 * This library is free software: you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This library is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this library. If not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #if !defined (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION) 19 #error "Only <libebackend/libebackend.h> should be included directly." 20 #endif 21 22 #ifndef E_COLLECTION_BACKEND_H 23 #define E_COLLECTION_BACKEND_H 24 25 #include <libebackend/e-backend.h> 26 #include <libebackend/e-backend-enums.h> 27 28 /* Standard GObject macros */ 29 #define E_TYPE_COLLECTION_BACKEND \ 30 (e_collection_backend_get_type ()) 31 #define E_COLLECTION_BACKEND(obj) \ 32 (G_TYPE_CHECK_INSTANCE_CAST \ 33 ((obj), E_TYPE_COLLECTION_BACKEND, ECollectionBackend)) 34 #define E_COLLECTION_BACKEND_CLASS(cls) \ 35 (G_TYPE_CHECK_CLASS_CAST \ 36 ((cls), E_TYPE_COLLECTION_BACKEND, ECollectionBackendClass)) 37 #define E_IS_COLLECTION_BACKEND(obj) \ 38 (G_TYPE_CHECK_INSTANCE_TYPE \ 39 ((obj), E_TYPE_COLLECTION_BACKEND)) 40 #define E_IS_COLLECTION_BACKEND_CLASS(cls) \ 41 (G_TYPE_CHECK_CLASS_TYPE \ 42 ((cls), E_TYPE_COLLECTION_BACKEND)) 43 #define E_COLLECTION_BACKEND_GET_CLASS(obj) \ 44 (G_TYPE_INSTANCE_GET_CLASS \ 45 ((obj), E_TYPE_COLLECTION_BACKEND, ECollectionBackendClass)) 46 47 G_BEGIN_DECLS 48 49 struct _ESourceRegistryServer; 50 51 typedef struct _ECollectionBackend ECollectionBackend; 52 typedef struct _ECollectionBackendClass ECollectionBackendClass; 53 typedef struct _ECollectionBackendPrivate ECollectionBackendPrivate; 54 55 /** 56 * ECollectionBackend: 57 * 58 * Contains only private data that should be read and manipulated using the 59 * functions below. 60 * 61 * Since: 3.6 62 **/ 63 struct _ECollectionBackend { 64 /*< private >*/ 65 EBackend parent; 66 ECollectionBackendPrivate *priv; 67 }; 68 69 struct _ECollectionBackendClass { 70 /*< private >*/ 71 EBackendClass parent_class; 72 73 /* Methods */ 74 void (*populate) (ECollectionBackend *backend); 75 gchar * (*dup_resource_id) (ECollectionBackend *backend, 76 ESource *child_source); 77 78 /* Signals */ 79 void (*child_added) (ECollectionBackend *backend, 80 ESource *child_source); 81 void (*child_removed) (ECollectionBackend *backend, 82 ESource *child_source); 83 84 /* More Methods (grouped separately to preserve the ABI) */ 85 gboolean (*create_resource_sync) (ECollectionBackend *backend, 86 ESource *source, 87 GCancellable *cancellable, 88 GError **error); 89 void (*create_resource) (ECollectionBackend *backend, 90 ESource *source, 91 GCancellable *cancellable, 92 GAsyncReadyCallback callback, 93 gpointer user_data); 94 gboolean (*create_resource_finish) 95 (ECollectionBackend *backend, 96 GAsyncResult *result, 97 GError **error); 98 gboolean (*delete_resource_sync) (ECollectionBackend *backend, 99 ESource *source, 100 GCancellable *cancellable, 101 GError **error); 102 void (*delete_resource) (ECollectionBackend *backend, 103 ESource *source, 104 GCancellable *cancellable, 105 GAsyncReadyCallback callback, 106 gpointer user_data); 107 gboolean (*delete_resource_finish) 108 (ECollectionBackend *backend, 109 GAsyncResult *result, 110 GError **error); 111 112 /*< private >*/ 113 gpointer reserved[10]; 114 }; 115 116 GType e_collection_backend_get_type (void) G_GNUC_CONST; 117 ESource * e_collection_backend_new_child (ECollectionBackend *backend, 118 const gchar *resource_id); 119 gboolean e_collection_backend_is_new_source 120 (ECollectionBackend *backend, 121 ESource *source); 122 GProxyResolver * 123 e_collection_backend_ref_proxy_resolver 124 (ECollectionBackend *backend); 125 struct _ESourceRegistryServer * 126 e_collection_backend_ref_server (ECollectionBackend *backend); 127 const gchar * e_collection_backend_get_cache_dir 128 (ECollectionBackend *backend); 129 gchar * e_collection_backend_dup_resource_id 130 (ECollectionBackend *backend, 131 ESource *child_source); 132 GList * e_collection_backend_claim_all_resources 133 (ECollectionBackend *backend); 134 GList * e_collection_backend_list_calendar_sources 135 (ECollectionBackend *backend); 136 GList * e_collection_backend_list_contacts_sources 137 (ECollectionBackend *backend); 138 GList * e_collection_backend_list_mail_sources 139 (ECollectionBackend *backend); 140 gboolean e_collection_backend_create_resource_sync 141 (ECollectionBackend *backend, 142 ESource *source, 143 GCancellable *cancellable, 144 GError **error); 145 void e_collection_backend_create_resource 146 (ECollectionBackend *backend, 147 ESource *source, 148 GCancellable *cancellable, 149 GAsyncReadyCallback callback, 150 gpointer user_data); 151 gboolean e_collection_backend_create_resource_finish 152 (ECollectionBackend *backend, 153 GAsyncResult *result, 154 GError **error); 155 gboolean e_collection_backend_delete_resource_sync 156 (ECollectionBackend *backend, 157 ESource *source, 158 GCancellable *cancellable, 159 GError **error); 160 void e_collection_backend_delete_resource 161 (ECollectionBackend *backend, 162 ESource *source, 163 GCancellable *cancellable, 164 GAsyncReadyCallback callback, 165 gpointer user_data); 166 gboolean e_collection_backend_delete_resource_finish 167 (ECollectionBackend *backend, 168 GAsyncResult *result, 169 GError **error); 170 void e_collection_backend_authenticate_children 171 (ECollectionBackend *backend, 172 const ENamedParameters *credentials); 173 void e_collection_backend_schedule_populate 174 (ECollectionBackend *backend); 175 gboolean e_collection_backend_get_populate_frozen 176 (ECollectionBackend *backend); 177 gboolean e_collection_backend_freeze_populate 178 (ECollectionBackend *backend); 179 void e_collection_backend_thaw_populate 180 (ECollectionBackend *backend); 181 gboolean e_collection_backend_get_part_enabled 182 (ECollectionBackend *backend, 183 ECollectionBackendParts parts); 184 185 G_END_DECLS 186 187 #endif /* E_COLLECTION_BACKEND_H */ 188 189