Include "config.h" instead of <config.h> Command used: find -name
[platform/upstream/glib.git] / gio / gsimpleasyncresult.c
1 /* GIO - GLib Input, Output and Streaming Library
2  * 
3  * Copyright (C) 2006-2007 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: Alexander Larsson <alexl@redhat.com>
21  */
22
23 #include "config.h"
24
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <string.h>
28 #include <errno.h>
29 #include <fcntl.h>
30 #ifdef HAVE_UNISTD_H
31 #include <unistd.h>
32 #endif
33
34 #include "gsimpleasyncresult.h"
35 #include "gioscheduler.h"
36 #include <gio/gioerror.h>
37 #include "glibintl.h"
38
39 #include "gioalias.h"
40
41 /**
42  * SECTION:gsimpleasyncresult
43  * @short_description: Simple asynchronous results implementation
44  * @include: gio/gio.h
45  * @see_also: #GAsyncResult
46  *
47  * Implements #GAsyncResult for simple cases. Most of the time, this 
48  * will be all an application needs, and will be used transparently. 
49  * Because of this, #GSimpleAsyncResult is used throughout GIO for 
50  * handling asynchronous functions. 
51  * 
52  * GSimpleAsyncResult handles #GAsyncReadyCallback<!-- -->s, error 
53  * reporting, operation cancellation and the final state of an operation, 
54  * completely transparent to the application. Results can be returned 
55  * as a pointer e.g. for functions that return data that is collected 
56  * asynchronously, a boolean value for checking the success or failure 
57  * of an operation, or a #gssize for operations which return the number 
58  * of bytes modified by the operation; all of the simple return cases 
59  * are covered.
60  * 
61  * Most of the time, an application will not need to know of the details 
62  * of this API; it is handled transparently, and any necessary operations 
63  * are handled by #GAsyncResult's interface. However, if implementing a 
64  * new GIO module, for writing language bindings, or for complex 
65  * applications that need better control of how asynchronous operations 
66  * are completed, it is important to understand this functionality.
67  * 
68  * GSimpleAsyncResults are tagged with the calling function to ensure 
69  * that asynchronous functions and their finishing functions are used 
70  * together correctly.
71  * 
72  * To create a new #GSimpleAsyncResult, call g_simple_async_result_new(). 
73  * If the result needs to be created for a #GError, use 
74  * g_simple_async_result_new_from_error(). If a #GError is not available 
75  * (e.g. the asynchronous operation's doesn't take a #GError argument), 
76  * but the result still needs to be created for an error condition, use
77  * g_simple_async_result_new_error() (or g_simple_async_result_set_error_va()
78  * if your application or binding requires passing a variable argument list 
79  * directly), and the error can then be propegated through the use of 
80  * g_simple_async_result_propagate_error().
81  * 
82  * An asynchronous operation can be made to ignore a cancellation event by 
83  * calling g_simple_async_result_set_handle_cancellation() with a 
84  * #GSimpleAsyncResult for the operation and %FALSE. 
85  * 
86  * GSimpleAsyncResult can integrate into GLib's event loop, #GMainLoop, 
87  * or it can use #GThread<!-- -->s if available. 
88  * g_simple_async_result_complete() will finish an I/O task directly within 
89  * the main event loop. g_simple_async_result_complete_in_idle() will 
90  * integrate the I/O task into the main event loop as an idle function and 
91  * g_simple_async_result_run_in_thread() will run the job in a separate 
92  * thread.
93  * 
94  * To set the results of an asynchronous function, 
95  * g_simple_async_result_set_op_res_gpointer(), 
96  * g_simple_async_result_set_op_res_gboolean(), and 
97  * g_simple_async_result_set_op_res_gssize()
98  * are provided, setting the operation's result to a gpointer, gboolean, or 
99  * gssize, respectively.
100  * 
101  * Likewise, to get the result of an asynchronous function, 
102  * g_simple_async_result_get_op_res_gpointer(),
103  * g_simple_async_result_get_op_res_gboolean(), and 
104  * g_simple_async_result_get_op_res_gssize() are 
105  * provided, getting the operation's result as a gpointer, gboolean, and 
106  * gssize, respectively.
107  **/
108
109 static void g_simple_async_result_async_result_iface_init (GAsyncResultIface       *iface);
110
111 struct _GSimpleAsyncResult
112 {
113   GObject parent_instance;
114
115   GObject *source_object;
116   GAsyncReadyCallback callback;
117   gpointer user_data;
118   GError *error;
119   gboolean failed;
120   gboolean handle_cancellation;
121
122   gpointer source_tag;
123
124   union {
125     gpointer v_pointer;
126     gboolean v_boolean;
127     gssize   v_ssize;
128   } op_res;
129
130   GDestroyNotify destroy_op_res;
131 };
132
133 struct _GSimpleAsyncResultClass
134 {
135   GObjectClass parent_class;
136 };
137
138
139 G_DEFINE_TYPE_WITH_CODE (GSimpleAsyncResult, g_simple_async_result, G_TYPE_OBJECT,
140                          G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_RESULT,
141                                                 g_simple_async_result_async_result_iface_init))
142
143 static void
144 g_simple_async_result_finalize (GObject *object)
145 {
146   GSimpleAsyncResult *simple;
147
148   simple = G_SIMPLE_ASYNC_RESULT (object);
149
150   if (simple->source_object)
151     g_object_unref (simple->source_object);
152
153   if (simple->destroy_op_res)
154     simple->destroy_op_res (simple->op_res.v_pointer);
155
156   if (simple->error)
157     g_error_free (simple->error);
158
159   G_OBJECT_CLASS (g_simple_async_result_parent_class)->finalize (object);
160 }
161
162 static void
163 g_simple_async_result_class_init (GSimpleAsyncResultClass *klass)
164 {
165   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
166   
167   gobject_class->finalize = g_simple_async_result_finalize;
168 }
169
170 static void
171 g_simple_async_result_init (GSimpleAsyncResult *simple)
172 {
173   simple->handle_cancellation = TRUE;
174 }
175
176 /**
177  * g_simple_async_result_new:
178  * @source_object: a #GObject the asynchronous function was called with.
179  * @callback: a #GAsyncReadyCallback.
180  * @user_data: user data passed to @callback.
181  * @source_tag: the asynchronous function.
182  * 
183  * Creates a #GSimpleAsyncResult.
184  * 
185  * Returns: a #GSimpleAsyncResult.
186  **/
187 GSimpleAsyncResult *
188 g_simple_async_result_new (GObject             *source_object,
189                            GAsyncReadyCallback  callback,
190                            gpointer             user_data,
191                            gpointer             source_tag)
192 {
193   GSimpleAsyncResult *simple;
194
195   g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
196
197   simple = g_object_new (G_TYPE_SIMPLE_ASYNC_RESULT, NULL);
198   simple->callback = callback;
199   simple->source_object = g_object_ref (source_object);
200   simple->user_data = user_data;
201   simple->source_tag = source_tag;
202   
203   return simple;
204 }
205
206 /**
207  * g_simple_async_result_new_from_error:
208  * @source_object: a #GObject.
209  * @callback: a #GAsyncReadyCallback.
210  * @user_data: user data passed to @callback.
211  * @error: a #GError location.
212  * 
213  * Creates a #GSimpleAsyncResult from an error condition.
214  * 
215  * Returns: a #GSimpleAsyncResult.
216  **/
217 GSimpleAsyncResult *
218 g_simple_async_result_new_from_error (GObject             *source_object,
219                                       GAsyncReadyCallback  callback,
220                                       gpointer             user_data,
221                                       GError              *error)
222 {
223   GSimpleAsyncResult *simple;
224
225   g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
226
227   simple = g_simple_async_result_new (source_object,
228                                       callback,
229                                       user_data, NULL);
230   g_simple_async_result_set_from_error (simple, error);
231
232   return simple;
233 }
234
235 /**
236  * g_simple_async_result_new_error:
237  * @source_object: a #GObject.
238  * @callback: a #GAsyncReadyCallback. 
239  * @user_data: user data passed to @callback.
240  * @domain: a #GQuark.
241  * @code: an error code.
242  * @format: a string with format characters.
243  * @...: a list of values to insert into @format.
244  * 
245  * Creates a new #GSimpleAsyncResult with a set error.
246  * 
247  * Returns: a #GSimpleAsyncResult.
248  **/
249 GSimpleAsyncResult *
250 g_simple_async_result_new_error (GObject             *source_object,
251                                  GAsyncReadyCallback  callback,
252                                  gpointer             user_data,
253                                  GQuark               domain,
254                                  gint                 code,
255                                  const char          *format,
256                                  ...)
257 {
258   GSimpleAsyncResult *simple;
259   va_list args;
260   
261   g_return_val_if_fail (G_IS_OBJECT (source_object), NULL);
262   g_return_val_if_fail (domain != 0, NULL);
263   g_return_val_if_fail (format != NULL, NULL);
264
265   simple = g_simple_async_result_new (source_object,
266                                       callback,
267                                       user_data, NULL);
268
269   va_start (args, format);
270   g_simple_async_result_set_error_va (simple, domain, code, format, args);
271   va_end (args);
272   
273   return simple;
274 }
275
276
277 static gpointer
278 g_simple_async_result_get_user_data (GAsyncResult *res)
279 {
280   return G_SIMPLE_ASYNC_RESULT (res)->user_data;
281 }
282
283 static GObject *
284 g_simple_async_result_get_source_object (GAsyncResult *res)
285 {
286   if (G_SIMPLE_ASYNC_RESULT (res)->source_object)
287     return g_object_ref (G_SIMPLE_ASYNC_RESULT (res)->source_object);
288   return NULL;
289 }
290
291 static void
292 g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface)
293 {
294   iface->get_user_data = g_simple_async_result_get_user_data;
295   iface->get_source_object = g_simple_async_result_get_source_object;
296 }
297
298 /**
299  * g_simple_async_result_set_handle_cancellation:
300  * @simple: a #GSimpleAsyncResult.
301  * @handle_cancellation: a #gboolean.
302  * 
303  * Sets whether to handle cancellation within the asynchronous operation.
304  * 
305  **/
306 void
307 g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
308                                                gboolean            handle_cancellation)
309 {
310   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
311   simple->handle_cancellation = handle_cancellation;
312 }
313
314 /**
315  * g_simple_async_result_get_source_tag:
316  * @simple: a #GSimpleAsyncResult.
317  * 
318  * Gets the source tag for the #GSimpleAsyncResult.
319  * 
320  * Returns: a #gpointer to the source object for the #GSimpleAsyncResult.
321  **/
322 gpointer
323 g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
324 {
325   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL);
326   return simple->source_tag;
327 }
328
329 /**
330  * g_simple_async_result_propagate_error:
331  * @simple: a #GSimpleAsyncResult.
332  * @dest: a location to propegate the error to.
333  * 
334  * Propagates an error from within the simple asynchronous result to
335  * a given destination.
336  * 
337  * Returns: %TRUE if the error was propegated to @dest. %FALSE otherwise.
338  **/
339 gboolean
340 g_simple_async_result_propagate_error (GSimpleAsyncResult  *simple,
341                                        GError             **dest)
342 {
343   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
344
345   if (simple->failed)
346     {
347       g_propagate_error (dest, simple->error);
348       simple->error = NULL;
349       return TRUE;
350     }
351
352   return FALSE;
353 }
354
355 /**
356  * g_simple_async_result_set_op_res_gpointer:
357  * @simple: a #GSimpleAsyncResult.
358  * @op_res: a pointer result from an asynchronous function.
359  * @destroy_op_res: a #GDestroyNotify function.
360  * 
361  * Sets the operation result within the asynchronous result to a pointer.
362  **/
363 void
364 g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
365                                            gpointer            op_res,
366                                            GDestroyNotify      destroy_op_res)
367 {
368   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
369
370   simple->op_res.v_pointer = op_res;
371   simple->destroy_op_res = destroy_op_res;
372 }
373
374 /**
375  * g_simple_async_result_get_op_res_gpointer:
376  * @simple: a #GSimpleAsyncResult.
377  * 
378  * Gets a pointer result as returned by the asynchronous function.
379  * 
380  * Returns: a pointer from the result.
381  **/
382 gpointer
383 g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
384 {
385   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL);
386   return simple->op_res.v_pointer;
387 }
388
389 /**
390  * g_simple_async_result_set_op_res_gssize:
391  * @simple: a #GSimpleAsyncResult.
392  * @op_res: a #gssize.
393  * 
394  * Sets the operation result within the asynchronous result to 
395  * the given @op_res. 
396  **/
397 void
398 g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
399                                          gssize              op_res)
400 {
401   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
402   simple->op_res.v_ssize = op_res;
403 }
404
405 /**
406  * g_simple_async_result_get_op_res_gssize:
407  * @simple: a #GSimpleAsyncResult.
408  * 
409  * Gets a gssize from the asynchronous result.
410  * 
411  * Returns: a gssize returned from the asynchronous function.
412  **/
413 gssize
414 g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
415 {
416   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), 0);
417   return simple->op_res.v_ssize;
418 }
419
420 /**
421  * g_simple_async_result_set_op_res_gboolean:
422  * @simple: a #GSimpleAsyncResult.
423  * @op_res: a #gboolean.
424  * 
425  * Sets the operation result to a boolean within the asynchronous result.
426  **/
427 void
428 g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
429                                            gboolean            op_res)
430 {
431   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
432   simple->op_res.v_boolean = !!op_res;
433 }
434
435 /**
436  * g_simple_async_result_get_op_res_gboolean:
437  * @simple: a #GSimpleAsyncResult.
438  * 
439  * Gets the operation result boolean from within the asynchronous result.
440  * 
441  * Returns: %TRUE if the operation's result was %TRUE, %FALSE 
442  *     if the operation's result was %FALSE. 
443  **/
444 gboolean
445 g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
446 {
447   g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
448   return simple->op_res.v_boolean;
449 }
450
451 /**
452  * g_simple_async_result_set_from_error:
453  * @simple: a #GSimpleAsyncResult.
454  * @error: #GError.
455  * 
456  * Sets the result from a #GError. 
457  **/
458 void
459 g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
460                                       GError             *error)
461 {
462   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
463   g_return_if_fail (error != NULL);
464
465   simple->error = g_error_copy (error);
466   simple->failed = TRUE;
467 }
468
469 static GError* 
470 _g_error_new_valist (GQuark     domain,
471                     gint        code,
472                     const char *format,
473                     va_list     args)
474 {
475   GError *error;
476   char *message;
477
478   message = g_strdup_vprintf (format, args);
479
480   error = g_error_new_literal (domain, code, message);
481   g_free (message);
482   
483   return error;
484 }
485
486 /**
487  * g_simple_async_result_set_error_va:
488  * @simple: a #GSimpleAsyncResult.
489  * @domain: a #GQuark (usually #G_IO_ERROR).
490  * @code: an error code.
491  * @format: a formatted error reporting string.
492  * @args: va_list of arguments. 
493  * 
494  * Sets an error within the asynchronous result without a #GError. 
495  * Unless writing a binding, see g_simple_async_result_set_error().
496  **/
497 void
498 g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
499                                     GQuark              domain,
500                                     gint                code,
501                                     const char         *format,
502                                     va_list             args)
503 {
504   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
505   g_return_if_fail (domain != 0);
506   g_return_if_fail (format != NULL);
507
508   simple->error = _g_error_new_valist (domain, code, format, args);
509   simple->failed = TRUE;
510 }
511
512 /**
513  * g_simple_async_result_set_error:
514  * @simple: a #GSimpleAsyncResult.
515  * @domain: a #GQuark (usually #G_IO_ERROR).
516  * @code: an error code.
517  * @format: a formatted error reporting string.
518  * @...: a list of variables to fill in @format.
519  * 
520  * Sets an error within the asynchronous result without a #GError.
521  **/
522 void
523 g_simple_async_result_set_error (GSimpleAsyncResult *simple,
524                                  GQuark              domain,
525                                  gint                code,
526                                  const char         *format,
527                                  ...)
528 {
529   va_list args;
530
531   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
532   g_return_if_fail (domain != 0);
533   g_return_if_fail (format != NULL);
534
535   va_start (args, format);
536   g_simple_async_result_set_error_va (simple, domain, code, format, args);
537   va_end (args);
538 }
539
540 /**
541  * g_simple_async_result_complete:
542  * @simple: a #GSimpleAsyncResult.
543  * 
544  * Completes an asynchronous I/O job.
545  **/
546 void
547 g_simple_async_result_complete (GSimpleAsyncResult *simple)
548 {
549   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
550
551   if (simple->callback)
552     simple->callback (simple->source_object,
553                       G_ASYNC_RESULT (simple),
554                       simple->user_data);
555 }
556
557 static gboolean
558 complete_in_idle_cb (gpointer data)
559 {
560   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (data);
561
562   g_simple_async_result_complete (simple);
563
564   return FALSE;
565 }
566
567 /**
568  * g_simple_async_result_complete_in_idle:
569  * @simple: a #GSimpleAsyncResult.
570  * 
571  * Completes an asynchronous function in the main event loop using 
572  * an idle function.
573  **/
574 void
575 g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
576 {
577   GSource *source;
578   guint id;
579   
580   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
581   
582   g_object_ref (simple);
583   
584   source = g_idle_source_new ();
585   g_source_set_priority (source, G_PRIORITY_DEFAULT);
586   g_source_set_callback (source, complete_in_idle_cb, simple, g_object_unref);
587
588   id = g_source_attach (source, NULL);
589   g_source_unref (source);
590 }
591
592 typedef struct {
593   GSimpleAsyncResult *simple;
594   GSimpleAsyncThreadFunc func;
595 } RunInThreadData;
596
597 static gboolean
598 run_in_thread (GIOSchedulerJob *job,
599                GCancellable    *c,
600                gpointer         _data)
601 {
602   RunInThreadData *data = _data;
603   GSimpleAsyncResult *simple = data->simple;
604
605   if (simple->handle_cancellation &&
606       g_cancellable_is_cancelled (c))
607     g_simple_async_result_set_error (simple,
608                                      G_IO_ERROR,
609                                      G_IO_ERROR_CANCELLED,
610                                      _("Operation was cancelled"));
611   else
612     data->func (simple,
613                 simple->source_object,
614                 c);
615
616   g_simple_async_result_complete_in_idle (data->simple);
617   g_object_unref (data->simple);
618   g_free (data);
619
620   return FALSE;
621 }
622
623 /**
624  * g_simple_async_result_run_in_thread:
625  * @simple: a #GSimpleAsyncResult.
626  * @func: a #GSimpleAsyncThreadFunc.
627  * @io_priority: the io priority of the request.
628  * @cancellable: optional #GCancellable object, %NULL to ignore. 
629  * 
630  * Runs the asynchronous job in a separated thread.
631  **/
632 void
633 g_simple_async_result_run_in_thread (GSimpleAsyncResult     *simple,
634                                      GSimpleAsyncThreadFunc  func,
635                                      int                     io_priority, 
636                                      GCancellable           *cancellable)
637 {
638   RunInThreadData *data;
639   
640   g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
641   g_return_if_fail (func != NULL);
642
643   data = g_new (RunInThreadData, 1);
644   data->func = func;
645   data->simple = g_object_ref (simple);
646   g_io_scheduler_push_job (run_in_thread, data, NULL, io_priority, cancellable);
647 }
648
649 /**
650  * g_simple_async_report_error_in_idle:
651  * @object: a #GObject.
652  * @callback: a #GAsyncReadyCallback. 
653  * @user_data: user data passed to @callback.
654  * @domain: a #GQuark containing the error domain (usually #G_IO_ERROR).
655  * @code: a specific error code.
656  * @format: a formatted error reporting string.
657  * @...: a list of variables to fill in @format.
658  * 
659  * Reports an error in an asynchronous function in an idle function by 
660  * directly setting the contents of the #GAsyncResult with the given error
661  * information.
662  **/
663 void
664 g_simple_async_report_error_in_idle (GObject             *object,
665                                      GAsyncReadyCallback  callback,
666                                      gpointer             user_data,
667                                      GQuark               domain,
668                                      gint                 code,
669                                      const char          *format,
670                                      ...)
671 {
672   GSimpleAsyncResult *simple;
673   va_list args;
674   
675   g_return_if_fail (G_IS_OBJECT (object));
676   g_return_if_fail (domain != 0);
677   g_return_if_fail (format != NULL);
678
679   simple = g_simple_async_result_new (object,
680                                       callback,
681                                       user_data, NULL);
682
683   va_start (args, format);
684   g_simple_async_result_set_error_va (simple, domain, code, format, args);
685   va_end (args);
686   g_simple_async_result_complete_in_idle (simple);
687   g_object_unref (simple);
688 }
689
690 /**
691  * g_simple_async_report_gerror_in_idle:
692  * @object: a #GObject.
693  * @callback: a #GAsyncReadyCallback. 
694  * @user_data: user data passed to @callback.
695  * @error: the #GError to report
696  * 
697  * Reports an error in an idle function. Similar to 
698  * g_simple_async_report_error_in_idle(), but takes a #GError rather 
699  * than building a new one.
700  **/
701 void
702 g_simple_async_report_gerror_in_idle (GObject *object,
703                                       GAsyncReadyCallback callback,
704                                       gpointer user_data,
705                                       GError *error)
706 {
707   GSimpleAsyncResult *simple;
708   
709   g_return_if_fail (G_IS_OBJECT (object));
710   g_return_if_fail (error != NULL);
711
712   simple = g_simple_async_result_new_from_error (object,
713                                                  callback,
714                                                  user_data,
715                                                  error);
716   g_simple_async_result_complete_in_idle (simple);
717   g_object_unref (simple);
718 }
719
720 #define __G_SIMPLE_ASYNC_RESULT_C__
721 #include "gioaliasdef.c"