8ee290f381e4bbcb6a095fdcb65cbaa8d3768720
[platform/upstream/evolution-data-server.git] / libedataserver / e-source-registry.h
1 /*
2  * e-source-registry.h
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
16  *
17  */
18
19 #if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
20 #error "Only <libedataserver/libedataserver.h> should be included directly."
21 #endif
22
23 #ifndef E_SOURCE_REGISTRY_H
24 #define E_SOURCE_REGISTRY_H
25
26 #include <libedataserver/e-source.h>
27 #include <libedataserver/e-source-authenticator.h>
28
29 /* Standard GObject macros */
30 #define E_TYPE_SOURCE_REGISTRY \
31         (e_source_registry_get_type ())
32 #define E_SOURCE_REGISTRY(obj) \
33         (G_TYPE_CHECK_INSTANCE_CAST \
34         ((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistry))
35 #define E_SOURCE_REGISTRY_CLASS(cls) \
36         (G_TYPE_CHECK_CLASS_CAST \
37         ((cls), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass))
38 #define E_IS_SOURCE_REGISTRY(obj) \
39         (G_TYPE_CHECK_INSTANCE_TYPE \
40         ((obj), E_TYPE_SOURCE_REGISTRY))
41 #define E_IS_SOURCE_REGISTRY_CLASS(cls) \
42         (G_TYPE_CHECK_CLASS_TYPE \
43         ((cls), E_TYPE_SOURCE_REGISTRY))
44 #define E_SOURCE_REGISTRY_GET_CLASS(obj) \
45         (G_TYPE_INSTANCE_GET_CLASS \
46         ((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass))
47
48 G_BEGIN_DECLS
49
50 typedef struct _ESourceRegistry ESourceRegistry;
51 typedef struct _ESourceRegistryClass ESourceRegistryClass;
52 typedef struct _ESourceRegistryPrivate ESourceRegistryPrivate;
53
54 /**
55  * ESourceRegistry:
56  *
57  * Contains only private data that should be read and manipulated using the
58  * functions below.
59  *
60  * Since: 3.6
61  **/
62 struct _ESourceRegistry {
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 };
82
83 GType           e_source_registry_get_type      (void) G_GNUC_CONST;
84 ESourceRegistry *
85                 e_source_registry_new_sync      (GCancellable *cancellable,
86                                                  GError **error);
87 void            e_source_registry_new           (GCancellable *cancellable,
88                                                  GAsyncReadyCallback callback,
89                                                  gpointer user_data);
90 ESourceRegistry *
91                 e_source_registry_new_finish    (GAsyncResult *result,
92                                                  GError **error);
93 gboolean        e_source_registry_authenticate_sync
94                                                 (ESourceRegistry *registry,
95                                                  ESource *source,
96                                                  ESourceAuthenticator *auth,
97                                                  GCancellable *cancellable,
98                                                  GError **error);
99 void            e_source_registry_authenticate  (ESourceRegistry *registry,
100                                                  ESource *source,
101                                                  ESourceAuthenticator *auth,
102                                                  GCancellable *cancellable,
103                                                  GAsyncReadyCallback callback,
104                                                  gpointer user_data);
105 gboolean        e_source_registry_authenticate_finish
106                                                 (ESourceRegistry *registry,
107                                                  GAsyncResult *result,
108                                                  GError **error);
109 gboolean        e_source_registry_commit_source_sync
110                                                 (ESourceRegistry *registry,
111                                                  ESource *source,
112                                                  GCancellable *cancellable,
113                                                  GError **error);
114 void            e_source_registry_commit_source (ESourceRegistry *registry,
115                                                  ESource *source,
116                                                  GCancellable *cancellable,
117                                                  GAsyncReadyCallback callback,
118                                                  gpointer user_data);
119 gboolean        e_source_registry_commit_source_finish
120                                                 (ESourceRegistry *registry,
121                                                  GAsyncResult *result,
122                                                  GError **error);
123 gboolean        e_source_registry_create_sources_sync
124                                                 (ESourceRegistry *registry,
125                                                  GList *list_of_sources,
126                                                  GCancellable *cancellable,
127                                                  GError **error);
128 void            e_source_registry_create_sources
129                                                 (ESourceRegistry *registry,
130                                                  GList *list_of_sources,
131                                                  GCancellable *cancellable,
132                                                  GAsyncReadyCallback callback,
133                                                  gpointer user_data);
134 gboolean        e_source_registry_create_sources_finish
135                                                 (ESourceRegistry *registry,
136                                                  GAsyncResult *result,
137                                                  GError **error);
138 ESource *       e_source_registry_ref_source    (ESourceRegistry *registry,
139                                                  const gchar *uid);
140 GList *         e_source_registry_list_sources  (ESourceRegistry *registry,
141                                                  const gchar *extension_name);
142 ESource *       e_source_registry_find_extension
143                                                 (ESourceRegistry *registry,
144                                                  ESource *source,
145                                                  const gchar *extension_name);
146 GNode *         e_source_registry_build_display_tree
147                                                 (ESourceRegistry *registry,
148                                                  const gchar *extension_name);
149 void            e_source_registry_free_display_tree
150                                                 (GNode *display_tree);
151 void            e_source_registry_debug_dump    (ESourceRegistry *registry,
152                                                  const gchar *extension_name);
153
154 /* The following is a front-end for the "org.gnome.Evolution.DefaultSources"
155  * GSettings schema, except that it gets and sets ESource objects instead of
156  * ESource UID strings. */
157
158 ESource *       e_source_registry_ref_builtin_address_book
159                                                 (ESourceRegistry *registry);
160 ESource *       e_source_registry_ref_default_address_book
161                                                 (ESourceRegistry *registry);
162 void            e_source_registry_set_default_address_book
163                                                 (ESourceRegistry *registry,
164                                                  ESource *default_source);
165 ESource *       e_source_registry_ref_builtin_calendar
166                                                 (ESourceRegistry *registry);
167 ESource *       e_source_registry_ref_default_calendar
168                                                 (ESourceRegistry *registry);
169 void            e_source_registry_set_default_calendar
170                                                 (ESourceRegistry *registry,
171                                                  ESource *default_source);
172 ESource *       e_source_registry_ref_builtin_mail_account
173                                                 (ESourceRegistry *registry);
174 ESource *       e_source_registry_ref_default_mail_account
175                                                 (ESourceRegistry *registry);
176 void            e_source_registry_set_default_mail_account
177                                                 (ESourceRegistry *registry,
178                                                  ESource *default_source);
179 ESource *       e_source_registry_ref_default_mail_identity
180                                                 (ESourceRegistry *registry);
181 void            e_source_registry_set_default_mail_identity
182                                                 (ESourceRegistry *registry,
183                                                  ESource *default_source);
184 ESource *       e_source_registry_ref_builtin_memo_list
185                                                 (ESourceRegistry *registry);
186 ESource *       e_source_registry_ref_default_memo_list
187                                                 (ESourceRegistry *registry);
188 void            e_source_registry_set_default_memo_list
189                                                 (ESourceRegistry *registry,
190                                                  ESource *default_source);
191 ESource *       e_source_registry_ref_builtin_task_list
192                                                 (ESourceRegistry *registry);
193 ESource *       e_source_registry_ref_default_task_list
194                                                 (ESourceRegistry *registry);
195 void            e_source_registry_set_default_task_list
196                                                 (ESourceRegistry *registry,
197                                                  ESource *default_source);
198 ESource *       e_source_registry_ref_default_for_extension_name
199                                                 (ESourceRegistry *registry,
200                                                  const gchar *extension_name);
201 void            e_source_registry_set_default_for_extension_name
202                                                 (ESourceRegistry *registry,
203                                                  const gchar *extension_name,
204                                                  ESource *default_source);
205
206 G_END_DECLS
207
208 #endif /* E_SOURCE_REGISTRY_H */