Imported Upstream version 2.50.2
[platform/upstream/glib.git] / docs / reference / gio / html / GSimpleAsyncResult.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GSimpleAsyncResult: GIO Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="async.html" title="Asynchronous I/O">
9 <link rel="prev" href="gio-GIOScheduler.html" title="GIOScheduler">
10 <link rel="next" href="conversion.html" title="Data conversion">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#GSimpleAsyncResult.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
19                   <a href="#GSimpleAsyncResult.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
20                   <a href="#GSimpleAsyncResult.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span>
21 </td>
22 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
23 <td><a accesskey="u" href="async.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
24 <td><a accesskey="p" href="gio-GIOScheduler.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
25 <td><a accesskey="n" href="conversion.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
26 </tr></table>
27 <div class="refentry">
28 <a name="GSimpleAsyncResult"></a><div class="titlepage"></div>
29 <div class="refnamediv"><table width="100%"><tr>
30 <td valign="top">
31 <h2><span class="refentrytitle"><a name="GSimpleAsyncResult.top_of_page"></a>GSimpleAsyncResult</span></h2>
32 <p>GSimpleAsyncResult — Simple asynchronous results implementation</p>
33 </td>
34 <td class="gallery_image" valign="top" align="right"></td>
35 </tr></table></div>
36 <div class="refsect1">
37 <a name="GSimpleAsyncResult.functions"></a><h2>Functions</h2>
38 <div class="informaltable"><table class="informaltable" width="100%" border="0">
39 <colgroup>
40 <col width="150px" class="functions_return">
41 <col class="functions_name">
42 </colgroup>
43 <tbody>
44 <tr>
45 <td class="function_type">
46 <span class="returnvalue">void</span>
47 </td>
48 <td class="function_name">
49 <span class="c_punctuation">(</span><a class="link" href="GSimpleAsyncResult.html#GSimpleAsyncThreadFunc" title="GSimpleAsyncThreadFunc ()">*GSimpleAsyncThreadFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
50 </td>
51 </tr>
52 <tr>
53 <td class="function_type">
54 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
55 </td>
56 <td class="function_name">
57 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new" title="g_simple_async_result_new ()">g_simple_async_result_new</a> <span class="c_punctuation">()</span>
58 </td>
59 </tr>
60 <tr>
61 <td class="function_type">
62 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
63 </td>
64 <td class="function_name">
65 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-error" title="g_simple_async_result_new_error ()">g_simple_async_result_new_error</a> <span class="c_punctuation">()</span>
66 </td>
67 </tr>
68 <tr>
69 <td class="function_type">
70 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
71 </td>
72 <td class="function_name">
73 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-from-error" title="g_simple_async_result_new_from_error ()">g_simple_async_result_new_from_error</a> <span class="c_punctuation">()</span>
74 </td>
75 </tr>
76 <tr>
77 <td class="function_type">
78 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
79 </td>
80 <td class="function_name">
81 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-take-error" title="g_simple_async_result_new_take_error ()">g_simple_async_result_new_take_error</a> <span class="c_punctuation">()</span>
82 </td>
83 </tr>
84 <tr>
85 <td class="function_type">
86 <span class="returnvalue">void</span>
87 </td>
88 <td class="function_name">
89 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-check-cancellable" title="g_simple_async_result_set_check_cancellable ()">g_simple_async_result_set_check_cancellable</a> <span class="c_punctuation">()</span>
90 </td>
91 </tr>
92 <tr>
93 <td class="function_type">
94 <span class="returnvalue">void</span>
95 </td>
96 <td class="function_name">
97 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gpointer" title="g_simple_async_result_set_op_res_gpointer ()">g_simple_async_result_set_op_res_gpointer</a> <span class="c_punctuation">()</span>
98 </td>
99 </tr>
100 <tr>
101 <td class="function_type">
102 <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
103 </td>
104 <td class="function_name">
105 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gpointer" title="g_simple_async_result_get_op_res_gpointer ()">g_simple_async_result_get_op_res_gpointer</a> <span class="c_punctuation">()</span>
106 </td>
107 </tr>
108 <tr>
109 <td class="function_type">
110 <span class="returnvalue">void</span>
111 </td>
112 <td class="function_name">
113 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gssize" title="g_simple_async_result_set_op_res_gssize ()">g_simple_async_result_set_op_res_gssize</a> <span class="c_punctuation">()</span>
114 </td>
115 </tr>
116 <tr>
117 <td class="function_type">
118 <a href="../glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>
119 </td>
120 <td class="function_name">
121 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gssize" title="g_simple_async_result_get_op_res_gssize ()">g_simple_async_result_get_op_res_gssize</a> <span class="c_punctuation">()</span>
122 </td>
123 </tr>
124 <tr>
125 <td class="function_type">
126 <span class="returnvalue">void</span>
127 </td>
128 <td class="function_name">
129 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gboolean" title="g_simple_async_result_set_op_res_gboolean ()">g_simple_async_result_set_op_res_gboolean</a> <span class="c_punctuation">()</span>
130 </td>
131 </tr>
132 <tr>
133 <td class="function_type">
134 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
135 </td>
136 <td class="function_name">
137 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gboolean" title="g_simple_async_result_get_op_res_gboolean ()">g_simple_async_result_get_op_res_gboolean</a> <span class="c_punctuation">()</span>
138 </td>
139 </tr>
140 <tr>
141 <td class="function_type">
142 <a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
143 </td>
144 <td class="function_name">
145 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-source-tag" title="g_simple_async_result_get_source_tag ()">g_simple_async_result_get_source_tag</a> <span class="c_punctuation">()</span>
146 </td>
147 </tr>
148 <tr>
149 <td class="function_type">
150 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
151 </td>
152 <td class="function_name">
153 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-is-valid" title="g_simple_async_result_is_valid ()">g_simple_async_result_is_valid</a> <span class="c_punctuation">()</span>
154 </td>
155 </tr>
156 <tr>
157 <td class="function_type">
158 <span class="returnvalue">void</span>
159 </td>
160 <td class="function_name">
161 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-handle-cancellation" title="g_simple_async_result_set_handle_cancellation ()">g_simple_async_result_set_handle_cancellation</a> <span class="c_punctuation">()</span>
162 </td>
163 </tr>
164 <tr>
165 <td class="function_type">
166 <span class="returnvalue">void</span>
167 </td>
168 <td class="function_name">
169 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete" title="g_simple_async_result_complete ()">g_simple_async_result_complete</a> <span class="c_punctuation">()</span>
170 </td>
171 </tr>
172 <tr>
173 <td class="function_type">
174 <span class="returnvalue">void</span>
175 </td>
176 <td class="function_name">
177 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle" title="g_simple_async_result_complete_in_idle ()">g_simple_async_result_complete_in_idle</a> <span class="c_punctuation">()</span>
178 </td>
179 </tr>
180 <tr>
181 <td class="function_type">
182 <span class="returnvalue">void</span>
183 </td>
184 <td class="function_name">
185 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-run-in-thread" title="g_simple_async_result_run_in_thread ()">g_simple_async_result_run_in_thread</a> <span class="c_punctuation">()</span>
186 </td>
187 </tr>
188 <tr>
189 <td class="function_type">
190 <span class="returnvalue">void</span>
191 </td>
192 <td class="function_name">
193 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-from-error" title="g_simple_async_result_set_from_error ()">g_simple_async_result_set_from_error</a> <span class="c_punctuation">()</span>
194 </td>
195 </tr>
196 <tr>
197 <td class="function_type">
198 <span class="returnvalue">void</span>
199 </td>
200 <td class="function_name">
201 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-take-error" title="g_simple_async_result_take_error ()">g_simple_async_result_take_error</a> <span class="c_punctuation">()</span>
202 </td>
203 </tr>
204 <tr>
205 <td class="function_type">
206 <a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
207 </td>
208 <td class="function_name">
209 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error" title="g_simple_async_result_propagate_error ()">g_simple_async_result_propagate_error</a> <span class="c_punctuation">()</span>
210 </td>
211 </tr>
212 <tr>
213 <td class="function_type">
214 <span class="returnvalue">void</span>
215 </td>
216 <td class="function_name">
217 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-error" title="g_simple_async_result_set_error ()">g_simple_async_result_set_error</a> <span class="c_punctuation">()</span>
218 </td>
219 </tr>
220 <tr>
221 <td class="function_type">
222 <span class="returnvalue">void</span>
223 </td>
224 <td class="function_name">
225 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-error-va" title="g_simple_async_result_set_error_va ()">g_simple_async_result_set_error_va</a> <span class="c_punctuation">()</span>
226 </td>
227 </tr>
228 <tr>
229 <td class="function_type">
230 <span class="returnvalue">void</span>
231 </td>
232 <td class="function_name">
233 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-report-error-in-idle" title="g_simple_async_report_error_in_idle ()">g_simple_async_report_error_in_idle</a> <span class="c_punctuation">()</span>
234 </td>
235 </tr>
236 <tr>
237 <td class="function_type">
238 <span class="returnvalue">void</span>
239 </td>
240 <td class="function_name">
241 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-report-gerror-in-idle" title="g_simple_async_report_gerror_in_idle ()">g_simple_async_report_gerror_in_idle</a> <span class="c_punctuation">()</span>
242 </td>
243 </tr>
244 <tr>
245 <td class="function_type">
246 <span class="returnvalue">void</span>
247 </td>
248 <td class="function_name">
249 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-report-take-gerror-in-idle" title="g_simple_async_report_take_gerror_in_idle ()">g_simple_async_report_take_gerror_in_idle</a> <span class="c_punctuation">()</span>
250 </td>
251 </tr>
252 </tbody>
253 </table></div>
254 </div>
255 <div class="refsect1">
256 <a name="GSimpleAsyncResult.other"></a><h2>Types and Values</h2>
257 <div class="informaltable"><table class="informaltable" width="100%" border="0">
258 <colgroup>
259 <col width="150px" class="name">
260 <col class="description">
261 </colgroup>
262 <tbody><tr>
263 <td class="datatype_keyword"> </td>
264 <td class="function_name"><a class="link" href="GSimpleAsyncResult.html#GSimpleAsyncResult-struct" title="GSimpleAsyncResult">GSimpleAsyncResult</a></td>
265 </tr></tbody>
266 </table></div>
267 </div>
268 <div class="refsect1">
269 <a name="GSimpleAsyncResult.object-hierarchy"></a><h2>Object Hierarchy</h2>
270 <pre class="screen">    <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
271     <span class="lineart">╰──</span> GSimpleAsyncResult
272 </pre>
273 </div>
274 <div class="refsect1">
275 <a name="GSimpleAsyncResult.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
276 <p>
277 GSimpleAsyncResult implements
278  <a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a>.</p>
279 </div>
280 <div class="refsect1">
281 <a name="GSimpleAsyncResult.includes"></a><h2>Includes</h2>
282 <pre class="synopsis">#include &lt;gio/gio.h&gt;
283 </pre>
284 </div>
285 <div class="refsect1">
286 <a name="GSimpleAsyncResult.description"></a><h2>Description</h2>
287 <p>As of GLib 2.46, <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> is deprecated in favor of
288 <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a>, which provides a simpler API.</p>
289 <p><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> implements <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p>
290 <p>GSimpleAsyncResult handles <a href="GAsyncResult.html#GAsyncReadyCallback"><span class="type">GAsyncReadyCallbacks</span></a>, error
291 reporting, operation cancellation and the final state of an operation,
292 completely transparent to the application. Results can be returned
293 as a pointer e.g. for functions that return data that is collected
294 asynchronously, a boolean value for checking the success or failure
295 of an operation, or a <a href="../glib-Basic-Types.html#gssize"><span class="type">gssize</span></a> for operations which return the number
296 of bytes modified by the operation; all of the simple return cases
297 are covered.</p>
298 <p>Most of the time, an application will not need to know of the details
299 of this API; it is handled transparently, and any necessary operations
300 are handled by <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>'s interface. However, if implementing a
301 new GIO module, for writing language bindings, or for complex
302 applications that need better control of how asynchronous operations
303 are completed, it is important to understand this functionality.</p>
304 <p>GSimpleAsyncResults are tagged with the calling function to ensure
305 that asynchronous functions and their finishing functions are used
306 together correctly.</p>
307 <p>To create a new <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>, call <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new" title="g_simple_async_result_new ()"><code class="function">g_simple_async_result_new()</code></a>.
308 If the result needs to be created for a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, use
309 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-from-error" title="g_simple_async_result_new_from_error ()"><code class="function">g_simple_async_result_new_from_error()</code></a> or
310 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-take-error" title="g_simple_async_result_new_take_error ()"><code class="function">g_simple_async_result_new_take_error()</code></a>. If a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> is not available
311 (e.g. the asynchronous operation's doesn't take a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> argument),
312 but the result still needs to be created for an error condition, use
313 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new-error" title="g_simple_async_result_new_error ()"><code class="function">g_simple_async_result_new_error()</code></a> (or <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-error-va" title="g_simple_async_result_set_error_va ()"><code class="function">g_simple_async_result_set_error_va()</code></a>
314 if your application or binding requires passing a variable argument list
315 directly), and the error can then be propagated through the use of
316 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error" title="g_simple_async_result_propagate_error ()"><code class="function">g_simple_async_result_propagate_error()</code></a>.</p>
317 <p>An asynchronous operation can be made to ignore a cancellation event by
318 calling <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-handle-cancellation" title="g_simple_async_result_set_handle_cancellation ()"><code class="function">g_simple_async_result_set_handle_cancellation()</code></a> with a
319 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> for the operation and <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>. This is useful for
320 operations that are dangerous to cancel, such as close (which would
321 cause a leak if cancelled before being run).</p>
322 <p>GSimpleAsyncResult can integrate into GLib's event loop, <a href="../glib-The-Main-Event-Loop.html#GMainLoop"><span class="type">GMainLoop</span></a>,
323 or it can use <a href="../glib-Threads.html#GThread"><span class="type">GThreads</span></a>.
324 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete" title="g_simple_async_result_complete ()"><code class="function">g_simple_async_result_complete()</code></a> will finish an I/O task directly
325 from the point where it is called. <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle" title="g_simple_async_result_complete_in_idle ()"><code class="function">g_simple_async_result_complete_in_idle()</code></a>
326 will finish it from an idle handler in the 
327 <a href="../glib-The-Main-Event-Loop.html#g-main-context-push-thread-default">thread-default main context</a>
328 . <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-run-in-thread" title="g_simple_async_result_run_in_thread ()"><code class="function">g_simple_async_result_run_in_thread()</code></a> will run the
329 job in a separate thread and then deliver the result to the
330 thread-default main context.</p>
331 <p>To set the results of an asynchronous function,
332 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gpointer" title="g_simple_async_result_set_op_res_gpointer ()"><code class="function">g_simple_async_result_set_op_res_gpointer()</code></a>,
333 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gboolean" title="g_simple_async_result_set_op_res_gboolean ()"><code class="function">g_simple_async_result_set_op_res_gboolean()</code></a>, and
334 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gssize" title="g_simple_async_result_set_op_res_gssize ()"><code class="function">g_simple_async_result_set_op_res_gssize()</code></a>
335 are provided, setting the operation's result to a gpointer, gboolean, or
336 gssize, respectively.</p>
337 <p>Likewise, to get the result of an asynchronous function,
338 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gpointer" title="g_simple_async_result_get_op_res_gpointer ()"><code class="function">g_simple_async_result_get_op_res_gpointer()</code></a>,
339 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gboolean" title="g_simple_async_result_get_op_res_gboolean ()"><code class="function">g_simple_async_result_get_op_res_gboolean()</code></a>, and
340 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gssize" title="g_simple_async_result_get_op_res_gssize ()"><code class="function">g_simple_async_result_get_op_res_gssize()</code></a> are
341 provided, getting the operation's result as a gpointer, gboolean, and
342 gssize, respectively.</p>
343 <p>For the details of the requirements implementations must respect, see
344 <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.  A typical implementation of an asynchronous operation
345 using GSimpleAsyncResult looks something like this:</p>
346 <div class="informalexample">
347   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
348     <tbody>
349       <tr>
350         <td class="listing_lines" align="right"><pre>1
351 2
352 3
353 4
354 5
355 6
356 7
357 8
358 9
359 10
360 11
361 12
362 13
363 14
364 15
365 16
366 17
367 18
368 19
369 20
370 21
371 22
372 23
373 24
374 25
375 26
376 27
377 28
378 29
379 30
380 31
381 32
382 33
383 34
384 35
385 36
386 37
387 38
388 39
389 40
390 41
391 42
392 43
393 44
394 45
395 46
396 47
397 48
398 49
399 50
400 51
401 52
402 53
403 54
404 55
405 56
406 57
407 58
408 59
409 60
410 61
411 62
412 63
413 64
414 65
415 66
416 67
417 68
418 69
419 70
420 71
421 72
422 73
423 74
424 75
425 76
426 77
427 78
428 79
429 80
430 81
431 82
432 83
433 84
434 85
435 86
436 87
437 88
438 89
439 90
440 91
441 92</pre></td>
442         <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">static void</span>
443 <span class="function">baked_cb</span> <span class="gtkdoc opt">(</span>Cake    <span class="gtkdoc opt">*</span>cake<span class="gtkdoc opt">,</span>
444           gpointer user_data<span class="gtkdoc opt">)</span>
445 <span class="gtkdoc opt">{</span>
446   <span class="gtkdoc slc">// In this example, this callback is not given a reference to the cake,</span>
447   <span class="gtkdoc slc">// so the GSimpleAsyncResult has to take a reference to it.</span>
448   GSimpleAsyncResult <span class="gtkdoc opt">*</span>result <span class="gtkdoc opt">=</span> user_data<span class="gtkdoc opt">;</span>
449
450   <span class="keyword">if</span> <span class="gtkdoc opt">(</span>cake <span class="gtkdoc opt">==</span> NULL<span class="gtkdoc opt">)</span>
451     <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-set-error">g_simple_async_result_set_error</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">,</span>
452                                      BAKER_ERRORS<span class="gtkdoc opt">,</span>
453                                      BAKER_ERROR_NO_FLOUR<span class="gtkdoc opt">,</span>
454                                      <span class="string">&quot;Go to the supermarket&quot;</span><span class="gtkdoc opt">);</span>
455   <span class="keyword">else</span>
456     <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gpointer">g_simple_async_result_set_op_res_gpointer</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">,</span>
457                                                <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a></span> <span class="gtkdoc opt">(</span>cake<span class="gtkdoc opt">),</span>
458                                                g_object_unref<span class="gtkdoc opt">);</span>
459
460
461   <span class="gtkdoc slc">// In this example, we assume that baked_cb is called as a callback from</span>
462   <span class="gtkdoc slc">// the mainloop, so it&apos;s safe to complete the operation synchronously here.</span>
463   <span class="gtkdoc slc">// If, however, _baker_prepare_cake () might call its callback without</span>
464   <span class="gtkdoc slc">// first returning to the mainloop — inadvisable, but some APIs do so —</span>
465   <span class="gtkdoc slc">// we would need to use g_simple_async_result_complete_in_idle().</span>
466   <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-complete">g_simple_async_result_complete</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">);</span>
467   <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">);</span>
468 <span class="gtkdoc opt">}</span>
469
470 <span class="gtkdoc kwb">void</span>
471 <span class="function">baker_bake_cake_async</span> <span class="gtkdoc opt">(</span>Baker              <span class="gtkdoc opt">*</span>self<span class="gtkdoc opt">,</span>
472                        guint               radius<span class="gtkdoc opt">,</span>
473                        GAsyncReadyCallback callback<span class="gtkdoc opt">,</span>
474                        gpointer            user_data<span class="gtkdoc opt">)</span>
475 <span class="gtkdoc opt">{</span>
476   GSimpleAsyncResult <span class="gtkdoc opt">*</span>simple<span class="gtkdoc opt">;</span>
477   Cake               <span class="gtkdoc opt">*</span>cake<span class="gtkdoc opt">;</span>
478
479   <span class="keyword">if</span> <span class="gtkdoc opt">(</span>radius <span class="gtkdoc opt">&lt;</span> <span class="number">3</span><span class="gtkdoc opt">)</span>
480     <span class="gtkdoc opt">{</span>
481       <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-report-error-in-idle">g_simple_async_report_error_in_idle</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="../gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>self<span class="gtkdoc opt">),</span>
482                                            callback<span class="gtkdoc opt">,</span>
483                                            user_data<span class="gtkdoc opt">,</span>
484                                            BAKER_ERRORS<span class="gtkdoc opt">,</span>
485                                            BAKER_ERROR_TOO_SMALL<span class="gtkdoc opt">,</span>
486                                            <span class="string">&quot;%ucm radius cakes are silly&quot;</span><span class="gtkdoc opt">,</span>
487                                            radius<span class="gtkdoc opt">);</span>
488       <span class="keyword">return</span><span class="gtkdoc opt">;</span>
489     <span class="gtkdoc opt">}</span>
490
491   simple <span class="gtkdoc opt">=</span> <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-new">g_simple_async_result_new</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="../gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>self<span class="gtkdoc opt">),</span>
492                                       callback<span class="gtkdoc opt">,</span>
493                                       user_data<span class="gtkdoc opt">,</span>
494                                       baker_bake_cake_async<span class="gtkdoc opt">);</span>
495   cake <span class="gtkdoc opt">=</span> <span class="function">_baker_get_cached_cake</span> <span class="gtkdoc opt">(</span>self<span class="gtkdoc opt">,</span> radius<span class="gtkdoc opt">);</span>
496
497   <span class="keyword">if</span> <span class="gtkdoc opt">(</span>cake <span class="gtkdoc opt">!=</span> NULL<span class="gtkdoc opt">)</span>
498     <span class="gtkdoc opt">{</span>
499       <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-set-op-res-gpointer">g_simple_async_result_set_op_res_gpointer</a></span> <span class="gtkdoc opt">(</span>simple<span class="gtkdoc opt">,</span>
500                                                  <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a></span> <span class="gtkdoc opt">(</span>cake<span class="gtkdoc opt">),</span>
501                                                  g_object_unref<span class="gtkdoc opt">);</span>
502       <span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle">g_simple_async_result_complete_in_idle</a></span> <span class="gtkdoc opt">(</span>simple<span class="gtkdoc opt">);</span>
503       <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>simple<span class="gtkdoc opt">);</span>
504       <span class="gtkdoc slc">// Drop the reference returned by _baker_get_cached_cake();</span>
505       <span class="gtkdoc slc">// the GSimpleAsyncResult has taken its own reference.</span>
506       <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span> <span class="gtkdoc opt">(</span>cake<span class="gtkdoc opt">);</span>
507       <span class="keyword">return</span><span class="gtkdoc opt">;</span>
508     <span class="gtkdoc opt">}</span>
509
510   <span class="function">_baker_prepare_cake</span> <span class="gtkdoc opt">(</span>self<span class="gtkdoc opt">,</span> radius<span class="gtkdoc opt">,</span> baked_cb<span class="gtkdoc opt">,</span> simple<span class="gtkdoc opt">);</span>
511 <span class="gtkdoc opt">}</span>
512
513 Cake <span class="gtkdoc opt">*</span>
514 <span class="function">baker_bake_cake_finish</span> <span class="gtkdoc opt">(</span>Baker        <span class="gtkdoc opt">*</span>self<span class="gtkdoc opt">,</span>
515                         GAsyncResult <span class="gtkdoc opt">*</span>result<span class="gtkdoc opt">,</span>
516                         GError      <span class="gtkdoc opt">**</span>error<span class="gtkdoc opt">)</span>
517 <span class="gtkdoc opt">{</span>
518   GSimpleAsyncResult <span class="gtkdoc opt">*</span>simple<span class="gtkdoc opt">;</span>
519   Cake               <span class="gtkdoc opt">*</span>cake<span class="gtkdoc opt">;</span>
520
521   <span class="function"><a href="../glib-Warnings-and-Assertions.html#g-return-val-if-fail">g_return_val_if_fail</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-is-valid">g_simple_async_result_is_valid</a></span> <span class="gtkdoc opt">(</span>result<span class="gtkdoc opt">,</span>
522                                                         <span class="function"><a href="../gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>self<span class="gtkdoc opt">),</span>
523                                                         baker_bake_cake_async<span class="gtkdoc opt">),</span>
524                         NULL<span class="gtkdoc opt">);</span>
525
526   simple <span class="gtkdoc opt">= (</span>GSimpleAsyncResult <span class="gtkdoc opt">*)</span> result<span class="gtkdoc opt">;</span>
527
528   <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error">g_simple_async_result_propagate_error</a></span> <span class="gtkdoc opt">(</span>simple<span class="gtkdoc opt">,</span> error<span class="gtkdoc opt">))</span>
529     <span class="keyword">return</span> NULL<span class="gtkdoc opt">;</span>
530
531   cake <span class="gtkdoc opt">=</span> <span class="function">CAKE</span> <span class="gtkdoc opt">(</span><span class="function"><a href="GSimpleAsyncResult.html#g-simple-async-result-get-op-res-gpointer">g_simple_async_result_get_op_res_gpointer</a></span> <span class="gtkdoc opt">(</span>simple<span class="gtkdoc opt">));</span>
532   <span class="keyword">return</span> <span class="function"><a href="../gobject-The-Base-Object-Type.html#g-object-ref">g_object_ref</a></span> <span class="gtkdoc opt">(</span>cake<span class="gtkdoc opt">);</span>
533 <span class="gtkdoc opt">}</span></pre></td>
534       </tr>
535     </tbody>
536   </table>
537 </div>
538
539 <p></p>
540 </div>
541 <div class="refsect1">
542 <a name="GSimpleAsyncResult.functions_details"></a><h2>Functions</h2>
543 <div class="refsect2">
544 <a name="GSimpleAsyncThreadFunc"></a><h3>GSimpleAsyncThreadFunc ()</h3>
545 <pre class="programlisting"><span class="returnvalue">void</span>
546 <span class="c_punctuation">(</span>*GSimpleAsyncThreadFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *res</code></em>,
547                            <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *object</code></em>,
548                            <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
549 <p>Simple thread function that runs an asynchronous operation and
550 checks for cancellation.</p>
551 <div class="refsect3">
552 <a name="GSimpleAsyncThreadFunc.parameters"></a><h4>Parameters</h4>
553 <div class="informaltable"><table class="informaltable" width="100%" border="0">
554 <colgroup>
555 <col width="150px" class="parameters_name">
556 <col class="parameters_description">
557 <col width="200px" class="parameters_annotations">
558 </colgroup>
559 <tbody>
560 <tr>
561 <td class="parameter_name"><p>res</p></td>
562 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
563 <td class="parameter_annotations"> </td>
564 </tr>
565 <tr>
566 <td class="parameter_name"><p>object</p></td>
567 <td class="parameter_description"><p>a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>.</p></td>
568 <td class="parameter_annotations"> </td>
569 </tr>
570 <tr>
571 <td class="parameter_name"><p>cancellable</p></td>
572 <td class="parameter_description"><p>optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</p></td>
573 <td class="parameter_annotations"> </td>
574 </tr>
575 </tbody>
576 </table></div>
577 </div>
578 </div>
579 <hr>
580 <div class="refsect2">
581 <a name="g-simple-async-result-new"></a><h3>g_simple_async_result_new ()</h3>
582 <pre class="programlisting"><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
583 g_simple_async_result_new (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
584                            <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
585                            <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
586                            <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);</pre>
587 <div class="warning">
588 <p><code class="literal">g_simple_async_result_new</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
589 <p>Use <a class="link" href="GTask.html#g-task-new" title="g_task_new ()"><code class="function">g_task_new()</code></a> instead.</p>
590 </div>
591 <p>Creates a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
592 <p>The common convention is to create the <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> in the
593 function that starts the asynchronous operation and use that same
594 function as the <em class="parameter"><code>source_tag</code></em>
595 .</p>
596 <p>If your operation supports cancellation with <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> (which it
597 probably should) then you should provide the user's cancellable to
598 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-check-cancellable" title="g_simple_async_result_set_check_cancellable ()"><code class="function">g_simple_async_result_set_check_cancellable()</code></a> immediately after
599 this function returns.</p>
600 <div class="refsect3">
601 <a name="g-simple-async-result-new.parameters"></a><h4>Parameters</h4>
602 <div class="informaltable"><table class="informaltable" width="100%" border="0">
603 <colgroup>
604 <col width="150px" class="parameters_name">
605 <col class="parameters_description">
606 <col width="200px" class="parameters_annotations">
607 </colgroup>
608 <tbody>
609 <tr>
610 <td class="parameter_name"><p>source_object</p></td>
611 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
612 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
613 </tr>
614 <tr>
615 <td class="parameter_name"><p>callback</p></td>
616 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
617 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
618 </tr>
619 <tr>
620 <td class="parameter_name"><p>user_data</p></td>
621 <td class="parameter_description"><p> user data passed to <em class="parameter"><code>callback</code></em>
622 . </p></td>
623 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
624 </tr>
625 <tr>
626 <td class="parameter_name"><p>source_tag</p></td>
627 <td class="parameter_description"><p>the asynchronous function.</p></td>
628 <td class="parameter_annotations"> </td>
629 </tr>
630 </tbody>
631 </table></div>
632 </div>
633 <div class="refsect3">
634 <a name="g-simple-async-result-new.returns"></a><h4>Returns</h4>
635 <p> a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
636 </div>
637 </div>
638 <hr>
639 <div class="refsect2">
640 <a name="g-simple-async-result-new-error"></a><h3>g_simple_async_result_new_error ()</h3>
641 <pre class="programlisting"><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
642 g_simple_async_result_new_error (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
643                                  <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
644                                  <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
645                                  <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
646                                  <em class="parameter"><code><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
647                                  <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
648                                  <em class="parameter"><code>...</code></em>);</pre>
649 <div class="warning">
650 <p><code class="literal">g_simple_async_result_new_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
651 <p>Use <a class="link" href="GTask.html#g-task-new" title="g_task_new ()"><code class="function">g_task_new()</code></a> and <a class="link" href="GTask.html#g-task-return-new-error" title="g_task_return_new_error ()"><code class="function">g_task_return_new_error()</code></a> instead.</p>
652 </div>
653 <p>Creates a new <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> with a set error.</p>
654 <div class="refsect3">
655 <a name="g-simple-async-result-new-error.parameters"></a><h4>Parameters</h4>
656 <div class="informaltable"><table class="informaltable" width="100%" border="0">
657 <colgroup>
658 <col width="150px" class="parameters_name">
659 <col class="parameters_description">
660 <col width="200px" class="parameters_annotations">
661 </colgroup>
662 <tbody>
663 <tr>
664 <td class="parameter_name"><p>source_object</p></td>
665 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
666 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
667 </tr>
668 <tr>
669 <td class="parameter_name"><p>callback</p></td>
670 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
671 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
672 </tr>
673 <tr>
674 <td class="parameter_name"><p>user_data</p></td>
675 <td class="parameter_description"><p> user data passed to <em class="parameter"><code>callback</code></em>
676 . </p></td>
677 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
678 </tr>
679 <tr>
680 <td class="parameter_name"><p>domain</p></td>
681 <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a>.</p></td>
682 <td class="parameter_annotations"> </td>
683 </tr>
684 <tr>
685 <td class="parameter_name"><p>code</p></td>
686 <td class="parameter_description"><p>an error code.</p></td>
687 <td class="parameter_annotations"> </td>
688 </tr>
689 <tr>
690 <td class="parameter_name"><p>format</p></td>
691 <td class="parameter_description"><p>a string with format characters.</p></td>
692 <td class="parameter_annotations"> </td>
693 </tr>
694 <tr>
695 <td class="parameter_name"><p>...</p></td>
696 <td class="parameter_description"><p>a list of values to insert into <em class="parameter"><code>format</code></em>
697 .</p></td>
698 <td class="parameter_annotations"> </td>
699 </tr>
700 </tbody>
701 </table></div>
702 </div>
703 <div class="refsect3">
704 <a name="g-simple-async-result-new-error.returns"></a><h4>Returns</h4>
705 <p> a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
706 </div>
707 </div>
708 <hr>
709 <div class="refsect2">
710 <a name="g-simple-async-result-new-from-error"></a><h3>g_simple_async_result_new_from_error ()</h3>
711 <pre class="programlisting"><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
712 g_simple_async_result_new_from_error (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
713                                       <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
714                                       <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
715                                       <em class="parameter"><code>const <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
716 <div class="warning">
717 <p><code class="literal">g_simple_async_result_new_from_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
718 <p>Use <a class="link" href="GTask.html#g-task-new" title="g_task_new ()"><code class="function">g_task_new()</code></a> and <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a> instead.</p>
719 </div>
720 <p>Creates a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> from an error condition.</p>
721 <div class="refsect3">
722 <a name="g-simple-async-result-new-from-error.parameters"></a><h4>Parameters</h4>
723 <div class="informaltable"><table class="informaltable" width="100%" border="0">
724 <colgroup>
725 <col width="150px" class="parameters_name">
726 <col class="parameters_description">
727 <col width="200px" class="parameters_annotations">
728 </colgroup>
729 <tbody>
730 <tr>
731 <td class="parameter_name"><p>source_object</p></td>
732 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
733 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
734 </tr>
735 <tr>
736 <td class="parameter_name"><p>callback</p></td>
737 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
738 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
739 </tr>
740 <tr>
741 <td class="parameter_name"><p>user_data</p></td>
742 <td class="parameter_description"><p> user data passed to <em class="parameter"><code>callback</code></em>
743 . </p></td>
744 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
745 </tr>
746 <tr>
747 <td class="parameter_name"><p>error</p></td>
748 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
749 <td class="parameter_annotations"> </td>
750 </tr>
751 </tbody>
752 </table></div>
753 </div>
754 <div class="refsect3">
755 <a name="g-simple-async-result-new-from-error.returns"></a><h4>Returns</h4>
756 <p> a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
757 </div>
758 </div>
759 <hr>
760 <div class="refsect2">
761 <a name="g-simple-async-result-new-take-error"></a><h3>g_simple_async_result_new_take_error ()</h3>
762 <pre class="programlisting"><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="returnvalue">GSimpleAsyncResult</span></a> *
763 g_simple_async_result_new_take_error (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source_object</code></em>,
764                                       <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
765                                       <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
766                                       <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
767 <div class="warning">
768 <p><code class="literal">g_simple_async_result_new_take_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
769 <p>Use <a class="link" href="GTask.html#g-task-new" title="g_task_new ()"><code class="function">g_task_new()</code></a> and <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a> instead.</p>
770 </div>
771 <p>Creates a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> from an error condition, and takes over the
772 caller's ownership of <em class="parameter"><code>error</code></em>
773 , so the caller does not need to free it anymore.</p>
774 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
775 <div class="refsect3">
776 <a name="g-simple-async-result-new-take-error.parameters"></a><h4>Parameters</h4>
777 <div class="informaltable"><table class="informaltable" width="100%" border="0">
778 <colgroup>
779 <col width="150px" class="parameters_name">
780 <col class="parameters_description">
781 <col width="200px" class="parameters_annotations">
782 </colgroup>
783 <tbody>
784 <tr>
785 <td class="parameter_name"><p>source_object</p></td>
786 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
787 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
788 </tr>
789 <tr>
790 <td class="parameter_name"><p>callback</p></td>
791 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
792 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
793 </tr>
794 <tr>
795 <td class="parameter_name"><p>user_data</p></td>
796 <td class="parameter_description"><p> user data passed to <em class="parameter"><code>callback</code></em>
797 . </p></td>
798 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
799 </tr>
800 <tr>
801 <td class="parameter_name"><p>error</p></td>
802 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
803 <td class="parameter_annotations"> </td>
804 </tr>
805 </tbody>
806 </table></div>
807 </div>
808 <div class="refsect3">
809 <a name="g-simple-async-result-new-take-error.returns"></a><h4>Returns</h4>
810 <p> a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a></p>
811 </div>
812 <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p>
813 </div>
814 <hr>
815 <div class="refsect2">
816 <a name="g-simple-async-result-set-check-cancellable"></a><h3>g_simple_async_result_set_check_cancellable ()</h3>
817 <pre class="programlisting"><span class="returnvalue">void</span>
818 g_simple_async_result_set_check_cancellable
819                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
820                                 <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *check_cancellable</code></em>);</pre>
821 <div class="warning">
822 <p><code class="literal">g_simple_async_result_set_check_cancellable</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
823 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> instead.</p>
824 </div>
825 <p>Sets a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> to check before dispatching results.</p>
826 <p>This function has one very specific purpose: the provided cancellable
827 is checked at the time of <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-propagate-error" title="g_simple_async_result_propagate_error ()"><code class="function">g_simple_async_result_propagate_error()</code></a> If
828 it is cancelled, these functions will return an "Operation was
829 cancelled" error (<a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>).</p>
830 <p>Implementors of cancellable asynchronous functions should use this in
831 order to provide a guarantee to their callers that cancelling an
832 async operation will reliably result in an error being returned for
833 that operation (even if a positive result for the operation has
834 already been sent as an idle to the main context to be dispatched).</p>
835 <p>The checking described above is done regardless of any call to the
836 unrelated <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-handle-cancellation" title="g_simple_async_result_set_handle_cancellation ()"><code class="function">g_simple_async_result_set_handle_cancellation()</code></a> function.</p>
837 <div class="refsect3">
838 <a name="g-simple-async-result-set-check-cancellable.parameters"></a><h4>Parameters</h4>
839 <div class="informaltable"><table class="informaltable" width="100%" border="0">
840 <colgroup>
841 <col width="150px" class="parameters_name">
842 <col class="parameters_description">
843 <col width="200px" class="parameters_annotations">
844 </colgroup>
845 <tbody>
846 <tr>
847 <td class="parameter_name"><p>simple</p></td>
848 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a></p></td>
849 <td class="parameter_annotations"> </td>
850 </tr>
851 <tr>
852 <td class="parameter_name"><p>check_cancellable</p></td>
853 <td class="parameter_description"><p> a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> to check, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to unset. </p></td>
854 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
855 </tr>
856 </tbody>
857 </table></div>
858 </div>
859 <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p>
860 </div>
861 <hr>
862 <div class="refsect2">
863 <a name="g-simple-async-result-set-op-res-gpointer"></a><h3>g_simple_async_result_set_op_res_gpointer ()</h3>
864 <pre class="programlisting"><span class="returnvalue">void</span>
865 g_simple_async_result_set_op_res_gpointer
866                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
867                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> op_res</code></em>,
868                                 <em class="parameter"><code><a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_op_res</code></em>);</pre>
869 <div class="warning">
870 <p><code class="literal">g_simple_async_result_set_op_res_gpointer</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
871 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-pointer" title="g_task_return_pointer ()"><code class="function">g_task_return_pointer()</code></a> instead.</p>
872 </div>
873 <p>Sets the operation result within the asynchronous result to a pointer.</p>
874 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
875 <div class="refsect3">
876 <a name="g-simple-async-result-set-op-res-gpointer.parameters"></a><h4>Parameters</h4>
877 <div class="informaltable"><table class="informaltable" width="100%" border="0">
878 <colgroup>
879 <col width="150px" class="parameters_name">
880 <col class="parameters_description">
881 <col width="200px" class="parameters_annotations">
882 </colgroup>
883 <tbody>
884 <tr>
885 <td class="parameter_name"><p>simple</p></td>
886 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
887 <td class="parameter_annotations"> </td>
888 </tr>
889 <tr>
890 <td class="parameter_name"><p>op_res</p></td>
891 <td class="parameter_description"><p>a pointer result from an asynchronous function.</p></td>
892 <td class="parameter_annotations"> </td>
893 </tr>
894 <tr>
895 <td class="parameter_name"><p>destroy_op_res</p></td>
896 <td class="parameter_description"><p>a <a href="../glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> function.</p></td>
897 <td class="parameter_annotations"> </td>
898 </tr>
899 </tbody>
900 </table></div>
901 </div>
902 </div>
903 <hr>
904 <div class="refsect2">
905 <a name="g-simple-async-result-get-op-res-gpointer"></a><h3>g_simple_async_result_get_op_res_gpointer ()</h3>
906 <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
907 g_simple_async_result_get_op_res_gpointer
908                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
909 <div class="warning">
910 <p><code class="literal">g_simple_async_result_get_op_res_gpointer</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
911 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-propagate-pointer" title="g_task_propagate_pointer ()"><code class="function">g_task_propagate_pointer()</code></a> instead.</p>
912 </div>
913 <p>Gets a pointer result as returned by the asynchronous function.</p>
914 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
915 <div class="refsect3">
916 <a name="g-simple-async-result-get-op-res-gpointer.parameters"></a><h4>Parameters</h4>
917 <div class="informaltable"><table class="informaltable" width="100%" border="0">
918 <colgroup>
919 <col width="150px" class="parameters_name">
920 <col class="parameters_description">
921 <col width="200px" class="parameters_annotations">
922 </colgroup>
923 <tbody><tr>
924 <td class="parameter_name"><p>simple</p></td>
925 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
926 <td class="parameter_annotations"> </td>
927 </tr></tbody>
928 </table></div>
929 </div>
930 <div class="refsect3">
931 <a name="g-simple-async-result-get-op-res-gpointer.returns"></a><h4>Returns</h4>
932 <p> a pointer from the result.</p>
933 </div>
934 </div>
935 <hr>
936 <div class="refsect2">
937 <a name="g-simple-async-result-set-op-res-gssize"></a><h3>g_simple_async_result_set_op_res_gssize ()</h3>
938 <pre class="programlisting"><span class="returnvalue">void</span>
939 g_simple_async_result_set_op_res_gssize
940                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
941                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gssize"><span class="type">gssize</span></a> op_res</code></em>);</pre>
942 <div class="warning">
943 <p><code class="literal">g_simple_async_result_set_op_res_gssize</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
944 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-int" title="g_task_return_int ()"><code class="function">g_task_return_int()</code></a> instead.</p>
945 </div>
946 <p>Sets the operation result within the asynchronous result to
947 the given <em class="parameter"><code>op_res</code></em>
948 .</p>
949 <div class="refsect3">
950 <a name="g-simple-async-result-set-op-res-gssize.parameters"></a><h4>Parameters</h4>
951 <div class="informaltable"><table class="informaltable" width="100%" border="0">
952 <colgroup>
953 <col width="150px" class="parameters_name">
954 <col class="parameters_description">
955 <col width="200px" class="parameters_annotations">
956 </colgroup>
957 <tbody>
958 <tr>
959 <td class="parameter_name"><p>simple</p></td>
960 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
961 <td class="parameter_annotations"> </td>
962 </tr>
963 <tr>
964 <td class="parameter_name"><p>op_res</p></td>
965 <td class="parameter_description"><p>a <a href="../glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>.</p></td>
966 <td class="parameter_annotations"> </td>
967 </tr>
968 </tbody>
969 </table></div>
970 </div>
971 </div>
972 <hr>
973 <div class="refsect2">
974 <a name="g-simple-async-result-get-op-res-gssize"></a><h3>g_simple_async_result_get_op_res_gssize ()</h3>
975 <pre class="programlisting"><a href="../glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>
976 g_simple_async_result_get_op_res_gssize
977                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
978 <div class="warning">
979 <p><code class="literal">g_simple_async_result_get_op_res_gssize</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
980 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-propagate-int" title="g_task_propagate_int ()"><code class="function">g_task_propagate_int()</code></a> instead.</p>
981 </div>
982 <p>Gets a gssize from the asynchronous result.</p>
983 <div class="refsect3">
984 <a name="g-simple-async-result-get-op-res-gssize.parameters"></a><h4>Parameters</h4>
985 <div class="informaltable"><table class="informaltable" width="100%" border="0">
986 <colgroup>
987 <col width="150px" class="parameters_name">
988 <col class="parameters_description">
989 <col width="200px" class="parameters_annotations">
990 </colgroup>
991 <tbody><tr>
992 <td class="parameter_name"><p>simple</p></td>
993 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
994 <td class="parameter_annotations"> </td>
995 </tr></tbody>
996 </table></div>
997 </div>
998 <div class="refsect3">
999 <a name="g-simple-async-result-get-op-res-gssize.returns"></a><h4>Returns</h4>
1000 <p> a gssize returned from the asynchronous function.</p>
1001 </div>
1002 </div>
1003 <hr>
1004 <div class="refsect2">
1005 <a name="g-simple-async-result-set-op-res-gboolean"></a><h3>g_simple_async_result_set_op_res_gboolean ()</h3>
1006 <pre class="programlisting"><span class="returnvalue">void</span>
1007 g_simple_async_result_set_op_res_gboolean
1008                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1009                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> op_res</code></em>);</pre>
1010 <div class="warning">
1011 <p><code class="literal">g_simple_async_result_set_op_res_gboolean</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1012 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-boolean" title="g_task_return_boolean ()"><code class="function">g_task_return_boolean()</code></a> instead.</p>
1013 </div>
1014 <p>Sets the operation result to a boolean within the asynchronous result.</p>
1015 <div class="refsect3">
1016 <a name="g-simple-async-result-set-op-res-gboolean.parameters"></a><h4>Parameters</h4>
1017 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1018 <colgroup>
1019 <col width="150px" class="parameters_name">
1020 <col class="parameters_description">
1021 <col width="200px" class="parameters_annotations">
1022 </colgroup>
1023 <tbody>
1024 <tr>
1025 <td class="parameter_name"><p>simple</p></td>
1026 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1027 <td class="parameter_annotations"> </td>
1028 </tr>
1029 <tr>
1030 <td class="parameter_name"><p>op_res</p></td>
1031 <td class="parameter_description"><p>a <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>.</p></td>
1032 <td class="parameter_annotations"> </td>
1033 </tr>
1034 </tbody>
1035 </table></div>
1036 </div>
1037 </div>
1038 <hr>
1039 <div class="refsect2">
1040 <a name="g-simple-async-result-get-op-res-gboolean"></a><h3>g_simple_async_result_get_op_res_gboolean ()</h3>
1041 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
1042 g_simple_async_result_get_op_res_gboolean
1043                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
1044 <div class="warning">
1045 <p><code class="literal">g_simple_async_result_get_op_res_gboolean</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1046 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-propagate-boolean" title="g_task_propagate_boolean ()"><code class="function">g_task_propagate_boolean()</code></a> instead.</p>
1047 </div>
1048 <p>Gets the operation result boolean from within the asynchronous result.</p>
1049 <div class="refsect3">
1050 <a name="g-simple-async-result-get-op-res-gboolean.parameters"></a><h4>Parameters</h4>
1051 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1052 <colgroup>
1053 <col width="150px" class="parameters_name">
1054 <col class="parameters_description">
1055 <col width="200px" class="parameters_annotations">
1056 </colgroup>
1057 <tbody><tr>
1058 <td class="parameter_name"><p>simple</p></td>
1059 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1060 <td class="parameter_annotations"> </td>
1061 </tr></tbody>
1062 </table></div>
1063 </div>
1064 <div class="refsect3">
1065 <a name="g-simple-async-result-get-op-res-gboolean.returns"></a><h4>Returns</h4>
1066 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation's result was <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
1067 if the operation's result was <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p>
1068 </div>
1069 </div>
1070 <hr>
1071 <div class="refsect2">
1072 <a name="g-simple-async-result-get-source-tag"></a><h3>g_simple_async_result_get_source_tag ()</h3>
1073 <pre class="programlisting"><a href="../glib-Basic-Types.html#gpointer"><span class="returnvalue">gpointer</span></a>
1074 g_simple_async_result_get_source_tag (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
1075 <div class="warning">
1076 <p><code class="literal">g_simple_async_result_get_source_tag</code> has been deprecated since version 2.46. and should not be used in newly-written code.</p>
1077 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-get-source-tag" title="g_task_get_source_tag ()"><code class="function">g_task_get_source_tag()</code></a> instead.</p>
1078 </div>
1079 <p>Gets the source tag for the <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
1080 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1081 <div class="refsect3">
1082 <a name="g-simple-async-result-get-source-tag.parameters"></a><h4>Parameters</h4>
1083 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1084 <colgroup>
1085 <col width="150px" class="parameters_name">
1086 <col class="parameters_description">
1087 <col width="200px" class="parameters_annotations">
1088 </colgroup>
1089 <tbody><tr>
1090 <td class="parameter_name"><p>simple</p></td>
1091 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1092 <td class="parameter_annotations"> </td>
1093 </tr></tbody>
1094 </table></div>
1095 </div>
1096 <div class="refsect3">
1097 <a name="g-simple-async-result-get-source-tag.returns"></a><h4>Returns</h4>
1098 <p> a <a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> to the source object for the <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p>
1099 </div>
1100 </div>
1101 <hr>
1102 <div class="refsect2">
1103 <a name="g-simple-async-result-is-valid"></a><h3>g_simple_async_result_is_valid ()</h3>
1104 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
1105 g_simple_async_result_is_valid (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
1106                                 <em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *source</code></em>,
1107                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> source_tag</code></em>);</pre>
1108 <div class="warning">
1109 <p><code class="literal">g_simple_async_result_is_valid</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1110 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-is-valid" title="g_task_is_valid ()"><code class="function">g_task_is_valid()</code></a> instead.</p>
1111 </div>
1112 <p>Ensures that the data passed to the _finish function of an async
1113 operation is consistent.  Three checks are performed.</p>
1114 <p>First, <em class="parameter"><code>result</code></em>
1115  is checked to ensure that it is really a
1116 <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.  Second, <em class="parameter"><code>source</code></em>
1117  is checked to ensure that it
1118 matches the source object of <em class="parameter"><code>result</code></em>
1119 .  Third, <em class="parameter"><code>source_tag</code></em>
1120  is
1121 checked to ensure that it is equal to the <em class="parameter"><code>source_tag</code></em>
1122  argument given
1123 to <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-new" title="g_simple_async_result_new ()"><code class="function">g_simple_async_result_new()</code></a> (which, by convention, is a pointer
1124 to the _async function corresponding to the _finish function from
1125 which this function is called).  (Alternatively, if either
1126 <em class="parameter"><code>source_tag</code></em>
1127  or <em class="parameter"><code>result</code></em>
1128 's source tag is <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the source tag
1129 check is skipped.)</p>
1130 <div class="refsect3">
1131 <a name="g-simple-async-result-is-valid.parameters"></a><h4>Parameters</h4>
1132 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1133 <colgroup>
1134 <col width="150px" class="parameters_name">
1135 <col class="parameters_description">
1136 <col width="200px" class="parameters_annotations">
1137 </colgroup>
1138 <tbody>
1139 <tr>
1140 <td class="parameter_name"><p>result</p></td>
1141 <td class="parameter_description"><p>the <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> passed to the _finish function.</p></td>
1142 <td class="parameter_annotations"> </td>
1143 </tr>
1144 <tr>
1145 <td class="parameter_name"><p>source</p></td>
1146 <td class="parameter_description"><p> the <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> passed to the _finish function. </p></td>
1147 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1148 </tr>
1149 <tr>
1150 <td class="parameter_name"><p>source_tag</p></td>
1151 <td class="parameter_description"><p> the asynchronous function. </p></td>
1152 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1153 </tr>
1154 </tbody>
1155 </table></div>
1156 </div>
1157 <div class="refsect3">
1158 <a name="g-simple-async-result-is-valid.returns"></a><h4>Returns</h4>
1159 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><span class="type">TRUE</span></a> if all checks passed or <a href="../glib-Standard-Macros.html#FALSE:CAPS"><span class="type">FALSE</span></a> if any failed.</p>
1160 </div>
1161 <p class="since">Since: <a class="link" href="api-index-2-20.html#api-index-2.20">2.20</a></p>
1162 </div>
1163 <hr>
1164 <div class="refsect2">
1165 <a name="g-simple-async-result-set-handle-cancellation"></a><h3>g_simple_async_result_set_handle_cancellation ()</h3>
1166 <pre class="programlisting"><span class="returnvalue">void</span>
1167 g_simple_async_result_set_handle_cancellation
1168                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1169                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> handle_cancellation</code></em>);</pre>
1170 <div class="warning"><p><code class="literal">g_simple_async_result_set_handle_cancellation</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p></div>
1171 <p>Sets whether to handle cancellation within the asynchronous operation.</p>
1172 <p>This function has nothing to do with
1173 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-check-cancellable" title="g_simple_async_result_set_check_cancellable ()"><code class="function">g_simple_async_result_set_check_cancellable()</code></a>.  It only refers to the
1174 <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> passed to <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-run-in-thread" title="g_simple_async_result_run_in_thread ()"><code class="function">g_simple_async_result_run_in_thread()</code></a>.</p>
1175 <div class="refsect3">
1176 <a name="g-simple-async-result-set-handle-cancellation.parameters"></a><h4>Parameters</h4>
1177 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1178 <colgroup>
1179 <col width="150px" class="parameters_name">
1180 <col class="parameters_description">
1181 <col width="200px" class="parameters_annotations">
1182 </colgroup>
1183 <tbody>
1184 <tr>
1185 <td class="parameter_name"><p>simple</p></td>
1186 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1187 <td class="parameter_annotations"> </td>
1188 </tr>
1189 <tr>
1190 <td class="parameter_name"><p>handle_cancellation</p></td>
1191 <td class="parameter_description"><p>a <a href="../glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>.</p></td>
1192 <td class="parameter_annotations"> </td>
1193 </tr>
1194 </tbody>
1195 </table></div>
1196 </div>
1197 </div>
1198 <hr>
1199 <div class="refsect2">
1200 <a name="g-simple-async-result-complete"></a><h3>g_simple_async_result_complete ()</h3>
1201 <pre class="programlisting"><span class="returnvalue">void</span>
1202 g_simple_async_result_complete (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
1203 <div class="warning">
1204 <p><code class="literal">g_simple_async_result_complete</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1205 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> instead.</p>
1206 </div>
1207 <p>Completes an asynchronous I/O job immediately. Must be called in
1208 the thread where the asynchronous result was to be delivered, as it
1209 invokes the callback directly. If you are in a different thread use
1210 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle" title="g_simple_async_result_complete_in_idle ()"><code class="function">g_simple_async_result_complete_in_idle()</code></a>.</p>
1211 <p>Calling this function takes a reference to <em class="parameter"><code>simple</code></em>
1212  for as long as
1213 is needed to complete the call.</p>
1214 <div class="refsect3">
1215 <a name="g-simple-async-result-complete.parameters"></a><h4>Parameters</h4>
1216 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1217 <colgroup>
1218 <col width="150px" class="parameters_name">
1219 <col class="parameters_description">
1220 <col width="200px" class="parameters_annotations">
1221 </colgroup>
1222 <tbody><tr>
1223 <td class="parameter_name"><p>simple</p></td>
1224 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1225 <td class="parameter_annotations"> </td>
1226 </tr></tbody>
1227 </table></div>
1228 </div>
1229 </div>
1230 <hr>
1231 <div class="refsect2">
1232 <a name="g-simple-async-result-complete-in-idle"></a><h3>g_simple_async_result_complete_in_idle ()</h3>
1233 <pre class="programlisting"><span class="returnvalue">void</span>
1234 g_simple_async_result_complete_in_idle
1235                                (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>);</pre>
1236 <div class="warning">
1237 <p><code class="literal">g_simple_async_result_complete_in_idle</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1238 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> instead.</p>
1239 </div>
1240 <p>Completes an asynchronous function in an idle handler in the
1241 <a href="../glib-The-Main-Event-Loop.html#g-main-context-push-thread-default">thread-default main context</a>
1242 of the thread that <em class="parameter"><code>simple</code></em>
1243  was initially created in
1244 (and re-pushes that context around the invocation of the callback).</p>
1245 <p>Calling this function takes a reference to <em class="parameter"><code>simple</code></em>
1246  for as long as
1247 is needed to complete the call.</p>
1248 <div class="refsect3">
1249 <a name="g-simple-async-result-complete-in-idle.parameters"></a><h4>Parameters</h4>
1250 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1251 <colgroup>
1252 <col width="150px" class="parameters_name">
1253 <col class="parameters_description">
1254 <col width="200px" class="parameters_annotations">
1255 </colgroup>
1256 <tbody><tr>
1257 <td class="parameter_name"><p>simple</p></td>
1258 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1259 <td class="parameter_annotations"> </td>
1260 </tr></tbody>
1261 </table></div>
1262 </div>
1263 </div>
1264 <hr>
1265 <div class="refsect2">
1266 <a name="g-simple-async-result-run-in-thread"></a><h3>g_simple_async_result_run_in_thread ()</h3>
1267 <pre class="programlisting"><span class="returnvalue">void</span>
1268 g_simple_async_result_run_in_thread (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1269                                      <em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html#GSimpleAsyncThreadFunc" title="GSimpleAsyncThreadFunc ()"><span class="type">GSimpleAsyncThreadFunc</span></a> func</code></em>,
1270                                      <em class="parameter"><code><span class="type">int</span> io_priority</code></em>,
1271                                      <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
1272 <div class="warning">
1273 <p><code class="literal">g_simple_async_result_run_in_thread</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1274 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-run-in-thread" title="g_task_run_in_thread ()"><code class="function">g_task_run_in_thread()</code></a> instead.</p>
1275 </div>
1276 <p>Runs the asynchronous job in a separate thread and then calls
1277 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-complete-in-idle" title="g_simple_async_result_complete_in_idle ()"><code class="function">g_simple_async_result_complete_in_idle()</code></a> on <em class="parameter"><code>simple</code></em>
1278  to return
1279 the result to the appropriate main loop.</p>
1280 <p>Calling this function takes a reference to <em class="parameter"><code>simple</code></em>
1281  for as long as
1282 is needed to run the job and report its completion.</p>
1283 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1284 <div class="refsect3">
1285 <a name="g-simple-async-result-run-in-thread.parameters"></a><h4>Parameters</h4>
1286 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1287 <colgroup>
1288 <col width="150px" class="parameters_name">
1289 <col class="parameters_description">
1290 <col width="200px" class="parameters_annotations">
1291 </colgroup>
1292 <tbody>
1293 <tr>
1294 <td class="parameter_name"><p>simple</p></td>
1295 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1296 <td class="parameter_annotations"> </td>
1297 </tr>
1298 <tr>
1299 <td class="parameter_name"><p>func</p></td>
1300 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html#GSimpleAsyncThreadFunc" title="GSimpleAsyncThreadFunc ()"><span class="type">GSimpleAsyncThreadFunc</span></a>.</p></td>
1301 <td class="parameter_annotations"> </td>
1302 </tr>
1303 <tr>
1304 <td class="parameter_name"><p>io_priority</p></td>
1305 <td class="parameter_description"><p>the io priority of the request.</p></td>
1306 <td class="parameter_annotations"> </td>
1307 </tr>
1308 <tr>
1309 <td class="parameter_name"><p>cancellable</p></td>
1310 <td class="parameter_description"><p> optional <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> object, <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore. </p></td>
1311 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1312 </tr>
1313 </tbody>
1314 </table></div>
1315 </div>
1316 </div>
1317 <hr>
1318 <div class="refsect2">
1319 <a name="g-simple-async-result-set-from-error"></a><h3>g_simple_async_result_set_from_error ()</h3>
1320 <pre class="programlisting"><span class="returnvalue">void</span>
1321 g_simple_async_result_set_from_error (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1322                                       <em class="parameter"><code>const <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1323 <div class="warning">
1324 <p><code class="literal">g_simple_async_result_set_from_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1325 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a> instead.</p>
1326 </div>
1327 <p>Sets the result from a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p>
1328 <div class="refsect3">
1329 <a name="g-simple-async-result-set-from-error.parameters"></a><h4>Parameters</h4>
1330 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1331 <colgroup>
1332 <col width="150px" class="parameters_name">
1333 <col class="parameters_description">
1334 <col width="200px" class="parameters_annotations">
1335 </colgroup>
1336 <tbody>
1337 <tr>
1338 <td class="parameter_name"><p>simple</p></td>
1339 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1340 <td class="parameter_annotations"> </td>
1341 </tr>
1342 <tr>
1343 <td class="parameter_name"><p>error</p></td>
1344 <td class="parameter_description"><p><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p></td>
1345 <td class="parameter_annotations"> </td>
1346 </tr>
1347 </tbody>
1348 </table></div>
1349 </div>
1350 </div>
1351 <hr>
1352 <div class="refsect2">
1353 <a name="g-simple-async-result-take-error"></a><h3>g_simple_async_result_take_error ()</h3>
1354 <pre class="programlisting"><span class="returnvalue">void</span>
1355 g_simple_async_result_take_error (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1356                                   <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1357 <div class="warning">
1358 <p><code class="literal">g_simple_async_result_take_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1359 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a> instead.</p>
1360 </div>
1361 <p>Sets the result from <em class="parameter"><code>error</code></em>
1362 , and takes over the caller's ownership
1363 of <em class="parameter"><code>error</code></em>
1364 , so the caller does not need to free it any more.</p>
1365 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1366 <div class="refsect3">
1367 <a name="g-simple-async-result-take-error.parameters"></a><h4>Parameters</h4>
1368 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1369 <colgroup>
1370 <col width="150px" class="parameters_name">
1371 <col class="parameters_description">
1372 <col width="200px" class="parameters_annotations">
1373 </colgroup>
1374 <tbody>
1375 <tr>
1376 <td class="parameter_name"><p>simple</p></td>
1377 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a></p></td>
1378 <td class="parameter_annotations"> </td>
1379 </tr>
1380 <tr>
1381 <td class="parameter_name"><p>error</p></td>
1382 <td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
1383 <td class="parameter_annotations"> </td>
1384 </tr>
1385 </tbody>
1386 </table></div>
1387 </div>
1388 <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p>
1389 </div>
1390 <hr>
1391 <div class="refsect2">
1392 <a name="g-simple-async-result-propagate-error"></a><h3>g_simple_async_result_propagate_error ()</h3>
1393 <pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
1394 g_simple_async_result_propagate_error (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1395                                        <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **dest</code></em>);</pre>
1396 <div class="warning">
1397 <p><code class="literal">g_simple_async_result_propagate_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1398 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> instead.</p>
1399 </div>
1400 <p>Propagates an error from within the simple asynchronous result to
1401 a given destination.</p>
1402 <p>If the <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> given to a prior call to
1403 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-check-cancellable" title="g_simple_async_result_set_check_cancellable ()"><code class="function">g_simple_async_result_set_check_cancellable()</code></a> is cancelled then this
1404 function will return <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> with <em class="parameter"><code>dest</code></em>
1405  set appropriately.</p>
1406 <div class="refsect3">
1407 <a name="g-simple-async-result-propagate-error.parameters"></a><h4>Parameters</h4>
1408 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1409 <colgroup>
1410 <col width="150px" class="parameters_name">
1411 <col class="parameters_description">
1412 <col width="200px" class="parameters_annotations">
1413 </colgroup>
1414 <tbody>
1415 <tr>
1416 <td class="parameter_name"><p>simple</p></td>
1417 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1418 <td class="parameter_annotations"> </td>
1419 </tr>
1420 <tr>
1421 <td class="parameter_name"><p>dest</p></td>
1422 <td class="parameter_description"><p> a location to propagate the error to. </p></td>
1423 <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
1424 </tr>
1425 </tbody>
1426 </table></div>
1427 </div>
1428 <div class="refsect3">
1429 <a name="g-simple-async-result-propagate-error.returns"></a><h4>Returns</h4>
1430 <p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the error was propagated to <em class="parameter"><code>dest</code></em>
1431 . <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</p>
1432 </div>
1433 </div>
1434 <hr>
1435 <div class="refsect2">
1436 <a name="g-simple-async-result-set-error"></a><h3>g_simple_async_result_set_error ()</h3>
1437 <pre class="programlisting"><span class="returnvalue">void</span>
1438 g_simple_async_result_set_error (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1439                                  <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
1440                                  <em class="parameter"><code><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
1441                                  <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
1442                                  <em class="parameter"><code>...</code></em>);</pre>
1443 <div class="warning">
1444 <p><code class="literal">g_simple_async_result_set_error</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1445 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-new-error" title="g_task_return_new_error ()"><code class="function">g_task_return_new_error()</code></a> instead.</p>
1446 </div>
1447 <p>Sets an error within the asynchronous result without a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.</p>
1448 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1449 <div class="refsect3">
1450 <a name="g-simple-async-result-set-error.parameters"></a><h4>Parameters</h4>
1451 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1452 <colgroup>
1453 <col width="150px" class="parameters_name">
1454 <col class="parameters_description">
1455 <col width="200px" class="parameters_annotations">
1456 </colgroup>
1457 <tbody>
1458 <tr>
1459 <td class="parameter_name"><p>simple</p></td>
1460 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1461 <td class="parameter_annotations"> </td>
1462 </tr>
1463 <tr>
1464 <td class="parameter_name"><p>domain</p></td>
1465 <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> (usually <a class="link" href="gio-GIOError.html#G-IO-ERROR:CAPS" title="G_IO_ERROR"><span class="type">G_IO_ERROR</span></a>).</p></td>
1466 <td class="parameter_annotations"> </td>
1467 </tr>
1468 <tr>
1469 <td class="parameter_name"><p>code</p></td>
1470 <td class="parameter_description"><p>an error code.</p></td>
1471 <td class="parameter_annotations"> </td>
1472 </tr>
1473 <tr>
1474 <td class="parameter_name"><p>format</p></td>
1475 <td class="parameter_description"><p>a formatted error reporting string.</p></td>
1476 <td class="parameter_annotations"> </td>
1477 </tr>
1478 <tr>
1479 <td class="parameter_name"><p>...</p></td>
1480 <td class="parameter_description"><p>a list of variables to fill in <em class="parameter"><code>format</code></em>
1481 .</p></td>
1482 <td class="parameter_annotations"> </td>
1483 </tr>
1484 </tbody>
1485 </table></div>
1486 </div>
1487 </div>
1488 <hr>
1489 <div class="refsect2">
1490 <a name="g-simple-async-result-set-error-va"></a><h3>g_simple_async_result_set_error_va ()</h3>
1491 <pre class="programlisting"><span class="returnvalue">void</span>
1492 g_simple_async_result_set_error_va (<em class="parameter"><code><a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a> *simple</code></em>,
1493                                     <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
1494                                     <em class="parameter"><code><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
1495                                     <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
1496                                     <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
1497 <div class="warning">
1498 <p><code class="literal">g_simple_async_result_set_error_va</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1499 <p>Use <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a> and <a class="link" href="GTask.html#g-task-return-error" title="g_task_return_error ()"><code class="function">g_task_return_error()</code></a> instead.</p>
1500 </div>
1501 <p>Sets an error within the asynchronous result without a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.
1502 Unless writing a binding, see <a class="link" href="GSimpleAsyncResult.html#g-simple-async-result-set-error" title="g_simple_async_result_set_error ()"><code class="function">g_simple_async_result_set_error()</code></a>.</p>
1503 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1504 <div class="refsect3">
1505 <a name="g-simple-async-result-set-error-va.parameters"></a><h4>Parameters</h4>
1506 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1507 <colgroup>
1508 <col width="150px" class="parameters_name">
1509 <col class="parameters_description">
1510 <col width="200px" class="parameters_annotations">
1511 </colgroup>
1512 <tbody>
1513 <tr>
1514 <td class="parameter_name"><p>simple</p></td>
1515 <td class="parameter_description"><p>a <a class="link" href="GSimpleAsyncResult.html" title="GSimpleAsyncResult"><span class="type">GSimpleAsyncResult</span></a>.</p></td>
1516 <td class="parameter_annotations"> </td>
1517 </tr>
1518 <tr>
1519 <td class="parameter_name"><p>domain</p></td>
1520 <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> (usually <a class="link" href="gio-GIOError.html#G-IO-ERROR:CAPS" title="G_IO_ERROR"><span class="type">G_IO_ERROR</span></a>).</p></td>
1521 <td class="parameter_annotations"> </td>
1522 </tr>
1523 <tr>
1524 <td class="parameter_name"><p>code</p></td>
1525 <td class="parameter_description"><p>an error code.</p></td>
1526 <td class="parameter_annotations"> </td>
1527 </tr>
1528 <tr>
1529 <td class="parameter_name"><p>format</p></td>
1530 <td class="parameter_description"><p>a formatted error reporting string.</p></td>
1531 <td class="parameter_annotations"> </td>
1532 </tr>
1533 <tr>
1534 <td class="parameter_name"><p>args</p></td>
1535 <td class="parameter_description"><p>va_list of arguments.</p></td>
1536 <td class="parameter_annotations"> </td>
1537 </tr>
1538 </tbody>
1539 </table></div>
1540 </div>
1541 </div>
1542 <hr>
1543 <div class="refsect2">
1544 <a name="g-simple-async-report-error-in-idle"></a><h3>g_simple_async_report_error_in_idle ()</h3>
1545 <pre class="programlisting"><span class="returnvalue">void</span>
1546 g_simple_async_report_error_in_idle (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *object</code></em>,
1547                                      <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1548                                      <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
1549                                      <em class="parameter"><code><a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> domain</code></em>,
1550                                      <em class="parameter"><code><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> code</code></em>,
1551                                      <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
1552                                      <em class="parameter"><code>...</code></em>);</pre>
1553 <div class="warning">
1554 <p><code class="literal">g_simple_async_report_error_in_idle</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1555 <p>Use <a class="link" href="GTask.html#g-task-report-error" title="g_task_report_error ()"><code class="function">g_task_report_error()</code></a>.</p>
1556 </div>
1557 <p>Reports an error in an asynchronous function in an idle function by
1558 directly setting the contents of the <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> with the given error
1559 information.</p>
1560 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1561 <div class="refsect3">
1562 <a name="g-simple-async-report-error-in-idle.parameters"></a><h4>Parameters</h4>
1563 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1564 <colgroup>
1565 <col width="150px" class="parameters_name">
1566 <col class="parameters_description">
1567 <col width="200px" class="parameters_annotations">
1568 </colgroup>
1569 <tbody>
1570 <tr>
1571 <td class="parameter_name"><p>object</p></td>
1572 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
1573 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1574 </tr>
1575 <tr>
1576 <td class="parameter_name"><p>callback</p></td>
1577 <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>.</p></td>
1578 <td class="parameter_annotations"> </td>
1579 </tr>
1580 <tr>
1581 <td class="parameter_name"><p>user_data</p></td>
1582 <td class="parameter_description"><p>user data passed to <em class="parameter"><code>callback</code></em>
1583 .</p></td>
1584 <td class="parameter_annotations"> </td>
1585 </tr>
1586 <tr>
1587 <td class="parameter_name"><p>domain</p></td>
1588 <td class="parameter_description"><p>a <a href="../glib-Quarks.html#GQuark"><span class="type">GQuark</span></a> containing the error domain (usually <a class="link" href="gio-GIOError.html#G-IO-ERROR:CAPS" title="G_IO_ERROR"><span class="type">G_IO_ERROR</span></a>).</p></td>
1589 <td class="parameter_annotations"> </td>
1590 </tr>
1591 <tr>
1592 <td class="parameter_name"><p>code</p></td>
1593 <td class="parameter_description"><p>a specific error code.</p></td>
1594 <td class="parameter_annotations"> </td>
1595 </tr>
1596 <tr>
1597 <td class="parameter_name"><p>format</p></td>
1598 <td class="parameter_description"><p>a formatted error reporting string.</p></td>
1599 <td class="parameter_annotations"> </td>
1600 </tr>
1601 <tr>
1602 <td class="parameter_name"><p>...</p></td>
1603 <td class="parameter_description"><p>a list of variables to fill in <em class="parameter"><code>format</code></em>
1604 .</p></td>
1605 <td class="parameter_annotations"> </td>
1606 </tr>
1607 </tbody>
1608 </table></div>
1609 </div>
1610 </div>
1611 <hr>
1612 <div class="refsect2">
1613 <a name="g-simple-async-report-gerror-in-idle"></a><h3>g_simple_async_report_gerror_in_idle ()</h3>
1614 <pre class="programlisting"><span class="returnvalue">void</span>
1615 g_simple_async_report_gerror_in_idle (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *object</code></em>,
1616                                       <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1617                                       <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
1618                                       <em class="parameter"><code>const <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1619 <div class="warning">
1620 <p><code class="literal">g_simple_async_report_gerror_in_idle</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1621 <p>Use <a class="link" href="GTask.html#g-task-report-error" title="g_task_report_error ()"><code class="function">g_task_report_error()</code></a>.</p>
1622 </div>
1623 <p>Reports an error in an idle function. Similar to
1624 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-report-error-in-idle" title="g_simple_async_report_error_in_idle ()"><code class="function">g_simple_async_report_error_in_idle()</code></a>, but takes a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> rather
1625 than building a new one.</p>
1626 <div class="refsect3">
1627 <a name="g-simple-async-report-gerror-in-idle.parameters"></a><h4>Parameters</h4>
1628 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1629 <colgroup>
1630 <col width="150px" class="parameters_name">
1631 <col class="parameters_description">
1632 <col width="200px" class="parameters_annotations">
1633 </colgroup>
1634 <tbody>
1635 <tr>
1636 <td class="parameter_name"><p>object</p></td>
1637 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
1638 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1639 </tr>
1640 <tr>
1641 <td class="parameter_name"><p>callback</p></td>
1642 <td class="parameter_description"><p> a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>. </p></td>
1643 <td class="parameter_annotations"><span class="annotation">[<acronym title="The callback is valid until first called."><span class="acronym">scope async</span></acronym>]</span></td>
1644 </tr>
1645 <tr>
1646 <td class="parameter_name"><p>user_data</p></td>
1647 <td class="parameter_description"><p> user data passed to <em class="parameter"><code>callback</code></em>
1648 . </p></td>
1649 <td class="parameter_annotations"><span class="annotation">[<acronym title="This parameter is a 'user_data', for callbacks; many bindings can pass NULL here."><span class="acronym">closure</span></acronym>]</span></td>
1650 </tr>
1651 <tr>
1652 <td class="parameter_name"><p>error</p></td>
1653 <td class="parameter_description"><p>the <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> to report</p></td>
1654 <td class="parameter_annotations"> </td>
1655 </tr>
1656 </tbody>
1657 </table></div>
1658 </div>
1659 </div>
1660 <hr>
1661 <div class="refsect2">
1662 <a name="g-simple-async-report-take-gerror-in-idle"></a><h3>g_simple_async_report_take_gerror_in_idle ()</h3>
1663 <pre class="programlisting"><span class="returnvalue">void</span>
1664 g_simple_async_report_take_gerror_in_idle
1665                                (<em class="parameter"><code><a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a> *object</code></em>,
1666                                 <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
1667                                 <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
1668                                 <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> *error</code></em>);</pre>
1669 <div class="warning">
1670 <p><code class="literal">g_simple_async_report_take_gerror_in_idle</code> has been deprecated since version 2.46 and should not be used in newly-written code.</p>
1671 <p>Use <a class="link" href="GTask.html#g-task-report-error" title="g_task_report_error ()"><code class="function">g_task_report_error()</code></a>.</p>
1672 </div>
1673 <p>Reports an error in an idle function. Similar to
1674 <a class="link" href="GSimpleAsyncResult.html#g-simple-async-report-gerror-in-idle" title="g_simple_async_report_gerror_in_idle ()"><code class="function">g_simple_async_report_gerror_in_idle()</code></a>, but takes over the caller's
1675 ownership of <em class="parameter"><code>error</code></em>
1676 , so the caller does not have to free it any more.</p>
1677 <p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
1678 <div class="refsect3">
1679 <a name="g-simple-async-report-take-gerror-in-idle.parameters"></a><h4>Parameters</h4>
1680 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1681 <colgroup>
1682 <col width="150px" class="parameters_name">
1683 <col class="parameters_description">
1684 <col width="200px" class="parameters_annotations">
1685 </colgroup>
1686 <tbody>
1687 <tr>
1688 <td class="parameter_name"><p>object</p></td>
1689 <td class="parameter_description"><p> a <a href="../gobject-The-Base-Object-Type.html#GObject-struct"><span class="type">GObject</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
1690 <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
1691 </tr>
1692 <tr>
1693 <td class="parameter_name"><p>callback</p></td>
1694 <td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a>.</p></td>
1695 <td class="parameter_annotations"> </td>
1696 </tr>
1697 <tr>
1698 <td class="parameter_name"><p>user_data</p></td>
1699 <td class="parameter_description"><p>user data passed to <em class="parameter"><code>callback</code></em>
1700 .</p></td>
1701 <td class="parameter_annotations"> </td>
1702 </tr>
1703 <tr>
1704 <td class="parameter_name"><p>error</p></td>
1705 <td class="parameter_description"><p>the <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> to report</p></td>
1706 <td class="parameter_annotations"> </td>
1707 </tr>
1708 </tbody>
1709 </table></div>
1710 </div>
1711 <p class="since">Since: <a class="link" href="api-index-2-28.html#api-index-2.28">2.28</a></p>
1712 </div>
1713 </div>
1714 <div class="refsect1">
1715 <a name="GSimpleAsyncResult.other_details"></a><h2>Types and Values</h2>
1716 <div class="refsect2">
1717 <a name="GSimpleAsyncResult-struct"></a><h3>GSimpleAsyncResult</h3>
1718 <pre class="programlisting">typedef struct _GSimpleAsyncResult GSimpleAsyncResult;</pre>
1719 <p>A simple implementation of <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</p>
1720 </div>
1721 </div>
1722 <div class="refsect1">
1723 <a name="GSimpleAsyncResult.see-also"></a><h2>See Also</h2>
1724 <p><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>, <a class="link" href="GTask.html" title="GTask"><span class="type">GTask</span></a></p>
1725 </div>
1726 </div>
1727 <div class="footer">
1728 <hr>Generated by GTK-Doc V1.25.1</div>
1729 </body>
1730 </html>