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