1 /*
2  * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
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 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
18 #error "Only <e-util/e-util.h> should be included directly."
19 #endif
20 
21 #ifndef E_CONTENT_REQUEST_H
22 #define E_CONTENT_REQUEST_H
23 
24 #include <glib.h>
25 #include <glib-object.h>
26 #include <gio/gio.h>
27 
28 /* Standard GObject macros */
29 #define E_TYPE_CONTENT_REQUEST \
30 	(e_content_request_get_type ())
31 #define E_CONTENT_REQUEST(obj) \
32 	(G_TYPE_CHECK_INSTANCE_CAST \
33 	((obj), E_TYPE_CONTENT_REQUEST, EContentRequest))
34 #define E_CONTENT_REQUEST_INTERFACE(cls) \
35 	(G_TYPE_CHECK_CLASS_CAST \
36 	((cls), E_TYPE_CONTENT_REQUEST, EContentRequestInterface))
37 #define E_IS_CONTENT_REQUEST(obj) \
38 	(G_TYPE_CHECK_INSTANCE_TYPE \
39 	((obj), E_TYPE_CONTENT_REQUEST))
40 #define E_IS_CONTENT_REQUEST_INTERFACE(cls) \
41 	(G_TYPE_CHECK_CLASS_TYPE \
42 	((cls), E_TYPE_CONTENT_REQUEST))
43 #define E_CONTENT_REQUEST_GET_INTERFACE(obj) \
44 	(G_TYPE_INSTANCE_GET_INTERFACE \
45 	((obj), E_TYPE_CONTENT_REQUEST, EContentRequestInterface))
46 
47 G_BEGIN_DECLS
48 
49 typedef struct _EContentRequest EContentRequest;
50 typedef struct _EContentRequestInterface EContentRequestInterface;
51 
52 struct _EContentRequestInterface {
53 	GTypeInterface parent_interface;
54 
55 	gboolean	(* can_process_uri)	(EContentRequest *request,
56 						 const gchar *uri);
57 	gboolean	(* process_sync)	(EContentRequest *request,
58 						 const gchar *uri,
59 						 GObject *requester,
60 						 GInputStream **out_stream,
61 						 gint64 *out_stream_length,
62 						 gchar **out_mime_type,
63 						 GCancellable *cancellable,
64 						 GError **error);
65 };
66 
67 GType		e_content_request_get_type		(void);
68 gboolean	e_content_request_can_process_uri	(EContentRequest *request,
69 							 const gchar *uri);
70 gboolean	e_content_request_process_sync		(EContentRequest *request,
71 							 const gchar *uri,
72 							 GObject *requester,
73 							 GInputStream **out_stream,
74 							 gint64 *out_stream_length,
75 							 gchar **out_mime_type,
76 							 GCancellable *cancellable,
77 							 GError **error);
78 void		e_content_request_process		(EContentRequest *request,
79 							 const gchar *uri,
80 							 GObject *requester,
81 							 GCancellable *cancellable,
82 							 GAsyncReadyCallback callback,
83 							 gpointer user_data);
84 gboolean	e_content_request_process_finish	(EContentRequest *request,
85 							 GAsyncResult *result,
86 							 GInputStream **out_stream,
87 							 gint64 *out_stream_length,
88 							 gchar **out_mime_type,
89 							 GError **error);
90 
91 G_END_DECLS
92 
93 #endif /* E_CONTENT_REQUEST_H */
94