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