1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2006-2007 Red Hat, Inc.
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 of the License, or (at your option) any later version.
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.
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/>.
18 * Author: Alexander Larsson <alexl@redhat.com>
21 #ifndef __G_SIMPLE_ASYNC_RESULT_H__
22 #define __G_SIMPLE_ASYNC_RESULT_H__
24 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
25 #error "Only <gio/gio.h> can be included directly."
28 #include <gio/giotypes.h>
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))
42 * A simple implementation of #GAsyncResult.
44 typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass
;
48 GType
g_simple_async_result_get_type (void) G_GNUC_CONST
;
50 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new
)
51 GSimpleAsyncResult
*g_simple_async_result_new (GObject
*source_object
,
52 GAsyncReadyCallback callback
,
55 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new
)
56 GSimpleAsyncResult
*g_simple_async_result_new_error (GObject
*source_object
,
57 GAsyncReadyCallback callback
,
62 ...) G_GNUC_PRINTF (6, 7);
63 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new
)
64 GSimpleAsyncResult
*g_simple_async_result_new_from_error (GObject
*source_object
,
65 GAsyncReadyCallback callback
,
68 GLIB_DEPRECATED_IN_2_46_FOR(g_task_new
)
69 GSimpleAsyncResult
*g_simple_async_result_new_take_error (GObject
*source_object
,
70 GAsyncReadyCallback callback
,
74 GLIB_DEPRECATED_IN_2_46
75 void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult
*simple
,
77 GDestroyNotify destroy_op_res
);
78 GLIB_DEPRECATED_IN_2_46
79 gpointer
g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult
*simple
);
81 GLIB_DEPRECATED_IN_2_46
82 void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult
*simple
,
84 GLIB_DEPRECATED_IN_2_46
85 gssize
g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult
*simple
);
87 GLIB_DEPRECATED_IN_2_46
88 void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult
*simple
,
90 GLIB_DEPRECATED_IN_2_46
91 gboolean
g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult
*simple
);
95 GLIB_AVAILABLE_IN_2_32
/* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
96 void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult
*simple
,
97 GCancellable
*check_cancellable
);
98 GLIB_DEPRECATED_IN_2_46
99 gpointer
g_simple_async_result_get_source_tag (GSimpleAsyncResult
*simple
);
100 GLIB_DEPRECATED_IN_2_46
101 void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult
*simple
,
102 gboolean handle_cancellation
);
103 GLIB_DEPRECATED_IN_2_46
104 void g_simple_async_result_complete (GSimpleAsyncResult
*simple
);
105 GLIB_DEPRECATED_IN_2_46
106 void g_simple_async_result_complete_in_idle (GSimpleAsyncResult
*simple
);
107 GLIB_DEPRECATED_IN_2_46
108 void g_simple_async_result_run_in_thread (GSimpleAsyncResult
*simple
,
109 GSimpleAsyncThreadFunc func
,
111 GCancellable
*cancellable
);
112 GLIB_DEPRECATED_IN_2_46
113 void g_simple_async_result_set_from_error (GSimpleAsyncResult
*simple
,
114 const GError
*error
);
115 GLIB_DEPRECATED_IN_2_46
116 void g_simple_async_result_take_error (GSimpleAsyncResult
*simple
,
118 GLIB_DEPRECATED_IN_2_46
119 gboolean
g_simple_async_result_propagate_error (GSimpleAsyncResult
*simple
,
121 GLIB_DEPRECATED_IN_2_46
122 void g_simple_async_result_set_error (GSimpleAsyncResult
*simple
,
126 ...) G_GNUC_PRINTF (4, 5);
127 GLIB_DEPRECATED_IN_2_46
128 void g_simple_async_result_set_error_va (GSimpleAsyncResult
*simple
,
134 GLIB_DEPRECATED_IN_2_46
135 gboolean
g_simple_async_result_is_valid (GAsyncResult
*result
,
137 gpointer source_tag
);
139 GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error
)
140 void g_simple_async_report_error_in_idle (GObject
*object
,
141 GAsyncReadyCallback callback
,
146 ...) G_GNUC_PRINTF(6, 7);
147 GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error
)
148 void g_simple_async_report_gerror_in_idle (GObject
*object
,
149 GAsyncReadyCallback callback
,
151 const GError
*error
);
152 GLIB_DEPRECATED_IN_2_46_FOR(g_task_report_error
)
153 void g_simple_async_report_take_gerror_in_idle (GObject
*object
,
154 GAsyncReadyCallback callback
,
162 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */