1 /*
2  * e-server-side-source.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 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 (__LIBEBACKEND_H_INSIDE__) && !defined (LIBEBACKEND_COMPILATION)
19 #error "Only <libebackend/libebackend.h> should be included directly."
20 #endif
21 
22 #ifndef E_SERVER_SIDE_SOURCE_H
23 #define E_SERVER_SIDE_SOURCE_H
24 
25 #include <libebackend/e-oauth2-support.h>
26 #include <libebackend/e-source-registry-server.h>
27 
28 /* Standard GObject macros */
29 #define E_TYPE_SERVER_SIDE_SOURCE \
30 	(e_server_side_source_get_type ())
31 #define E_SERVER_SIDE_SOURCE(obj) \
32 	(G_TYPE_CHECK_INSTANCE_CAST \
33 	((obj), E_TYPE_SERVER_SIDE_SOURCE, EServerSideSource))
34 #define E_SERVER_SIDE_SOURCE_CLASS(cls) \
35 	(G_TYPE_CHECK_CLASS_CAST \
36 	((cls), E_TYPE_SERVER_SIDE_SOURCE, EServerSideSourceClass))
37 #define E_IS_SERVER_SIDE_SOURCE(obj) \
38 	(G_TYPE_CHECK_INSTANCE_TYPE \
39 	((obj), E_TYPE_SERVER_SIDE_SOURCE))
40 #define E_IS_SERVER_SIDE_SOURCE_CLASS(cls) \
41 	(G_TYPE_CHECK_CLASS_TYPE \
42 	((cls), E_TYPE_SERVER_SIDE_SOURCE))
43 #define E_SERVER_SIDE_SOURCE_GET_CLASS(obj) \
44 	(G_TYPE_INSTANCE_GET_CLASS \
45 	((obj), E_TYPE_SERVER_SIDE_SOURCE, EServerSideSourceClass))
46 
47 G_BEGIN_DECLS
48 
49 typedef struct _EServerSideSource EServerSideSource;
50 typedef struct _EServerSideSourceClass EServerSideSourceClass;
51 typedef struct _EServerSideSourcePrivate EServerSideSourcePrivate;
52 
53 /**
54  * EServerSideSource:
55  *
56  * Contains only private data that should be read and manipulated using the
57  * functions below.
58  *
59  * Since: 3.6
60  **/
61 struct _EServerSideSource {
62 	/*< private >*/
63 	ESource parent;
64 	EServerSideSourcePrivate *priv;
65 };
66 
67 struct _EServerSideSourceClass {
68 	ESourceClass parent_class;
69 };
70 
71 GType		e_server_side_source_get_type	(void) G_GNUC_CONST;
72 const gchar *	e_server_side_source_get_user_dir
73 						(void) G_GNUC_CONST;
74 GFile *		e_server_side_source_new_user_file
75 						(const gchar *uid);
76 gchar *		e_server_side_source_uid_from_file
77 						(GFile *file,
78 						 GError **error);
79 ESource *	e_server_side_source_new	(ESourceRegistryServer *server,
80 						 GFile *file,
81 						 GError **error);
82 ESource *	e_server_side_source_new_memory_only
83 						(ESourceRegistryServer *server,
84 						 const gchar *uid,
85 						 GError **error);
86 gboolean	e_server_side_source_load	(EServerSideSource *source,
87 						 GCancellable *cancellable,
88 						 GError **error);
89 GFile *		e_server_side_source_get_file	(EServerSideSource *source);
90 GNode *		e_server_side_source_get_node	(EServerSideSource *source);
91 ESourceRegistryServer *
92 		e_server_side_source_get_server	(EServerSideSource *source);
93 gboolean	e_server_side_source_get_exported
94 						(EServerSideSource *source);
95 const gchar *	e_server_side_source_get_write_directory
96 						(EServerSideSource *source);
97 void		e_server_side_source_set_write_directory
98 						(EServerSideSource *source,
99 						 const gchar *write_directory);
100 void		e_server_side_source_set_removable
101 						(EServerSideSource *source,
102 						 gboolean removable);
103 void		e_server_side_source_set_writable
104 						(EServerSideSource *source,
105 						 gboolean writable);
106 void		e_server_side_source_set_remote_creatable
107 						(EServerSideSource *source,
108 						 gboolean remote_creatable);
109 void		e_server_side_source_set_remote_deletable
110 						(EServerSideSource *source,
111 						 gboolean remote_deletable);
112 EOAuth2Support *
113 		e_server_side_source_ref_oauth2_support
114 						(EServerSideSource *source);
115 void		e_server_side_source_set_oauth2_support
116 						(EServerSideSource *source,
117 						 EOAuth2Support *oauth2_support);
118 
119 G_END_DECLS
120 
121 #endif /* E_SERVER_SIDE_SOURCE_H */
122 
123