1 /* 2 * e-source-registry.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 (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION) 19 #error "Only <libedataserver/libedataserver.h> should be included directly." 20 #endif 21 22 #ifndef E_SOURCE_REGISTRY_H 23 #define E_SOURCE_REGISTRY_H 24 25 #include <libedataserver/e-oauth2-services.h> 26 #include <libedataserver/e-source.h> 27 28 /* Standard GObject macros */ 29 #define E_TYPE_SOURCE_REGISTRY \ 30 (e_source_registry_get_type ()) 31 #define E_SOURCE_REGISTRY(obj) \ 32 (G_TYPE_CHECK_INSTANCE_CAST \ 33 ((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistry)) 34 #define E_SOURCE_REGISTRY_CLASS(cls) \ 35 (G_TYPE_CHECK_CLASS_CAST \ 36 ((cls), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass)) 37 #define E_IS_SOURCE_REGISTRY(obj) \ 38 (G_TYPE_CHECK_INSTANCE_TYPE \ 39 ((obj), E_TYPE_SOURCE_REGISTRY)) 40 #define E_IS_SOURCE_REGISTRY_CLASS(cls) \ 41 (G_TYPE_CHECK_CLASS_TYPE \ 42 ((cls), E_TYPE_SOURCE_REGISTRY)) 43 #define E_SOURCE_REGISTRY_GET_CLASS(obj) \ 44 (G_TYPE_INSTANCE_GET_CLASS \ 45 ((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass)) 46 47 G_BEGIN_DECLS 48 49 typedef struct _ESourceRegistry ESourceRegistry; 50 typedef struct _ESourceRegistryClass ESourceRegistryClass; 51 typedef struct _ESourceRegistryPrivate ESourceRegistryPrivate; 52 53 /** 54 * ESourceRegistry: 55 * 56 * Contains only private data that should be read and manipulated using the 57 * functions below. 58 * 59 * Since: 3.6 60 **/ 61 struct _ESourceRegistry { 62 /*< private >*/ 63 GObject parent; 64 ESourceRegistryPrivate *priv; 65 }; 66 67 struct _ESourceRegistryClass { 68 GObjectClass parent_class; 69 70 /* Signals */ 71 void (*source_added) (ESourceRegistry *registry, 72 ESource *source); 73 void (*source_changed) (ESourceRegistry *registry, 74 ESource *source); 75 void (*source_removed) (ESourceRegistry *registry, 76 ESource *source); 77 void (*source_enabled) (ESourceRegistry *registry, 78 ESource *source); 79 void (*source_disabled) (ESourceRegistry *registry, 80 ESource *source); 81 void (*credentials_required) (ESourceRegistry *registry, 82 ESource *source, 83 ESourceCredentialsReason reason, 84 const gchar *certificate_pem, 85 GTlsCertificateFlags certificate_errors, 86 const GError *op_error); 87 }; 88 89 GType e_source_registry_get_type (void) G_GNUC_CONST; 90 ESourceRegistry * 91 e_source_registry_new_sync (GCancellable *cancellable, 92 GError **error); 93 void e_source_registry_new (GCancellable *cancellable, 94 GAsyncReadyCallback callback, 95 gpointer user_data); 96 ESourceRegistry * 97 e_source_registry_new_finish (GAsyncResult *result, 98 GError **error); 99 EOAuth2Services * 100 e_source_registry_get_oauth2_services 101 (ESourceRegistry *registry); 102 gboolean e_source_registry_commit_source_sync 103 (ESourceRegistry *registry, 104 ESource *source, 105 GCancellable *cancellable, 106 GError **error); 107 void e_source_registry_commit_source (ESourceRegistry *registry, 108 ESource *source, 109 GCancellable *cancellable, 110 GAsyncReadyCallback callback, 111 gpointer user_data); 112 gboolean e_source_registry_commit_source_finish 113 (ESourceRegistry *registry, 114 GAsyncResult *result, 115 GError **error); 116 gboolean e_source_registry_create_sources_sync 117 (ESourceRegistry *registry, 118 GList *list_of_sources, 119 GCancellable *cancellable, 120 GError **error); 121 void e_source_registry_create_sources 122 (ESourceRegistry *registry, 123 GList *list_of_sources, 124 GCancellable *cancellable, 125 GAsyncReadyCallback callback, 126 gpointer user_data); 127 gboolean e_source_registry_create_sources_finish 128 (ESourceRegistry *registry, 129 GAsyncResult *result, 130 GError **error); 131 gboolean e_source_registry_refresh_backend_sync 132 (ESourceRegistry *registry, 133 const gchar *source_uid, 134 GCancellable *cancellable, 135 GError **error); 136 void e_source_registry_refresh_backend 137 (ESourceRegistry *registry, 138 const gchar *source_uid, 139 GCancellable *cancellable, 140 GAsyncReadyCallback callback, 141 gpointer user_data); 142 gboolean e_source_registry_refresh_backend_finish 143 (ESourceRegistry *registry, 144 GAsyncResult *result, 145 GError **error); 146 ESource * e_source_registry_ref_source (ESourceRegistry *registry, 147 const gchar *uid); 148 GList * e_source_registry_list_sources (ESourceRegistry *registry, 149 const gchar *extension_name); 150 GList * e_source_registry_list_enabled (ESourceRegistry *registry, 151 const gchar *extension_name); 152 ESource * e_source_registry_find_extension 153 (ESourceRegistry *registry, 154 ESource *source, 155 const gchar *extension_name); 156 gboolean e_source_registry_check_enabled (ESourceRegistry *registry, 157 ESource *source); 158 GNode * e_source_registry_build_display_tree 159 (ESourceRegistry *registry, 160 const gchar *extension_name); 161 void e_source_registry_free_display_tree 162 (GNode *display_tree); 163 gchar * e_source_registry_dup_unique_display_name 164 (ESourceRegistry *registry, 165 ESource *source, 166 const gchar *extension_name); 167 void e_source_registry_debug_dump (ESourceRegistry *registry, 168 const gchar *extension_name); 169 170 /* These built-in ESource objects are always available. */ 171 172 ESource * e_source_registry_ref_builtin_address_book 173 (ESourceRegistry *registry); 174 ESource * e_source_registry_ref_builtin_calendar 175 (ESourceRegistry *registry); 176 ESource * e_source_registry_ref_builtin_mail_account 177 (ESourceRegistry *registry); 178 ESource * e_source_registry_ref_builtin_memo_list 179 (ESourceRegistry *registry); 180 ESource * e_source_registry_ref_builtin_proxy 181 (ESourceRegistry *registry); 182 ESource * e_source_registry_ref_builtin_task_list 183 (ESourceRegistry *registry); 184 185 /* The following is a front-end for the "org.gnome.Evolution.DefaultSources" 186 * GSettings schema, except that it gets and sets ESource objects instead of 187 * ESource UID strings. */ 188 189 ESource * e_source_registry_ref_default_address_book 190 (ESourceRegistry *registry); 191 void e_source_registry_set_default_address_book 192 (ESourceRegistry *registry, 193 ESource *default_source); 194 ESource * e_source_registry_ref_default_calendar 195 (ESourceRegistry *registry); 196 void e_source_registry_set_default_calendar 197 (ESourceRegistry *registry, 198 ESource *default_source); 199 ESource * e_source_registry_ref_default_mail_account 200 (ESourceRegistry *registry); 201 void e_source_registry_set_default_mail_account 202 (ESourceRegistry *registry, 203 ESource *default_source); 204 ESource * e_source_registry_ref_default_mail_identity 205 (ESourceRegistry *registry); 206 void e_source_registry_set_default_mail_identity 207 (ESourceRegistry *registry, 208 ESource *default_source); 209 ESource * e_source_registry_ref_default_memo_list 210 (ESourceRegistry *registry); 211 void e_source_registry_set_default_memo_list 212 (ESourceRegistry *registry, 213 ESource *default_source); 214 ESource * e_source_registry_ref_default_task_list 215 (ESourceRegistry *registry); 216 void e_source_registry_set_default_task_list 217 (ESourceRegistry *registry, 218 ESource *default_source); 219 ESource * e_source_registry_ref_default_for_extension_name 220 (ESourceRegistry *registry, 221 const gchar *extension_name); 222 void e_source_registry_set_default_for_extension_name 223 (ESourceRegistry *registry, 224 const gchar *extension_name, 225 ESource *default_source); 226 227 G_END_DECLS 228 229 #endif /* E_SOURCE_REGISTRY_H */ 230