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
32 G_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
41 typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
42
43
44 GIO_AVAILABLE_IN_ALL
45 GType g_simple_async_result_get_type (void) G_GNUC_CONST;
46
47 GIO_DEPRECATED_IN_2_46_FOR(g_task_new)
48 GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
49 GAsyncReadyCallback callback,
50 gpointer user_data,
51 gpointer source_tag);
52 GIO_DEPRECATED_IN_2_46_FOR(g_task_new)
53 GSimpleAsyncResult *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);
60 GIO_DEPRECATED_IN_2_46_FOR(g_task_new)
61 GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
62 GAsyncReadyCallback callback,
63 gpointer user_data,
64 const GError *error);
65 GIO_DEPRECATED_IN_2_46_FOR(g_task_new)
66 GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
67 GAsyncReadyCallback callback,
68 gpointer user_data,
69 GError *error);
70
71 GIO_DEPRECATED_IN_2_46
72 void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
73 gpointer op_res,
74 GDestroyNotify destroy_op_res);
75 GIO_DEPRECATED_IN_2_46
76 gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
77
78 GIO_DEPRECATED_IN_2_46
79 void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
80 gssize op_res);
81 GIO_DEPRECATED_IN_2_46
82 gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
83
84 GIO_DEPRECATED_IN_2_46
85 void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
86 gboolean op_res);
87 GIO_DEPRECATED_IN_2_46
88 gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
89
90
91
92 GIO_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
93 void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
94 GCancellable *check_cancellable);
95 GIO_DEPRECATED_IN_2_46
96 gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
97 GIO_DEPRECATED_IN_2_46
98 void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
99 gboolean handle_cancellation);
100 GIO_DEPRECATED_IN_2_46
101 void g_simple_async_result_complete (GSimpleAsyncResult *simple);
102 GIO_DEPRECATED_IN_2_46
103 void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
104 GIO_DEPRECATED_IN_2_46
105 void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
106 GSimpleAsyncThreadFunc func,
107 int io_priority,
108 GCancellable *cancellable);
109 GIO_DEPRECATED_IN_2_46
110 void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
111 const GError *error);
112 GIO_DEPRECATED_IN_2_46
113 void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
114 GError *error);
115 GIO_DEPRECATED_IN_2_46
116 gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
117 GError **dest);
118 GIO_DEPRECATED_IN_2_46
119 void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
120 GQuark domain,
121 gint code,
122 const char *format,
123 ...) G_GNUC_PRINTF (4, 5);
124 GIO_DEPRECATED_IN_2_46
125 void 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);
131 GIO_DEPRECATED_IN_2_46
132 gboolean g_simple_async_result_is_valid (GAsyncResult *result,
133 GObject *source,
134 gpointer source_tag);
135
136 GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error)
137 void 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);
144 GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error)
145 void g_simple_async_report_gerror_in_idle (GObject *object,
146 GAsyncReadyCallback callback,
147 gpointer user_data,
148 const GError *error);
149 GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error)
150 void g_simple_async_report_take_gerror_in_idle (GObject *object,
151 GAsyncReadyCallback callback,
152 gpointer user_data,
153 GError *error);
154
155 G_END_DECLS
156
157
158
159 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */