1 /*
2  * Copyright (C) 2015 Red Hat, Inc. (www.redhat.com)
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_CREDENTIALS_PROVIDER_IMPL_H
23 #define E_SOURCE_CREDENTIALS_PROVIDER_IMPL_H
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 
28 #include <libedataserver/e-extension.h>
29 #include <libedataserver/e-source.h>
30 
31 /* Standard GObject macros */
32 #define E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL \
33 	(e_source_credentials_provider_impl_get_type ())
34 #define E_SOURCE_CREDENTIALS_PROVIDER_IMPL(obj) \
35 	(G_TYPE_CHECK_INSTANCE_CAST \
36 	((obj), E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL, ESourceCredentialsProviderImpl))
37 #define E_SOURCE_CREDENTIALS_PROVIDER_IMPL_CLASS(cls) \
38 	(G_TYPE_CHECK_CLASS_CAST \
39 	((cls), E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL, ESourceCredentialsProviderImplClass))
40 #define E_IS_SOURCE_CREDENTIALS_PROVIDER_IMPL(obj) \
41 	(G_TYPE_CHECK_INSTANCE_TYPE \
42 	((obj), E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL))
43 #define E_IS_SOURCE_CREDENTIALS_PROVIDER_IMPL_CLASS(cls) \
44 	(G_TYPE_CHECK_CLASS_TYPE \
45 	((cls), E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL))
46 #define E_SOURCE_CREDENTIALS_PROVIDER_IMPL_GET_CLASS(obj) \
47 	(G_TYPE_INSTANCE_GET_CLASS \
48 	((obj), E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL, ESourceCredentialsProviderImplClass))
49 
50 G_BEGIN_DECLS
51 
52 typedef struct _ESourceCredentialsProviderImpl ESourceCredentialsProviderImpl;
53 typedef struct _ESourceCredentialsProviderImplClass ESourceCredentialsProviderImplClass;
54 typedef struct _ESourceCredentialsProviderImplPrivate ESourceCredentialsProviderImplPrivate;
55 
56 struct _ESourceCredentialsProvider;
57 
58 /**
59  * ESourceCredentialsProviderImpl:
60  *
61  * Credentials provider implementation base structure. The descendants
62  * implement the virtual methods. The descendants are automatically
63  * registered into an #ESourceCredentialsProvider.
64  *
65  * Since: 3.16
66  **/
67 struct _ESourceCredentialsProviderImpl {
68 	/*< private >*/
69 	EExtension parent;
70 	ESourceCredentialsProviderImplPrivate *priv;
71 };
72 
73 struct _ESourceCredentialsProviderImplClass {
74 	EExtensionClass parent_class;
75 
76 	gboolean	(*can_process)		(ESourceCredentialsProviderImpl *provider_impl,
77 						 ESource *source);
78 	gboolean	(*can_store)		(ESourceCredentialsProviderImpl *provider_impl);
79 	gboolean	(*can_prompt)		(ESourceCredentialsProviderImpl *provider_impl);
80 	gboolean	(*lookup_sync)		(ESourceCredentialsProviderImpl *provider_impl,
81 						 ESource *source,
82 						 GCancellable *cancellable,
83 						 ENamedParameters **out_credentials,
84 						 GError **error);
85 	gboolean	(*store_sync)		(ESourceCredentialsProviderImpl *provider_impl,
86 						 ESource *source,
87 						 const ENamedParameters *credentials,
88 						 gboolean permanently,
89 						 GCancellable *cancellable,
90 						 GError **error);
91 	gboolean	(*delete_sync)		(ESourceCredentialsProviderImpl *provider_impl,
92 						 ESource *source,
93 						 GCancellable *cancellable,
94 						 GError **error);
95 };
96 
97 GType		e_source_credentials_provider_impl_get_type	(void);
98 struct _ESourceCredentialsProvider *
99 		e_source_credentials_provider_impl_get_provider
100 							(ESourceCredentialsProviderImpl *provider_impl);
101 gboolean	e_source_credentials_provider_impl_can_process
102 							(ESourceCredentialsProviderImpl *provider_impl,
103 							 ESource *source);
104 gboolean	e_source_credentials_provider_impl_can_store
105 							(ESourceCredentialsProviderImpl *provider_impl);
106 gboolean	e_source_credentials_provider_impl_can_prompt
107 							(ESourceCredentialsProviderImpl *provider_impl);
108 gboolean	e_source_credentials_provider_impl_lookup_sync
109 							(ESourceCredentialsProviderImpl *provider_impl,
110 							 ESource *source,
111 							 GCancellable *cancellable,
112 							 ENamedParameters **out_credentials,
113 							 GError **error);
114 gboolean	e_source_credentials_provider_impl_store_sync
115 							(ESourceCredentialsProviderImpl *provider_impl,
116 							 ESource *source,
117 							 const ENamedParameters *credentials,
118 							 gboolean permanently,
119 							 GCancellable *cancellable,
120 							 GError **error);
121 gboolean	e_source_credentials_provider_impl_delete_sync
122 							(ESourceCredentialsProviderImpl *provider_impl,
123 							 ESource *source,
124 							 GCancellable *cancellable,
125 							 GError **error);
126 
127 G_END_DECLS
128 
129 #endif /* E_SOURCE_CREDENTIALS_PROVIDER_IMPL_H */
130