updated changelog
[platform/upstream/evolution-data-server.git] / libebackend / e-backend.h
1 /*
2  * e-backend.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 (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION)
19 #error "Only <libebackend/libebackend.h> should be included directly."
20 #endif
21
22 #ifndef E_BACKEND_H
23 #define E_BACKEND_H
24
25 #include <libedataserver/libedataserver.h>
26
27 /* Standard GObject macros */
28 #define E_TYPE_BACKEND \
29         (e_backend_get_type ())
30 #define E_BACKEND(obj) \
31         (G_TYPE_CHECK_INSTANCE_CAST \
32         ((obj), E_TYPE_BACKEND, EBackend))
33 #define E_BACKEND_CLASS(cls) \
34         (G_TYPE_CHECK_CLASS_CAST \
35         ((cls), E_TYPE_BACKEND, EBackendClass))
36 #define E_IS_BACKEND(obj) \
37         (G_TYPE_CHECK_INSTANCE_TYPE \
38         ((obj), E_TYPE_BACKEND))
39 #define E_IS_BACKEND_CLASS(cls) \
40         (G_TYPE_CHECK_CLASS_TYPE \
41         ((cls), E_TYPE_BACKEND))
42 #define E_BACKEND_GET_CLASS(obj) \
43         (G_TYPE_INSTANCE_GET_CLASS \
44         ((obj), E_TYPE_BACKEND, EBackendClass))
45
46 G_BEGIN_DECLS
47
48 /* forward declaration */
49 struct _EUserPrompter;
50
51 typedef struct _EBackend EBackend;
52 typedef struct _EBackendClass EBackendClass;
53 typedef struct _EBackendPrivate EBackendPrivate;
54
55 /**
56  * EBackend:
57  *
58  * Contains only private data that should be read and manipulated using the
59  * functions below.
60  *
61  * Since: 3.4
62  **/
63 struct _EBackend {
64         /*< private >*/
65         GObject parent;
66         EBackendPrivate *priv;
67 };
68
69 /**
70  * EBackendClass:
71  * @authenticate_sync: Authenticate synchronously
72  * @authenticate: Initiate authentication
73  * @authenticate_finish: Complete authentication
74  * @get_destination_address: Fetch the destination address
75  *
76  * Base class structure for the #EBackend class
77  *
78  * Since: 3.4
79  **/
80 struct _EBackendClass {
81         /*< private >*/
82         GObjectClass parent_class;
83
84         /*< public >*/
85         /* Methods */
86         gboolean        (*authenticate_sync)    (EBackend *backend,
87                                                  ESourceAuthenticator *auth,
88                                                  GCancellable *cancellable,
89                                                  GError **error);
90         void            (*authenticate)         (EBackend *backend,
91                                                  ESourceAuthenticator *auth,
92                                                  GCancellable *cancellable,
93                                                  GAsyncReadyCallback callback,
94                                                  gpointer user_data);
95         gboolean        (*authenticate_finish)  (EBackend *backend,
96                                                  GAsyncResult *result,
97                                                  GError **error);
98
99         gboolean        (*get_destination_address)
100                                                 (EBackend *backend,
101                                                  gchar **host,
102                                                  guint16 *port);
103
104         /*< private >*/
105         gpointer reserved[12];
106 };
107
108 GType           e_backend_get_type              (void) G_GNUC_CONST;
109 gboolean        e_backend_get_online            (EBackend *backend);
110 void            e_backend_set_online            (EBackend *backend,
111                                                  gboolean online);
112 ESource *       e_backend_get_source            (EBackend *backend);
113 GSocketConnectable *
114                 e_backend_ref_connectable       (EBackend *backend);
115 void            e_backend_set_connectable       (EBackend *backend,
116                                                  GSocketConnectable *connectable);
117 GMainContext *  e_backend_ref_main_context      (EBackend *backend);
118 gboolean        e_backend_authenticate_sync     (EBackend *backend,
119                                                  ESourceAuthenticator *auth,
120                                                  GCancellable *cancellable,
121                                                  GError **error);
122 void            e_backend_authenticate          (EBackend *backend,
123                                                  ESourceAuthenticator *auth,
124                                                  GCancellable *cancellable,
125                                                  GAsyncReadyCallback callback,
126                                                  gpointer user_data);
127 gboolean        e_backend_authenticate_finish   (EBackend *backend,
128                                                  GAsyncResult *result,
129                                                  GError **error);
130 struct _EUserPrompter *
131                 e_backend_get_user_prompter     (EBackend *backend);
132 ETrustPromptResponse
133                 e_backend_trust_prompt_sync     (EBackend *backend,
134                                                  const ENamedParameters *parameters,
135                                                  GCancellable *cancellable,
136                                                  GError **error);
137 void            e_backend_trust_prompt          (EBackend *backend,
138                                                  const ENamedParameters *parameters,
139                                                  GCancellable *cancellable,
140                                                  GAsyncReadyCallback callback,
141                                                  gpointer user_data);
142 ETrustPromptResponse
143                 e_backend_trust_prompt_finish   (EBackend *backend,
144                                                  GAsyncResult *result,
145                                                  GError **error);
146
147 gboolean        e_backend_get_destination_address
148                                                 (EBackend *backend,
149                                                  gchar **host,
150                                                  guint16 *port);
151 gboolean        e_backend_is_destination_reachable
152                                                 (EBackend *backend,
153                                                  GCancellable *cancellable,
154                                                  GError **error);
155
156 G_END_DECLS
157
158 #endif /* E_BACKEND_H */