1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __G_SIMPLE_ASYNC_RESULT_H__
22#define __G_SIMPLE_ASYNC_RESULT_H__
23
24#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25#error "Only <gio/gio.h> can be included directly."
26#endif
27
28#include <gio/giotypes.h>
29
30G_BEGIN_DECLS
31
32#define G_TYPE_SIMPLE_ASYNC_RESULT (g_simple_async_result_get_type ())
33#define G_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult))
34#define G_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
35#define G_IS_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT))
36#define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT))
37#define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass))
38
39/**
40 * GSimpleAsyncResult:
41 *
42 * A simple implementation of #GAsyncResult.
43 **/
44typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
45
46
47GLIB_AVAILABLE_IN_ALL
48GType g_simple_async_result_get_type (void) G_GNUC_CONST;
49
50GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
51GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
52 GAsyncReadyCallback callback,
53 gpointer user_data,
54 gpointer source_tag);
55GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
56GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
57 GAsyncReadyCallback callback,
58 gpointer user_data,
59 GQuark domain,
60 gint code,
61 const char *format,
62 ...) G_GNUC_PRINTF (6, 7);
63GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
64GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
65 GAsyncReadyCallback callback,
66 gpointer user_data,
67 const GError *error);
68GLIB_DEPRECATED_IN_2_46_FOR(g_task_new)
69GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
70 GAsyncReadyCallback callback,
71 gpointer user_data,
72 GError *error);
73
74GLIB_DEPRECATED_IN_2_46
75void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
76 gpointer op_res,
77 GDestroyNotify destroy_op_res);
78GLIB_DEPRECATED_IN_2_46
79gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
80
81GLIB_DEPRECATED_IN_2_46
82void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
83 gssize op_res);
84GLIB_DEPRECATED_IN_2_46
85gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
86
87GLIB_DEPRECATED_IN_2_46
88void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
89 gboolean op_res);
90GLIB_DEPRECATED_IN_2_46
91gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
92
93
94
95GLIB_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
96void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
97 GCancellable *check_cancellable);
98GLIB_DEPRECATED_IN_2_46
99gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
100GLIB_DEPRECATED_IN_2_46
101void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
102 gboolean handle_cancellation);
103GLIB_DEPRECATED_IN_2_46
104void g_simple_async_result_complete (GSimpleAsyncResult *simple);
105GLIB_DEPRECATED_IN_2_46
106void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
107GLIB_DEPRECATED_IN_2_46
108void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
109 GSimpleAsyncThreadFunc func,
110 int io_priority,
111 GCancellable *cancellable);
112GLIB_DEPRECATED_IN_2_46
113void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
114 const GError *error);
115GLIB_DEPRECATED_IN_2_46
116void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
117 GError *error);
118GLIB_DEPRECATED_IN_2_46
119gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
120 GError **dest);
121GLIB_DEPRECATED_IN_2_46
122void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
123 GQuark domain,
124 gint code,
125 const char *format,
126 ...) G_GNUC_PRINTF (4, 5);
127GLIB_DEPRECATED_IN_2_46
128void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
129 GQuark domain,
130 gint code,
131 const char *format,
132 va_list args)
133 G_GNUC_PRINTF(4, 0);
134GLIB_DEPRECATED_IN_2_46
135gboolean g_simple_async_result_is_valid (GAsyncResult *result,
136 GObject *source,
137 gpointer source_tag);
138
139GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
140void g_simple_async_report_error_in_idle (GObject *object,
141 GAsyncReadyCallback callback,
142 gpointer user_data,
143 GQuark domain,
144 gint code,
145 const char *format,
146 ...) G_GNUC_PRINTF(6, 7);
147GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
148void g_simple_async_report_gerror_in_idle (GObject *object,
149 GAsyncReadyCallback callback,
150 gpointer user_data,
151 const GError *error);
152GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error)
153void g_simple_async_report_take_gerror_in_idle (GObject *object,
154 GAsyncReadyCallback callback,
155 gpointer user_data,
156 GError *error);
157
158G_END_DECLS
159
160
161
162#endif /* __G_SIMPLE_ASYNC_RESULT_H__ */
163