Tests: add session_bus_run() and use it where possible
[glib.git] / gio / gsimpleasyncresult.h
blob7134f849407957252ad16deddd2b6a1b8986829b
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, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: Alexander Larsson <alexl@redhat.com>
23 #ifndef __G_SIMPLE_ASYNC_RESULT_H__
24 #define __G_SIMPLE_ASYNC_RESULT_H__
26 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27 #error "Only <gio/gio.h> can be included directly."
28 #endif
30 #include <gio/giotypes.h>
32 G_BEGIN_DECLS
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))
41 /**
42 * GSimpleAsyncResult:
44 * A simple implementation of #GAsyncResult.
45 **/
46 typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass;
49 GLIB_AVAILABLE_IN_ALL
50 GType g_simple_async_result_get_type (void) G_GNUC_CONST;
52 GLIB_AVAILABLE_IN_ALL
53 GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object,
54 GAsyncReadyCallback callback,
55 gpointer user_data,
56 gpointer source_tag);
57 GLIB_AVAILABLE_IN_ALL
58 GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object,
59 GAsyncReadyCallback callback,
60 gpointer user_data,
61 GQuark domain,
62 gint code,
63 const char *format,
64 ...) G_GNUC_PRINTF (6, 7);
65 GLIB_AVAILABLE_IN_ALL
66 GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object,
67 GAsyncReadyCallback callback,
68 gpointer user_data,
69 const GError *error);
70 GLIB_AVAILABLE_IN_ALL
71 GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object,
72 GAsyncReadyCallback callback,
73 gpointer user_data,
74 GError *error);
76 GLIB_AVAILABLE_IN_ALL
77 void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
78 gpointer op_res,
79 GDestroyNotify destroy_op_res);
80 GLIB_AVAILABLE_IN_ALL
81 gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple);
83 GLIB_AVAILABLE_IN_ALL
84 void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
85 gssize op_res);
86 GLIB_AVAILABLE_IN_ALL
87 gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple);
89 GLIB_AVAILABLE_IN_ALL
90 void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
91 gboolean op_res);
92 GLIB_AVAILABLE_IN_ALL
93 gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple);
97 GLIB_AVAILABLE_IN_2_32
98 void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple,
99 GCancellable *check_cancellable);
100 GLIB_AVAILABLE_IN_ALL
101 gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple);
102 GLIB_AVAILABLE_IN_ALL
103 void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
104 gboolean handle_cancellation);
105 GLIB_AVAILABLE_IN_ALL
106 void g_simple_async_result_complete (GSimpleAsyncResult *simple);
107 GLIB_AVAILABLE_IN_ALL
108 void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple);
109 GLIB_AVAILABLE_IN_ALL
110 void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
111 GSimpleAsyncThreadFunc func,
112 int io_priority,
113 GCancellable *cancellable);
114 GLIB_AVAILABLE_IN_ALL
115 void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
116 const GError *error);
117 GLIB_AVAILABLE_IN_ALL
118 void g_simple_async_result_take_error (GSimpleAsyncResult *simple,
119 GError *error);
120 GLIB_AVAILABLE_IN_ALL
121 gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
122 GError **dest);
123 GLIB_AVAILABLE_IN_ALL
124 void g_simple_async_result_set_error (GSimpleAsyncResult *simple,
125 GQuark domain,
126 gint code,
127 const char *format,
128 ...) G_GNUC_PRINTF (4, 5);
129 GLIB_AVAILABLE_IN_ALL
130 void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
131 GQuark domain,
132 gint code,
133 const char *format,
134 va_list args)
135 G_GNUC_PRINTF(4, 0);
136 GLIB_AVAILABLE_IN_ALL
137 gboolean g_simple_async_result_is_valid (GAsyncResult *result,
138 GObject *source,
139 gpointer source_tag);
141 GLIB_AVAILABLE_IN_ALL
142 void g_simple_async_report_error_in_idle (GObject *object,
143 GAsyncReadyCallback callback,
144 gpointer user_data,
145 GQuark domain,
146 gint code,
147 const char *format,
148 ...) G_GNUC_PRINTF(6, 7);
149 GLIB_AVAILABLE_IN_ALL
150 void g_simple_async_report_gerror_in_idle (GObject *object,
151 GAsyncReadyCallback callback,
152 gpointer user_data,
153 const GError *error);
154 GLIB_AVAILABLE_IN_ALL
155 void g_simple_async_report_take_gerror_in_idle (GObject *object,
156 GAsyncReadyCallback callback,
157 gpointer user_data,
158 GError *error);
160 G_END_DECLS
164 #endif /* __G_SIMPLE_ASYNC_RESULT_H__ */