summaryrefslogtreecommitdiff
path: root/libedataserver/e-source-registry.h
blob: b3aba3335229b82a73321bbefa63e83174f16897 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
 * e-source-registry.h
 *
 * This library is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if !defined (__LIBEDATASERVER_H_INSIDE__) && !defined (LIBEDATASERVER_COMPILATION)
#error "Only <libedataserver/libedataserver.h> should be included directly."
#endif

#ifndef E_SOURCE_REGISTRY_H
#define E_SOURCE_REGISTRY_H

#include <libedataserver/e-source.h>

/* Standard GObject macros */
#define E_TYPE_SOURCE_REGISTRY \
	(e_source_registry_get_type ())
#define E_SOURCE_REGISTRY(obj) \
	(G_TYPE_CHECK_INSTANCE_CAST \
	((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistry))
#define E_SOURCE_REGISTRY_CLASS(cls) \
	(G_TYPE_CHECK_CLASS_CAST \
	((cls), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass))
#define E_IS_SOURCE_REGISTRY(obj) \
	(G_TYPE_CHECK_INSTANCE_TYPE \
	((obj), E_TYPE_SOURCE_REGISTRY))
#define E_IS_SOURCE_REGISTRY_CLASS(cls) \
	(G_TYPE_CHECK_CLASS_TYPE \
	((cls), E_TYPE_SOURCE_REGISTRY))
#define E_SOURCE_REGISTRY_GET_CLASS(obj) \
	(G_TYPE_INSTANCE_GET_CLASS \
	((obj), E_TYPE_SOURCE_REGISTRY, ESourceRegistryClass))

G_BEGIN_DECLS

typedef struct _ESourceRegistry ESourceRegistry;
typedef struct _ESourceRegistryClass ESourceRegistryClass;
typedef struct _ESourceRegistryPrivate ESourceRegistryPrivate;

/**
 * ESourceRegistry:
 *
 * Contains only private data that should be read and manipulated using the
 * functions below.
 *
 * Since: 3.6
 **/
struct _ESourceRegistry {
	GObject parent;
	ESourceRegistryPrivate *priv;
};

struct _ESourceRegistryClass {
	GObjectClass parent_class;

	/* Signals */
	void		(*source_added)		(ESourceRegistry *registry,
						 ESource *source);
	void		(*source_changed)	(ESourceRegistry *registry,
						 ESource *source);
	void		(*source_removed)	(ESourceRegistry *registry,
						 ESource *source);
	void		(*source_enabled)	(ESourceRegistry *registry,
						 ESource *source);
	void		(*source_disabled)	(ESourceRegistry *registry,
						 ESource *source);
	void		(*credentials_required)	(ESourceRegistry *registry,
						 ESource *source,
						 ESourceCredentialsReason reason,
						 const gchar *certificate_pem,
						 GTlsCertificateFlags certificate_errors,
						 const GError *op_error);
};

GType		e_source_registry_get_type	(void) G_GNUC_CONST;
ESourceRegistry *
		e_source_registry_new_sync	(GCancellable *cancellable,
						 GError **error);
void		e_source_registry_new		(GCancellable *cancellable,
						 GAsyncReadyCallback callback,
						 gpointer user_data);
ESourceRegistry *
		e_source_registry_new_finish	(GAsyncResult *result,
						 GError **error);
gboolean	e_source_registry_commit_source_sync
						(ESourceRegistry *registry,
						 ESource *source,
						 GCancellable *cancellable,
						 GError **error);
void		e_source_registry_commit_source	(ESourceRegistry *registry,
						 ESource *source,
						 GCancellable *cancellable,
						 GAsyncReadyCallback callback,
						 gpointer user_data);
gboolean	e_source_registry_commit_source_finish
						(ESourceRegistry *registry,
						 GAsyncResult *result,
						 GError **error);
gboolean	e_source_registry_create_sources_sync
						(ESourceRegistry *registry,
						 GList *list_of_sources,
						 GCancellable *cancellable,
						 GError **error);
void		e_source_registry_create_sources
						(ESourceRegistry *registry,
						 GList *list_of_sources,
						 GCancellable *cancellable,
						 GAsyncReadyCallback callback,
						 gpointer user_data);
gboolean	e_source_registry_create_sources_finish
						(ESourceRegistry *registry,
						 GAsyncResult *result,
						 GError **error);
ESource *	e_source_registry_ref_source	(ESourceRegistry *registry,
						 const gchar *uid);
GList *		e_source_registry_list_sources	(ESourceRegistry *registry,
						 const gchar *extension_name);
GList *		e_source_registry_list_enabled	(ESourceRegistry *registry,
						 const gchar *extension_name);
ESource *	e_source_registry_find_extension
						(ESourceRegistry *registry,
						 ESource *source,
						 const gchar *extension_name);
gboolean	e_source_registry_check_enabled	(ESourceRegistry *registry,
						 ESource *source);
GNode *		e_source_registry_build_display_tree
						(ESourceRegistry *registry,
						 const gchar *extension_name);
void		e_source_registry_free_display_tree
						(GNode *display_tree);
gchar *		e_source_registry_dup_unique_display_name
						(ESourceRegistry *registry,
						 ESource *source,
						 const gchar *extension_name);
void		e_source_registry_debug_dump	(ESourceRegistry *registry,
						 const gchar *extension_name);

/* These built-in ESource objects are always available. */

ESource *	e_source_registry_ref_builtin_address_book
						(ESourceRegistry *registry);
ESource *	e_source_registry_ref_builtin_calendar
						(ESourceRegistry *registry);
ESource *	e_source_registry_ref_builtin_mail_account
						(ESourceRegistry *registry);
ESource *	e_source_registry_ref_builtin_memo_list
						(ESourceRegistry *registry);
ESource *	e_source_registry_ref_builtin_proxy
						(ESourceRegistry *registry);
ESource *	e_source_registry_ref_builtin_task_list
						(ESourceRegistry *registry);

/* The following is a front-end for the "org.gnome.Evolution.DefaultSources"
 * GSettings schema, except that it gets and sets ESource objects instead of
 * ESource UID strings. */

ESource *	e_source_registry_ref_default_address_book
						(ESourceRegistry *registry);
void		e_source_registry_set_default_address_book
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_calendar
						(ESourceRegistry *registry);
void		e_source_registry_set_default_calendar
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_mail_account
						(ESourceRegistry *registry);
void		e_source_registry_set_default_mail_account
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_mail_identity
						(ESourceRegistry *registry);
void		e_source_registry_set_default_mail_identity
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_memo_list
						(ESourceRegistry *registry);
void		e_source_registry_set_default_memo_list
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_task_list
						(ESourceRegistry *registry);
void		e_source_registry_set_default_task_list
						(ESourceRegistry *registry,
						 ESource *default_source);
ESource *	e_source_registry_ref_default_for_extension_name
						(ESourceRegistry *registry,
						 const gchar *extension_name);
void		e_source_registry_set_default_for_extension_name
						(ESourceRegistry *registry,
						 const gchar *extension_name,
						 ESource *default_source);

G_END_DECLS

#endif /* E_SOURCE_REGISTRY_H */