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