1/* GTK - The GIMP Toolkit
2 * Copyright (C) 2017 Benjamin Otte
3 *
4 * This library 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) any later version.
8 *
9 * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GTK_CONTENT_SERIALIZER_H__
19#define __GTK_CONTENT_SERIALIZER_H__
20
21#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gdk/gdk.h> can be included directly."
23#endif
24
25
26#include <gdk/gdkversionmacros.h>
27#include <gdk/gdktypes.h>
28
29G_BEGIN_DECLS
30
31#define GDK_TYPE_CONTENT_SERIALIZER (gdk_content_serializer_get_type ())
32#define GDK_CONTENT_SERIALIZER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_CONTENT_SERIALIZER, GdkContentSerializer))
33#define GDK_IS_CONTENT_SERIALIZER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_CONTENT_SERIALIZER))
34
35typedef struct _GdkContentSerializer GdkContentSerializer;
36
37/**
38 * GdkContentSerializeFunc:
39 * @serializer: a `GdkContentSerializer`
40 *
41 * The type of a function that can be registered with gdk_content_register_serializer().
42 *
43 * When the function gets called to operate on content, it can call functions on the
44 * @serializer object to obtain the mime type, output stream, user data, etc. for its
45 * operation.
46 */
47typedef void (* GdkContentSerializeFunc) (GdkContentSerializer *serializer);
48
49GDK_AVAILABLE_IN_ALL
50GType gdk_content_serializer_get_type (void) G_GNUC_CONST;
51
52GDK_AVAILABLE_IN_ALL
53const char * gdk_content_serializer_get_mime_type (GdkContentSerializer *serializer);
54GDK_AVAILABLE_IN_ALL
55GType gdk_content_serializer_get_gtype (GdkContentSerializer *serializer);
56GDK_AVAILABLE_IN_ALL
57const GValue * gdk_content_serializer_get_value (GdkContentSerializer *serializer);
58GDK_AVAILABLE_IN_ALL
59GOutputStream * gdk_content_serializer_get_output_stream (GdkContentSerializer *serializer);
60GDK_AVAILABLE_IN_ALL
61int gdk_content_serializer_get_priority (GdkContentSerializer *serializer);
62GDK_AVAILABLE_IN_ALL
63GCancellable * gdk_content_serializer_get_cancellable (GdkContentSerializer *serializer);
64GDK_AVAILABLE_IN_ALL
65gpointer gdk_content_serializer_get_user_data (GdkContentSerializer *serializer);
66GDK_AVAILABLE_IN_ALL
67void gdk_content_serializer_set_task_data (GdkContentSerializer *serializer,
68 gpointer data,
69 GDestroyNotify notify);
70GDK_AVAILABLE_IN_ALL
71gpointer gdk_content_serializer_get_task_data (GdkContentSerializer *serializer);
72
73GDK_AVAILABLE_IN_ALL
74void gdk_content_serializer_return_success (GdkContentSerializer *serializer);
75GDK_AVAILABLE_IN_ALL
76void gdk_content_serializer_return_error (GdkContentSerializer *serializer,
77 GError *error);
78
79GDK_AVAILABLE_IN_ALL
80GdkContentFormats * gdk_content_formats_union_serialize_gtypes (GdkContentFormats *formats);
81GDK_AVAILABLE_IN_ALL
82GdkContentFormats * gdk_content_formats_union_serialize_mime_types (GdkContentFormats *formats);
83
84GDK_AVAILABLE_IN_ALL
85void gdk_content_register_serializer (GType type,
86 const char *mime_type,
87 GdkContentSerializeFunc serialize,
88 gpointer data,
89 GDestroyNotify notify);
90GDK_AVAILABLE_IN_ALL
91void gdk_content_serialize_async (GOutputStream *stream,
92 const char *mime_type,
93 const GValue *value,
94 int io_priority,
95 GCancellable *cancellable,
96 GAsyncReadyCallback callback,
97 gpointer user_data);
98GDK_AVAILABLE_IN_ALL
99gboolean gdk_content_serialize_finish (GAsyncResult *result,
100 GError **error);
101
102
103G_END_DECLS
104
105#endif /* __GDK_CONTENT_SERIALIZER_H__ */
106

source code of gtk/gdk/gdkcontentserializer.h