65b8e8bfd46636ad1fde8edf90abda4d629db583
[platform/upstream/evolution-data-server.git] / libebackend / e-backend.h
1 /*
2  * e-backend.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 #if !defined (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION)
20 #error "Only <libebackend/libebackend.h> should be included directly."
21 #endif
22
23 #ifndef E_BACKEND_H
24 #define E_BACKEND_H
25
26 #include <libedataserver/libedataserver.h>
27
28 /* Standard GObject macros */
29 #define E_TYPE_BACKEND \
30         (e_backend_get_type ())
31 #define E_BACKEND(obj) \
32         (G_TYPE_CHECK_INSTANCE_CAST \
33         ((obj), E_TYPE_BACKEND, EBackend))
34 #define E_BACKEND_CLASS(cls) \
35         (G_TYPE_CHECK_CLASS_CAST \
36         ((cls), E_TYPE_BACKEND, EBackendClass))
37 #define E_IS_BACKEND(obj) \
38         (G_TYPE_CHECK_INSTANCE_TYPE \
39         ((obj), E_TYPE_BACKEND))
40 #define E_IS_BACKEND_CLASS(cls) \
41         (G_TYPE_CHECK_CLASS_TYPE \
42         ((cls), E_TYPE_BACKEND))
43 #define E_BACKEND_GET_CLASS(obj) \
44         (G_TYPE_INSTANCE_GET_CLASS \
45         ((obj), E_TYPE_BACKEND, EBackendClass))
46
47 G_BEGIN_DECLS
48
49 /* forward declaration */
50 struct _EUserPrompter;
51
52 typedef struct _EBackend EBackend;
53 typedef struct _EBackendClass EBackendClass;
54 typedef struct _EBackendPrivate EBackendPrivate;
55
56 /**
57  * EBackend:
58  *
59  * Contains only private data that should be read and manipulated using the
60  * functions below.
61  *
62  * Since: 3.4
63  **/
64 struct _EBackend {
65         GObject parent;
66         EBackendPrivate *priv;
67 };
68
69 struct _EBackendClass {
70         GObjectClass parent_class;
71
72         /* Methods */
73         gboolean        (*authenticate_sync)    (EBackend *backend,
74                                                  ESourceAuthenticator *auth,
75                                                  GCancellable *cancellable,
76                                                  GError **error);
77         void            (*authenticate)         (EBackend *backend,
78                                                  ESourceAuthenticator *auth,
79                                                  GCancellable *cancellable,
80                                                  GAsyncReadyCallback callback,
81                                                  gpointer user_data);
82         gboolean        (*authenticate_finish)  (EBackend *backend,
83                                                  GAsyncResult *result,
84                                                  GError **error);
85
86         gpointer reserved[13];
87 };
88
89 GType           e_backend_get_type              (void) G_GNUC_CONST;
90 gboolean        e_backend_get_online            (EBackend *backend);
91 void            e_backend_set_online            (EBackend *backend,
92                                                  gboolean online);
93 ESource *       e_backend_get_source            (EBackend *backend);
94 gboolean        e_backend_authenticate_sync     (EBackend *backend,
95                                                  ESourceAuthenticator *auth,
96                                                  GCancellable *cancellable,
97                                                  GError **error);
98 void            e_backend_authenticate          (EBackend *backend,
99                                                  ESourceAuthenticator *auth,
100                                                  GCancellable *cancellable,
101                                                  GAsyncReadyCallback callback,
102                                                  gpointer user_data);
103 gboolean        e_backend_authenticate_finish   (EBackend *backend,
104                                                  GAsyncResult *result,
105                                                  GError **error);
106 struct _EUserPrompter *
107                 e_backend_get_user_prompter     (EBackend *backend);
108 ETrustPromptResponse
109                 e_backend_trust_prompt_sync     (EBackend *backend,
110                                                  const ENamedParameters *parameters,
111                                                  GCancellable *cancellable,
112                                                  GError **error);
113 void            e_backend_trust_prompt          (EBackend *backend,
114                                                  const ENamedParameters *parameters,
115                                                  GCancellable *cancellable,
116                                                  GAsyncReadyCallback callback,
117                                                  gpointer user_data);
118 ETrustPromptResponse
119                 e_backend_trust_prompt_finish   (EBackend *backend,
120                                                  GAsyncResult *result,
121                                                  GError **error);
122
123 G_END_DECLS
124
125 #endif /* E_BACKEND_H */