1 /*
2  * e-mail-config-service-backend.h
3  *
4  * This program 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 program 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 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 program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18 #ifndef E_MAIL_CONFIG_SERVICE_BACKEND_H
19 #define E_MAIL_CONFIG_SERVICE_BACKEND_H
20 
21 #include <gtk/gtk.h>
22 #include <camel/camel.h>
23 #include <libebackend/libebackend.h>
24 
25 #include <e-util/e-util.h>
26 
27 /* Standard GObject macros */
28 #define E_TYPE_MAIL_CONFIG_SERVICE_BACKEND \
29 	(e_mail_config_service_backend_get_type ())
30 #define E_MAIL_CONFIG_SERVICE_BACKEND(obj) \
31 	(G_TYPE_CHECK_INSTANCE_CAST \
32 	((obj), E_TYPE_MAIL_CONFIG_SERVICE_BACKEND, EMailConfigServiceBackend))
33 #define E_MAIL_CONFIG_SERVICE_BACKEND_CLASS(cls) \
34 	(G_TYPE_CHECK_CLASS_CAST \
35 	((cls), E_TYPE_MAIL_CONFIG_SERVICE_BACKEND, EMailConfigServiceBackendClass))
36 #define E_IS_MAIL_CONFIG_SERVICE_BACKEND(obj) \
37 	(G_TYPE_CHECK_INSTANCE_TYPE \
38 	((obj), E_TYPE_MAIL_CONFIG_SERVICE_BACKEND))
39 #define E_IS_MAIL_CONFIG_SERVICE_BACKEND_CLASS(cls) \
40 	(G_TYPE_CHECK_CLASS_TYPE \
41 	((cls), E_TYPE_MAIL_CONFIG_SERVICE_BACKEND))
42 #define E_MAIL_CONFIG_SERVICE_BACKEND_GET_CLASS(obj) \
43 	(G_TYPE_INSTANCE_GET_CLASS \
44 	((obj), E_TYPE_MAIL_CONFIG_SERVICE_BACKEND, EMailConfigServiceBackendClass))
45 
46 G_BEGIN_DECLS
47 
48 struct _EMailConfigServicePage;
49 
50 typedef struct _EMailConfigServiceBackend EMailConfigServiceBackend;
51 typedef struct _EMailConfigServiceBackendClass EMailConfigServiceBackendClass;
52 typedef struct _EMailConfigServiceBackendPrivate EMailConfigServiceBackendPrivate;
53 
54 struct _EMailConfigServiceBackend {
55 	EExtension parent;
56 	EMailConfigServiceBackendPrivate *priv;
57 };
58 
59 struct _EMailConfigServiceBackendClass {
60 	EExtensionClass parent_class;
61 
62 	const gchar *backend_name;
63 
64 	gboolean	(*get_selectable)
65 					(EMailConfigServiceBackend *backend);
66 	ESource *	(*new_collection)
67 					(EMailConfigServiceBackend *backend);
68 	void		(*insert_widgets)
69 					(EMailConfigServiceBackend *backend,
70 					 GtkBox *parent);
71 	void		(*setup_defaults)
72 					(EMailConfigServiceBackend *backend);
73 	gboolean	(*auto_configure)
74 					(EMailConfigServiceBackend *backend,
75 					 EConfigLookup *config_lookup,
76 					 gint *out_priority,
77 					 gboolean *out_is_complete);
78 	gboolean	(*check_complete)
79 					(EMailConfigServiceBackend *backend);
80 	void		(*commit_changes)
81 					(EMailConfigServiceBackend *backend);
82 };
83 
84 GType		e_mail_config_service_backend_get_type
85 					(void) G_GNUC_CONST;
86 struct _EMailConfigServicePage *
87 		e_mail_config_service_backend_get_page
88 					(EMailConfigServiceBackend *backend);
89 ESource *	e_mail_config_service_backend_get_source
90 					(EMailConfigServiceBackend *backend);
91 void		e_mail_config_service_backend_set_source
92 					(EMailConfigServiceBackend *backend,
93 					 ESource *source);
94 ESource *	e_mail_config_service_backend_get_collection
95 					(EMailConfigServiceBackend *backend);
96 void		e_mail_config_service_backend_set_collection
97 					(EMailConfigServiceBackend *backend,
98 					 ESource *collection);
99 CamelProvider *	e_mail_config_service_backend_get_provider
100 					(EMailConfigServiceBackend *backend);
101 CamelSettings *	e_mail_config_service_backend_get_settings
102 					(EMailConfigServiceBackend *backend);
103 gboolean	e_mail_config_service_backend_get_selectable
104 					(EMailConfigServiceBackend *backend);
105 void		e_mail_config_service_backend_insert_widgets
106 					(EMailConfigServiceBackend *backend,
107 					 GtkBox *parent);
108 void		e_mail_config_service_backend_setup_defaults
109 					(EMailConfigServiceBackend *backend);
110 gboolean	e_mail_config_service_backend_auto_configure
111 					(EMailConfigServiceBackend *backend,
112 					 EConfigLookup *config_lookup,
113 					 gint *out_priority,
114 					 gboolean *out_is_complete);
115 gboolean	e_mail_config_service_backend_check_complete
116 					(EMailConfigServiceBackend *backend);
117 void		e_mail_config_service_backend_commit_changes
118 					(EMailConfigServiceBackend *backend);
119 gboolean	e_mail_config_service_backend_auto_configure_for_kind
120 					(EMailConfigServiceBackend *backend,
121 					 EConfigLookup *config_lookup,
122 					 EConfigLookupResultKind kind,
123 					 const gchar *protocol,
124 					 ESource *source,
125 					 gint *out_priority,
126 					 gboolean *out_is_complete);
127 
128 G_END_DECLS
129 
130 #endif /* E_MAIL_CONFIG_SERVICE_BACKEND_H */
131 
132