Doc fixes
[platform/upstream/glib.git] / gio / gfileenumerator.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 #include "gfileenumerator.h"
25 #include "gioscheduler.h"
26 #include "gasynchelper.h"
27 #include "gsimpleasyncresult.h"
28 #include "glibintl.h"
29
30 #include "gioalias.h"
31
32 /**
33  * SECTION:gfileenumerator
34  * @short_description: Enumerated Files Routines
35  * @include: gio/gio.h
36  * 
37  * #GFileEnumerator allows you to operate on a set of #GFile<!-- -->s, 
38  * returning a #GFileInfo structure for each file enumerated (e.g. 
39  * g_file_enumerate_children() will return a #GFileEnumerator for each 
40  * of the children within a directory).
41  *
42  * To get the next file's information from a #GFileEnumerator, use 
43  * g_file_enumerator_next_file() or its asynchronous version, 
44  * g_file_enumerator_next_file_async(). Note that the asynchronous 
45  * version will return a list of #GFileInfo<!---->s, whereas the 
46  * synchronous will only return the next file in the enumerator.
47  *
48  * To close a #GFileEnumerator, use g_file_enumerator_close(), or 
49  * its asynchronous version, g_file_enumerator_close_async(). Once 
50  * a #GFileEnumerator is closed, no further actions may be performed 
51  * on it, and it should be freed with g_object_unref().
52  * 
53  **/ 
54
55 G_DEFINE_TYPE (GFileEnumerator, g_file_enumerator, G_TYPE_OBJECT);
56
57 struct _GFileEnumeratorPrivate {
58   /* TODO: Should be public for subclasses? */
59   guint closed : 1;
60   guint pending : 1;
61   GAsyncReadyCallback outstanding_callback;
62   GError *outstanding_error;
63 };
64
65 static void     g_file_enumerator_real_next_files_async  (GFileEnumerator      *enumerator,
66                                                           int                   num_files,
67                                                           int                   io_priority,
68                                                           GCancellable         *cancellable,
69                                                           GAsyncReadyCallback   callback,
70                                                           gpointer              user_data);
71 static GList *  g_file_enumerator_real_next_files_finish (GFileEnumerator      *enumerator,
72                                                           GAsyncResult         *res,
73                                                           GError              **error);
74 static void     g_file_enumerator_real_close_async       (GFileEnumerator      *enumerator,
75                                                           int                   io_priority,
76                                                           GCancellable         *cancellable,
77                                                           GAsyncReadyCallback   callback,
78                                                           gpointer              user_data);
79 static gboolean g_file_enumerator_real_close_finish      (GFileEnumerator      *enumerator,
80                                                           GAsyncResult         *res,
81                                                           GError              **error);
82
83 static void
84 g_file_enumerator_finalize (GObject *object)
85 {
86   GFileEnumerator *enumerator;
87
88   enumerator = G_FILE_ENUMERATOR (object);
89   
90   if (!enumerator->priv->closed)
91     g_file_enumerator_close (enumerator, NULL, NULL);
92
93   if (G_OBJECT_CLASS (g_file_enumerator_parent_class)->finalize)
94     (*G_OBJECT_CLASS (g_file_enumerator_parent_class)->finalize) (object);
95 }
96
97 static void
98 g_file_enumerator_class_init (GFileEnumeratorClass *klass)
99 {
100   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
101   
102   g_type_class_add_private (klass, sizeof (GFileEnumeratorPrivate));
103   
104   gobject_class->finalize = g_file_enumerator_finalize;
105
106   klass->next_files_async = g_file_enumerator_real_next_files_async;
107   klass->next_files_finish = g_file_enumerator_real_next_files_finish;
108   klass->close_async = g_file_enumerator_real_close_async;
109   klass->close_finish = g_file_enumerator_real_close_finish;
110 }
111
112 static void
113 g_file_enumerator_init (GFileEnumerator *enumerator)
114 {
115   enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator,
116                                                   G_TYPE_FILE_ENUMERATOR,
117                                                   GFileEnumeratorPrivate);
118 }
119
120 /**
121  * g_file_enumerator_next_file:
122  * @enumerator: a #GFileEnumerator.
123  * @cancellable: optional #GCancellable object, %NULL to ignore.
124  * @error: location to store the error occuring, or %NULL to ignore
125  *
126  * Returns information for the next file in the enumerated object.
127  * Will block until the information is available. The #GFileInfo 
128  * returned from this function will contain attributes that match the 
129  * attribute string that was passed when the #GFileEnumerator was created.
130  *
131  * On error, returns %NULL and sets @error to the error. If the
132  * enumerator is at the end, %NULL will be returned and @error will
133  * be unset.
134  *
135  * Return value: A #GFileInfo or %NULL on error or end of enumerator
136  **/
137 GFileInfo *
138 g_file_enumerator_next_file (GFileEnumerator *enumerator,
139                              GCancellable *cancellable,
140                              GError **error)
141 {
142   GFileEnumeratorClass *class;
143   GFileInfo *info;
144   
145   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), NULL);
146   g_return_val_if_fail (enumerator != NULL, NULL);
147   
148   if (enumerator->priv->closed)
149     {
150       g_set_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED,
151                    _("Enumerator is closed"));
152       return NULL;
153     }
154
155   if (enumerator->priv->pending)
156     {
157       g_set_error (error, G_IO_ERROR, G_IO_ERROR_PENDING,
158                    _("File enumerator has outstanding operation"));
159       return NULL;
160     }
161
162   if (enumerator->priv->outstanding_error)
163     {
164       g_propagate_error (error, enumerator->priv->outstanding_error);
165       enumerator->priv->outstanding_error = NULL;
166       return NULL;
167     }
168   
169   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
170
171   if (cancellable)
172     g_cancellable_push_current (cancellable);
173   
174   enumerator->priv->pending = TRUE;
175   info = (* class->next_file) (enumerator, cancellable, error);
176   enumerator->priv->pending = FALSE;
177
178   if (cancellable)
179     g_cancellable_pop_current (cancellable);
180   
181   return info;
182 }
183   
184 /**
185  * g_file_enumerator_close:
186  * @enumerator: a #GFileEnumerator.
187  * @cancellable: optional #GCancellable object, %NULL to ignore. 
188  * @error: location to store the error occuring, or %NULL to ignore
189  *
190  * Releases all resources used by this enumerator, making the
191  * enumerator return %G_IO_ERROR_CLOSED on all calls.
192  *
193  * This will be automatically called when the last reference
194  * is dropped, but you might want to call this function to make 
195  * sure resources are released as early as possible.
196  *
197  * Return value: #TRUE on success or #FALSE on error.
198  **/
199 gboolean
200 g_file_enumerator_close (GFileEnumerator  *enumerator,
201                          GCancellable     *cancellable,
202                          GError          **error)
203 {
204   GFileEnumeratorClass *class;
205
206   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), FALSE);
207   g_return_val_if_fail (enumerator != NULL, FALSE);
208   
209   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
210
211   if (enumerator->priv->closed)
212     return TRUE;
213   
214   if (enumerator->priv->pending)
215     {
216       g_set_error (error, G_IO_ERROR, G_IO_ERROR_PENDING,
217                    _("File enumerator has outstanding operation"));
218       return FALSE;
219     }
220
221   if (cancellable)
222     g_cancellable_push_current (cancellable);
223   
224   enumerator->priv->pending = TRUE;
225   (* class->close_fn) (enumerator, cancellable, error);
226   enumerator->priv->pending = FALSE;
227   enumerator->priv->closed = TRUE;
228
229   if (cancellable)
230     g_cancellable_pop_current (cancellable);
231   
232   return TRUE;
233 }
234
235 static void
236 next_async_callback_wrapper (GObject      *source_object,
237                              GAsyncResult *res,
238                              gpointer      user_data)
239 {
240   GFileEnumerator *enumerator = G_FILE_ENUMERATOR (source_object);
241
242   enumerator->priv->pending = FALSE;
243   if (enumerator->priv->outstanding_callback)
244     (*enumerator->priv->outstanding_callback) (source_object, res, user_data);
245   g_object_unref (enumerator);
246 }
247
248 /**
249  * g_file_enumerator_next_files_async:
250  * @enumerator: a #GFileEnumerator.
251  * @num_files: the number of file info objects to request
252  * @io_priority: the <link linkend="gioscheduler">io priority</link> 
253  *     of the request. 
254  * @cancellable: optional #GCancellable object, %NULL to ignore.
255  * @callback: a #GAsyncReadyCallback to call when the request is satisfied
256  * @user_data: the data to pass to callback function
257  *
258  * Request information for a number of files from the enumerator asynchronously.
259  * When all i/o for the operation is finished the @callback will be called with
260  * the requested information. 
261  *
262  * The callback can be called with less than @num_files files in case of error
263  * or at the end of the enumerator. In case of a partial error the callback will
264  * be called with any succeeding items and no error, and on the next request the
265  * error will be reported. If a request is cancelled the callback will be called
266  * with %G_IO_ERROR_CANCELLED.
267  *
268  * During an async request no other sync and async calls are allowed, and will
269  * result in %G_IO_ERROR_PENDING errors. 
270  *
271  * Any outstanding i/o request with higher priority (lower numerical value) will
272  * be executed before an outstanding request with lower priority. Default
273  * priority is %G_PRIORITY_DEFAULT.
274  **/
275 void
276 g_file_enumerator_next_files_async (GFileEnumerator     *enumerator,
277                                     int                  num_files,
278                                     int                  io_priority,
279                                     GCancellable        *cancellable,
280                                     GAsyncReadyCallback  callback,
281                                     gpointer             user_data)
282 {
283   GFileEnumeratorClass *class;
284   GSimpleAsyncResult *simple;
285
286   g_return_if_fail (G_IS_FILE_ENUMERATOR (enumerator));
287   g_return_if_fail (enumerator != NULL);
288   g_return_if_fail (num_files >= 0);
289
290   if (num_files == 0)
291     {
292       simple = g_simple_async_result_new (G_OBJECT (enumerator),
293                                           callback,
294                                           user_data,
295                                           g_file_enumerator_next_files_async);
296       g_simple_async_result_complete_in_idle (simple);
297       g_object_unref (simple);
298       return;
299     }
300   
301   if (enumerator->priv->closed)
302     {
303       g_simple_async_report_error_in_idle (G_OBJECT (enumerator),
304                                            callback,
305                                            user_data,
306                                            G_IO_ERROR, G_IO_ERROR_CLOSED,
307                                            _("File enumerator is already closed"));
308       return;
309     }
310   
311   if (enumerator->priv->pending)
312     {
313       g_simple_async_report_error_in_idle (G_OBJECT (enumerator),
314                                            callback,
315                                            user_data,
316                                            G_IO_ERROR, G_IO_ERROR_PENDING,
317                                            _("File enumerator has outstanding operation"));
318       return;
319     }
320
321   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
322   
323   enumerator->priv->pending = TRUE;
324   enumerator->priv->outstanding_callback = callback;
325   g_object_ref (enumerator);
326   (* class->next_files_async) (enumerator, num_files, io_priority, cancellable, 
327                                next_async_callback_wrapper, user_data);
328 }
329
330 /**
331  * g_file_enumerator_next_files_finish:
332  * @enumerator: a #GFileEnumerator.
333  * @result: a #GAsyncResult.
334  * @error: a #GError location to store the error occuring, or %NULL to 
335  * ignore.
336  * 
337  * Finishes the asynchronous operation started with g_file_enumerator_next_files_async().
338  * 
339  * Returns: a #GList of #GFileInfo<!---->s. You must free the list with g_list_free
340  * and unref the infos with g_object_unref when your done with them.
341  **/
342 GList *
343 g_file_enumerator_next_files_finish (GFileEnumerator  *enumerator,
344                                      GAsyncResult     *result,
345                                      GError          **error)
346 {
347   GFileEnumeratorClass *class;
348   GSimpleAsyncResult *simple;
349   
350   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), NULL);
351   g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);
352   
353   if (G_IS_SIMPLE_ASYNC_RESULT (result))
354     {
355       simple = G_SIMPLE_ASYNC_RESULT (result);
356       if (g_simple_async_result_propagate_error (simple, error))
357         return NULL;
358       
359       /* Special case read of 0 files */
360       if (g_simple_async_result_get_source_tag (simple) == g_file_enumerator_next_files_async)
361         return NULL;
362     }
363   
364   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
365   return class->next_files_finish (enumerator, result, error);
366 }
367
368 static void
369 close_async_callback_wrapper (GObject      *source_object,
370                               GAsyncResult *res,
371                               gpointer      user_data)
372 {
373   GFileEnumerator *enumerator = G_FILE_ENUMERATOR (source_object);
374   
375   enumerator->priv->pending = FALSE;
376   enumerator->priv->closed = TRUE;
377   if (enumerator->priv->outstanding_callback)
378     (*enumerator->priv->outstanding_callback) (source_object, res, user_data);
379   g_object_unref (enumerator);
380 }
381
382 /**
383  * g_file_enumerator_close_async:
384  * @enumerator: a #GFileEnumerator.
385  * @io_priority: the <link linkend="io-priority">I/O priority</link> 
386  *     of the request.
387  * @cancellable: optional #GCancellable object, %NULL to ignore. 
388  * @callback: a #GAsyncReadyCallback to call when the request is satisfied
389  * @user_data: the data to pass to callback function
390  *
391  * Asynchronously closes the file enumerator. 
392  *
393  * If @cancellable is not %NULL, then the operation can be cancelled by
394  * triggering the cancellable object from another thread. If the operation
395  * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned in 
396  * g_file_enumerator_close_finish(). 
397  **/
398 void
399 g_file_enumerator_close_async (GFileEnumerator     *enumerator,
400                                int                  io_priority,
401                                GCancellable        *cancellable,
402                                GAsyncReadyCallback  callback,
403                                gpointer             user_data)
404 {
405   GFileEnumeratorClass *class;
406
407   g_return_if_fail (G_IS_FILE_ENUMERATOR (enumerator));
408
409   if (enumerator->priv->closed)
410     {
411       g_simple_async_report_error_in_idle (G_OBJECT (enumerator),
412                                            callback,
413                                            user_data,
414                                            G_IO_ERROR, G_IO_ERROR_CLOSED,
415                                            _("File enumerator is already closed"));
416       return;
417     }
418   
419   if (enumerator->priv->pending)
420     {
421       g_simple_async_report_error_in_idle (G_OBJECT (enumerator),
422                                            callback,
423                                            user_data,
424                                            G_IO_ERROR, G_IO_ERROR_PENDING,
425                                            _("File enumerator has outstanding operation"));
426       return;
427     }
428
429   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
430   
431   enumerator->priv->pending = TRUE;
432   enumerator->priv->outstanding_callback = callback;
433   g_object_ref (enumerator);
434   (* class->close_async) (enumerator, io_priority, cancellable,
435                           close_async_callback_wrapper, user_data);
436 }
437
438 /**
439  * g_file_enumerator_close_finish:
440  * @enumerator: a #GFileEnumerator.
441  * @result: a #GAsyncResult.
442  * @error: a #GError location to store the error occuring, or %NULL to 
443  * ignore.
444  * 
445  * Finishes closing a file enumerator, started from g_file_enumerator_close_async().
446  * 
447  * If the file enumerator was already closed when g_file_enumerator_close_async() 
448  * was called, then this function will report %G_IO_ERROR_CLOSED in @error, and 
449  * return %FALSE. If the file enumerator had pending operation when the close 
450  * operation was started, then this function will report %G_IO_ERROR_PENDING, and
451  * return %FALSE.  If @cancellable was not %NULL, then the operation may have been 
452  * cancelled by triggering the cancellable object from another thread. If the operation
453  * was cancelled, the error %G_IO_ERROR_CANCELLED will be set, and %FALSE will be 
454  * returned. 
455  * 
456  * Returns: %TRUE if the close operation has finished successfully.
457  **/
458 gboolean
459 g_file_enumerator_close_finish (GFileEnumerator  *enumerator,
460                                 GAsyncResult     *result,
461                                 GError          **error)
462 {
463   GSimpleAsyncResult *simple;
464   GFileEnumeratorClass *class;
465
466   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), FALSE);
467   g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
468   
469   if (G_IS_SIMPLE_ASYNC_RESULT (result))
470     {
471       simple = G_SIMPLE_ASYNC_RESULT (result);
472       if (g_simple_async_result_propagate_error (simple, error))
473         return FALSE;
474     }
475   
476   class = G_FILE_ENUMERATOR_GET_CLASS (enumerator);
477   return class->close_finish (enumerator, result, error);
478 }
479
480 /**
481  * g_file_enumerator_is_closed:
482  * @enumerator: a #GFileEnumerator.
483  *
484  * Checks if the file enumerator has been closed.
485  * 
486  * Returns: %TRUE if the @enumerator is closed.
487  **/
488 gboolean
489 g_file_enumerator_is_closed (GFileEnumerator *enumerator)
490 {
491   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), TRUE);
492   
493   return enumerator->priv->closed;
494 }
495
496 /**
497  * g_file_enumerator_has_pending:
498  * @enumerator: a #GFileEnumerator.
499  * 
500  * Checks if the file enumerator has pending operations.
501  *
502  * Returns: %TRUE if the @enumerator has pending operations.
503  **/
504 gboolean
505 g_file_enumerator_has_pending (GFileEnumerator *enumerator)
506 {
507   g_return_val_if_fail (G_IS_FILE_ENUMERATOR (enumerator), TRUE);
508   
509   return enumerator->priv->pending;
510 }
511
512 /**
513  * g_file_enumerator_set_pending:
514  * @enumerator: a #GFileEnumerator.
515  * @pending: a boolean value.
516  * 
517  * Sets the file enumerator as having pending operations.
518  **/
519 void
520 g_file_enumerator_set_pending (GFileEnumerator *enumerator,
521                                gboolean         pending)
522 {
523   g_return_if_fail (G_IS_FILE_ENUMERATOR (enumerator));
524   
525   enumerator->priv->pending = pending;
526 }
527
528 typedef struct {
529   int                num_files;
530   GList             *files;
531 } NextAsyncOp;
532
533 static void
534 next_async_op_free (NextAsyncOp *op)
535 {
536   /* Free the list, if finish wasn't called */
537   g_list_foreach (op->files, (GFunc)g_object_unref, NULL);
538   g_list_free (op->files);
539   
540   g_free (op);
541 }
542                     
543
544
545 static void
546 next_files_thread (GSimpleAsyncResult *res,
547                    GObject            *object,
548                    GCancellable       *cancellable)
549 {
550   NextAsyncOp *op;
551   GFileEnumeratorClass *class;
552   GError *error = NULL;
553   GFileInfo *info;
554   GFileEnumerator *enumerator;
555   int i;
556
557   enumerator = G_FILE_ENUMERATOR (object);
558   op = g_simple_async_result_get_op_res_gpointer (res);
559
560   class = G_FILE_ENUMERATOR_GET_CLASS (object);
561
562   for (i = 0; i < op->num_files; i++)
563     {
564       if (g_cancellable_set_error_if_cancelled (cancellable, &error))
565         info = NULL;
566       else
567         info = class->next_file (enumerator, cancellable, &error);
568       
569       if (info == NULL)
570         {
571           /* If we get an error after first file, return that on next operation */
572           if (error != NULL && i > 0)
573             {
574               if (error->domain == G_IO_ERROR &&
575                   error->code == G_IO_ERROR_CANCELLED)
576                 g_error_free (error); /* Never propagate cancel errors to other call */
577               else
578                 enumerator->priv->outstanding_error = error;
579               error = NULL;
580             }
581               
582           break;
583         }
584       else
585         op->files = g_list_prepend (op->files, info);
586     }
587 }
588
589 static void
590 g_file_enumerator_real_next_files_async (GFileEnumerator     *enumerator,
591                                          int                  num_files,
592                                          int                  io_priority,
593                                          GCancellable        *cancellable,
594                                          GAsyncReadyCallback  callback,
595                                          gpointer             user_data)
596 {
597   GSimpleAsyncResult *res;
598   NextAsyncOp *op;
599
600   op = g_new0 (NextAsyncOp, 1);
601
602   op->num_files = num_files;
603   op->files = NULL;
604
605   res = g_simple_async_result_new (G_OBJECT (enumerator), callback, user_data, g_file_enumerator_real_next_files_async);
606   g_simple_async_result_set_op_res_gpointer (res, op, (GDestroyNotify) next_async_op_free);
607   
608   g_simple_async_result_run_in_thread (res, next_files_thread, io_priority, cancellable);
609   g_object_unref (res);
610 }
611
612 static GList *
613 g_file_enumerator_real_next_files_finish (GFileEnumerator                *enumerator,
614                                           GAsyncResult                   *result,
615                                           GError                        **error)
616 {
617   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
618   NextAsyncOp *op;
619   GList *res;
620
621   g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == 
622             g_file_enumerator_real_next_files_async);
623
624   op = g_simple_async_result_get_op_res_gpointer (simple);
625
626   res = op->files;
627   op->files = NULL;
628   return res;
629 }
630
631 static void
632 close_async_thread (GSimpleAsyncResult *res,
633                     GObject            *object,
634                     GCancellable       *cancellable)
635 {
636   GFileEnumeratorClass *class;
637   GError *error = NULL;
638   gboolean result;
639
640   /* Auto handling of cancelation disabled, and ignore
641      cancellation, since we want to close things anyway, although
642      possibly in a quick-n-dirty way. At least we never want to leak
643      open handles */
644   
645   class = G_FILE_ENUMERATOR_GET_CLASS (object);
646   result = class->close_fn (G_FILE_ENUMERATOR (object), cancellable, &error);
647   if (!result)
648     {
649       g_simple_async_result_set_from_error (res, error);
650       g_error_free (error);
651     }
652 }
653
654
655 static void
656 g_file_enumerator_real_close_async (GFileEnumerator     *enumerator,
657                                     int                  io_priority,
658                                     GCancellable        *cancellable,
659                                     GAsyncReadyCallback  callback,
660                                     gpointer             user_data)
661 {
662   GSimpleAsyncResult *res;
663   
664   res = g_simple_async_result_new (G_OBJECT (enumerator),
665                                    callback,
666                                    user_data,
667                                    g_file_enumerator_real_close_async);
668
669   g_simple_async_result_set_handle_cancellation (res, FALSE);
670   
671   g_simple_async_result_run_in_thread (res,
672                                        close_async_thread,
673                                        io_priority,
674                                        cancellable);
675   g_object_unref (res);
676 }
677
678 static gboolean
679 g_file_enumerator_real_close_finish (GFileEnumerator  *enumerator,
680                                      GAsyncResult     *result,
681                                      GError          **error)
682 {
683   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
684   g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == 
685             g_file_enumerator_real_close_async);
686   return TRUE;
687 }
688
689 #define __G_FILE_ENUMERATOR_C__
690 #include "gioaliasdef.c"