changes: Bump to 3.8.1
[platform/upstream/evolution-data-server.git] / libedataserver / e-source-authenticator.h
1 /*
2  * e-source-authenticator.h
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 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_AUTHENTICATOR_H
23 #define E_SOURCE_AUTHENTICATOR_H
24
25 #include <libedataserver/e-source.h>
26 #include <libedataserver/e-source-enums.h>
27
28 /* Standard GObject macros */
29 #define E_TYPE_SOURCE_AUTHENTICATOR \
30         (e_source_authenticator_get_type ())
31 #define E_SOURCE_AUTHENTICATOR(obj) \
32         (G_TYPE_CHECK_INSTANCE_CAST \
33         ((obj), E_TYPE_SOURCE_AUTHENTICATOR, ESourceAuthenticator))
34 #define E_IS_SOURCE_AUTHENTICATOR(obj) \
35         (G_TYPE_CHECK_INSTANCE_TYPE \
36         ((obj), E_TYPE_SOURCE_AUTHENTICATOR))
37 #define E_SOURCE_AUTHENTICATOR_GET_INTERFACE(obj) \
38         (G_TYPE_INSTANCE_GET_INTERFACE \
39         ((obj), E_TYPE_SOURCE_AUTHENTICATOR, ESourceAuthenticatorInterface))
40
41 G_BEGIN_DECLS
42
43 /**
44  * ESourceAuthenticator:
45  *
46  * Since: 3.6
47  **/
48 typedef struct _ESourceAuthenticator ESourceAuthenticator;
49 typedef struct _ESourceAuthenticatorInterface ESourceAuthenticatorInterface;
50
51 /**
52  * ESourceAuthenticatorInterface:
53  *
54  * Since: 3.6
55  **/
56 struct _ESourceAuthenticatorInterface {
57         GTypeInterface parent_interface;
58
59         void            (*get_prompt_strings)   (ESourceAuthenticator *auth,
60                                                  ESource *source,
61                                                  gchar **prompt_title,
62                                                  gchar **prompt_message,
63                                                  gchar **prompt_description);
64
65         gboolean        (*get_without_password) (ESourceAuthenticator *auth);
66
67         /* Synchronous I/O Methods */
68         ESourceAuthenticationResult
69                         (*try_password_sync)    (ESourceAuthenticator *auth,
70                                                  const GString *password,
71                                                  GCancellable *cancellable,
72                                                  GError **error);
73
74         /* Asynchronous I/O Methods (all have defaults) */
75         void            (*try_password)         (ESourceAuthenticator *auth,
76                                                  const GString *password,
77                                                  GCancellable *cancellable,
78                                                  GAsyncReadyCallback callback,
79                                                  gpointer user_data);
80         ESourceAuthenticationResult
81                         (*try_password_finish)  (ESourceAuthenticator *auth,
82                                                  GAsyncResult *result,
83                                                  GError **error);
84 };
85
86 GType           e_source_authenticator_get_type (void) G_GNUC_CONST;
87 void            e_source_authenticator_get_prompt_strings
88                                                 (ESourceAuthenticator *auth,
89                                                  ESource *source,
90                                                  gchar **prompt_title,
91                                                  gchar **prompt_message,
92                                                  gchar **prompt_description);
93 gboolean        e_source_authenticator_get_without_password
94                                                 (ESourceAuthenticator *auth);
95 ESourceAuthenticationResult
96                 e_source_authenticator_try_password_sync
97                                                 (ESourceAuthenticator *auth,
98                                                  const GString *password,
99                                                  GCancellable *cancellable,
100                                                  GError **error);
101 void            e_source_authenticator_try_password
102                                                 (ESourceAuthenticator *auth,
103                                                  const GString *password,
104                                                  GCancellable *cancellable,
105                                                  GAsyncReadyCallback callback,
106                                                  gpointer user_data);
107 ESourceAuthenticationResult
108                 e_source_authenticator_try_password_finish
109                                                 (ESourceAuthenticator *auth,
110                                                  GAsyncResult *result,
111                                                  GError **error);
112
113 G_END_DECLS
114
115 #endif /* E_SOURCE_AUTHENTICATOR_H */