Revert "GIOScheduler: Avoid constant iteration over pending job list"
[platform/upstream/glib.git] / gio / gfile.h
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 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
26
27 #ifndef __G_FILE_H__
28 #define __G_FILE_H__
29
30 #include <gio/giotypes.h>
31
32 G_BEGIN_DECLS
33
34 #define G_TYPE_FILE            (g_file_get_type ())
35 #define G_FILE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_FILE, GFile))
36 #define G_IS_FILE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_FILE))
37 #define G_FILE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_FILE, GFileIface))
38
39 #if 0
40 /**
41  * GFile:
42  *
43  * A handle to an object implementing the #GFileIface interface.
44  * Generally stores a location within the file system. Handles do not
45  * necessarily represent files or directories that currently exist.
46  **/
47 typedef struct _GFile                   GFile; /* Dummy typedef */
48 #endif
49 typedef struct _GFileIface              GFileIface;
50
51
52 /**
53  * GFileIface:
54  * @g_iface: The parent interface.
55  * @dup: Duplicates a #GFile.
56  * @hash: Creates a hash of a #GFile.
57  * @equal: Checks equality of two given #GFile<!-- -->s.
58  * @is_native: Checks to see if a file is native to the system.
59  * @has_uri_scheme: Checks to see if a #GFile has a given URI scheme.
60  * @get_uri_scheme: Gets the URI scheme for a #GFile.
61  * @get_basename: Gets the basename for a given #GFile.
62  * @get_path: Gets the current path within a #GFile.
63  * @get_uri: Gets a URI for the path within a #GFile.
64  * @get_parse_name: Gets the parsed name for the #GFile.
65  * @get_parent: Gets the parent directory for the #GFile.
66  * @prefix_matches: Checks whether a #GFile contains a specified file.
67  * @get_relative_path: Gets the path for a #GFile relative to a given path.
68  * @resolve_relative_path: Resolves a relative path for a #GFile to an absolute path.
69  * @get_child_for_display_name: Gets the child #GFile for a given display name.
70  * @enumerate_children: Gets a #GFileEnumerator with the children of a #GFile.
71  * @enumerate_children_async: Asynchronously gets a #GFileEnumerator with the children of a #GFile.
72  * @enumerate_children_finish: Finishes asynchronously enumerating the children.
73  * @query_info: Gets the #GFileInfo for a #GFile.
74  * @query_info_async: Asynchronously gets the #GFileInfo for a #GFile.
75  * @query_info_finish: Finishes an asynchronous query info operation.
76  * @query_filesystem_info: Gets a #GFileInfo for the file system #GFile is on.
77  * @query_filesystem_info_async: Asynchronously gets a #GFileInfo for the file system #GFile is on.
78  * @query_filesystem_info_finish: Finishes asynchronously getting the file system info.
79  * @find_enclosing_mount: Gets a #GMount for the #GFile.
80  * @find_enclosing_mount_async: Asynchronously gets the #GMount for a #GFile.
81  * @find_enclosing_mount_finish: Finishes asynchronously getting the volume.
82  * @set_display_name: Sets the display name for a #GFile.
83  * @set_display_name_async: Asynchronously sets a #GFile's display name.
84  * @set_display_name_finish: Finishes asynchronously setting a #GFile's display name.
85  * @query_settable_attributes: Returns a list of #GFileAttribute<!-- -->s that can be set.
86  * @_query_settable_attributes_async: Asynchronously gets a list of #GFileAttribute<!-- -->s that can be set.
87  * @_query_settable_attributes_finish: Finishes asynchronously querying settable attributes.
88  * @query_writable_namespaces: Returns a list of #GFileAttribute namespaces that are writable.
89  * @_query_writable_namespaces_async: Asynchronously gets a list of #GFileAttribute namespaces that are writable.
90  * @_query_writable_namespaces_finish: Finishes asynchronously querying the writable namespaces.
91  * @set_attribute: Sets a #GFileAttribute.
92  * @set_attributes_from_info: Sets a #GFileAttribute with information from a #GFileInfo.
93  * @set_attributes_async: Asynchronously sets a file's attributes.
94  * @set_attributes_finish: Finishes setting a file's attributes asynchronously.
95  * @read_fn: Reads a file asynchronously.
96  * @read_async: Asynchronously reads a file.
97  * @read_finish: Finishes asynchronously reading a file.
98  * @append_to: Writes to the end of a file.
99  * @append_to_async: Asynchronously writes to the end of a file.
100  * @append_to_finish: Finishes an asynchronous file append operation.
101  * @create: Creates a new file.
102  * @create_async: Asynchronously creates a file.
103  * @create_finish: Finishes asynchronously creating a file.
104  * @replace: Replaces the contents of a file.
105  * @replace_async: Asynchronously replaces the contents of a file.
106  * @replace_finish: Finishes asynchronously replacing a file.
107  * @delete_file: Deletes a file.
108  * @_delete_file_async: Asynchronously deletes a file.
109  * @_delete_file_finish: Finishes an asynchronous delete.
110  * @trash: Sends a #GFile to the Trash location.
111  * @_trash_async: Asynchronously sends a #GFile to the Trash location.
112  * @_trash_finish: Finishes an asynchronous file trashing operation.
113  * @make_directory: Makes a directory.
114  * @_make_directory_async: Asynchronously makes a directory.
115  * @_make_directory_finish: Finishes making a directory asynchronously.
116  * @make_symbolic_link: Makes a symbolic link.
117  * @_make_symbolic_link_async: Asynchronously makes a symbolic link
118  * @_make_symbolic_link_finish: Finishes making a symbolic link asynchronously.
119  * @copy: Copies a file.
120  * @copy_async: Asynchronously copies a file.
121  * @copy_finish: Finishes an asynchronous copy operation.
122  * @move: Moves a file.
123  * @_move_async: Asynchronously moves a file.
124  * @_move_finish: Finishes an asynchronous move operation.
125  * @mount_mountable: Mounts a mountable object.
126  * @mount_mountable_finish: Finishes a mounting operation.
127  * @unmount_mountable: Unmounts a mountable object.
128  * @unmount_mountable_finish: Finishes an unmount operation.
129  * @eject_mountable: Ejects a mountable.
130  * @eject_mountable_finish: Finishes an eject operation.
131  * @mount_enclosing_volume: Mounts a specified location.
132  * @mount_enclosing_volume_finish: Finishes mounting a specified location.
133  * @monitor_dir: Creates a #GFileMonitor for the location.
134  * @monitor_file: Creates a #GFileMonitor for the location.
135  * @open_readwrite: Open file read/write. Since 2.22.
136  * @open_readwrite_async: Asynchronously opens file read/write. Since 2.22.
137  * @open_readwrite_finish: Finishes an asynchronous open read/write. Since 2.22.
138  * @create_readwrite: Creates file read/write. Since 2.22.
139  * @create_readwrite_async: Asynchronously creates file read/write. Since 2.22.
140  * @create_readwrite_finish: Finishes an asynchronous creates read/write. Since 2.22.
141  * @replace_readwrite: Replaces file read/write. Since 2.22.
142  * @replace_readwrite_async: Asynchronously replaces file read/write. Since 2.22.
143  * @replace_readwrite_finish: Finishes an asynchronous replace read/write. Since 2.22.
144  * @start_mountable: Starts a mountable object. Since 2.22.
145  * @start_mountable_finish: Finishes an start operation. Since 2.22.
146  * @stop_mountable: Stops a mountable. Since 2.22.
147  * @stop_mountable_finish: Finishes an stop operation. Since 2.22.
148  * @supports_thread_contexts: a boolean that indicates whether the #GFile implementation supports thread-default contexts. Since 2.22.
149  * @unmount_mountable_with_operation: Unmounts a mountable object using a #GMountOperation. Since 2.22.
150  * @unmount_mountable_with_operation_finish: Finishes an unmount operation using a #GMountOperation. Since 2.22.
151  * @eject_mountable_with_operation: Ejects a mountable object using a #GMountOperation. Since 2.22.
152  * @eject_mountable_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22.
153  * @poll_mountable: Polls a mountable object for media changes. Since 2.22.
154  * @poll_mountable_finish: Finishes an poll operation for media changes. Since 2.22.
155  *
156  * An interface for writing VFS file handles.
157  **/
158 struct _GFileIface
159 {
160   GTypeInterface g_iface;
161
162   /* Virtual Table */
163
164   GFile *             (* dup)                         (GFile         *file);
165   guint               (* hash)                        (GFile         *file);
166   gboolean            (* equal)                       (GFile         *file1,
167                                                        GFile         *file2);
168   gboolean            (* is_native)                   (GFile         *file);
169   gboolean            (* has_uri_scheme)              (GFile         *file,
170                                                        const char    *uri_scheme);
171   char *              (* get_uri_scheme)              (GFile         *file);
172   char *              (* get_basename)                (GFile         *file);
173   char *              (* get_path)                    (GFile         *file);
174   char *              (* get_uri)                     (GFile         *file);
175   char *              (* get_parse_name)              (GFile         *file);
176   GFile *             (* get_parent)                  (GFile         *file);
177   gboolean            (* prefix_matches)              (GFile         *prefix,
178                                                        GFile         *file);
179   char *              (* get_relative_path)           (GFile         *parent,
180                                                        GFile         *descendant);
181   GFile *             (* resolve_relative_path)       (GFile        *file,
182                                                        const char   *relative_path);
183   GFile *             (* get_child_for_display_name)  (GFile        *file,
184                                                        const char   *display_name,
185                                                        GError      **error);
186
187   GFileEnumerator *   (* enumerate_children)          (GFile                *file,
188                                                        const char           *attributes,
189                                                        GFileQueryInfoFlags   flags,
190                                                        GCancellable         *cancellable,
191                                                        GError              **error);
192   void                (* enumerate_children_async)    (GFile                *file,
193                                                        const char           *attributes,
194                                                        GFileQueryInfoFlags   flags,
195                                                        int                   io_priority,
196                                                        GCancellable         *cancellable,
197                                                        GAsyncReadyCallback   callback,
198                                                        gpointer              user_data);
199   GFileEnumerator *   (* enumerate_children_finish)   (GFile                *file,
200                                                        GAsyncResult         *res,
201                                                        GError              **error);
202
203   GFileInfo *         (* query_info)                  (GFile                *file,
204                                                        const char           *attributes,
205                                                        GFileQueryInfoFlags   flags,
206                                                        GCancellable         *cancellable,
207                                                        GError              **error);
208   void                (* query_info_async)            (GFile                *file,
209                                                        const char           *attributes,
210                                                        GFileQueryInfoFlags   flags,
211                                                        int                   io_priority,
212                                                        GCancellable         *cancellable,
213                                                        GAsyncReadyCallback   callback,
214                                                        gpointer              user_data);
215   GFileInfo *         (* query_info_finish)           (GFile                *file,
216                                                        GAsyncResult         *res,
217                                                        GError              **error);
218
219   GFileInfo *         (* query_filesystem_info)       (GFile                *file,
220                                                        const char           *attributes,
221                                                        GCancellable         *cancellable,
222                                                        GError              **error);
223   void                (* query_filesystem_info_async) (GFile                *file,
224                                                        const char           *attributes,
225                                                        int                   io_priority,
226                                                        GCancellable         *cancellable,
227                                                        GAsyncReadyCallback   callback,
228                                                        gpointer              user_data);
229   GFileInfo *         (* query_filesystem_info_finish)(GFile                *file,
230                                                        GAsyncResult         *res,
231                                                        GError              **error);
232
233   GMount *            (* find_enclosing_mount)        (GFile                *file,
234                                                        GCancellable         *cancellable,
235                                                        GError              **error);
236   void                (* find_enclosing_mount_async)  (GFile                *file,
237                                                        int                   io_priority,
238                                                        GCancellable         *cancellable,
239                                                        GAsyncReadyCallback   callback,
240                                                        gpointer              user_data);
241   GMount *            (* find_enclosing_mount_finish) (GFile                *file,
242                                                        GAsyncResult         *res,
243                                                        GError              **error);
244
245   GFile *             (* set_display_name)            (GFile                *file,
246                                                        const char           *display_name,
247                                                        GCancellable         *cancellable,
248                                                        GError              **error);
249   void                (* set_display_name_async)      (GFile                *file,
250                                                        const char           *display_name,
251                                                        int                   io_priority,
252                                                        GCancellable         *cancellable,
253                                                        GAsyncReadyCallback   callback,
254                                                        gpointer              user_data);
255   GFile *             (* set_display_name_finish)     (GFile                *file,
256                                                        GAsyncResult         *res,
257                                                        GError              **error);
258
259   GFileAttributeInfoList * (* query_settable_attributes)    (GFile          *file,
260                                                              GCancellable   *cancellable,
261                                                              GError        **error);
262   void                (* _query_settable_attributes_async)  (void);
263   void                (* _query_settable_attributes_finish) (void);
264
265   GFileAttributeInfoList * (* query_writable_namespaces)    (GFile          *file,
266                                                              GCancellable   *cancellable,
267                                                              GError        **error);
268   void                (* _query_writable_namespaces_async)  (void);
269   void                (* _query_writable_namespaces_finish) (void);
270
271   gboolean            (* set_attribute)               (GFile                *file,
272                                                        const char           *attribute,
273                                                        GFileAttributeType    type,
274                                                        gpointer              value_p,
275                                                        GFileQueryInfoFlags   flags,
276                                                        GCancellable         *cancellable,
277                                                        GError              **error);
278   gboolean            (* set_attributes_from_info)    (GFile                *file,
279                                                        GFileInfo            *info,
280                                                        GFileQueryInfoFlags   flags,
281                                                        GCancellable         *cancellable,
282                                                        GError              **error);
283   void                (* set_attributes_async)        (GFile                *file,
284                                                        GFileInfo            *info,
285                                                        GFileQueryInfoFlags   flags,
286                                                        int                   io_priority,
287                                                        GCancellable         *cancellable,
288                                                        GAsyncReadyCallback   callback,
289                                                        gpointer              user_data);
290   gboolean            (* set_attributes_finish)       (GFile                *file,
291                                                        GAsyncResult         *result,
292                                                        GFileInfo           **info,
293                                                        GError              **error);
294
295   GFileInputStream *  (* read_fn)                     (GFile                *file,
296                                                        GCancellable         *cancellable,
297                                                        GError              **error);
298   void                (* read_async)                  (GFile                *file,
299                                                        int                   io_priority,
300                                                        GCancellable         *cancellable,
301                                                        GAsyncReadyCallback   callback,
302                                                        gpointer              user_data);
303   GFileInputStream *  (* read_finish)                 (GFile                *file,
304                                                        GAsyncResult         *res,
305                                                        GError              **error);
306
307   GFileOutputStream * (* append_to)                   (GFile                *file,
308                                                        GFileCreateFlags      flags,
309                                                        GCancellable         *cancellable,
310                                                        GError              **error);
311   void                (* append_to_async)             (GFile                *file,
312                                                        GFileCreateFlags      flags,
313                                                        int                   io_priority,
314                                                        GCancellable         *cancellable,
315                                                        GAsyncReadyCallback   callback,
316                                                        gpointer              user_data);
317   GFileOutputStream * (* append_to_finish)            (GFile                *file,
318                                                        GAsyncResult         *res,
319                                                        GError              **error);
320
321   GFileOutputStream * (* create)                      (GFile                *file,
322                                                        GFileCreateFlags      flags,
323                                                        GCancellable         *cancellable,
324                                                        GError              **error);
325   void                (* create_async)                (GFile                *file,
326                                                        GFileCreateFlags      flags,
327                                                        int                   io_priority,
328                                                        GCancellable         *cancellable,
329                                                        GAsyncReadyCallback   callback,
330                                                        gpointer              user_data);
331   GFileOutputStream * (* create_finish)               (GFile                *file,
332                                                        GAsyncResult         *res,
333                                                        GError              **error);
334
335   GFileOutputStream * (* replace)                     (GFile                *file,
336                                                        const char           *etag,
337                                                        gboolean              make_backup,
338                                                        GFileCreateFlags      flags,
339                                                        GCancellable         *cancellable,
340                                                        GError              **error);
341   void                (* replace_async)               (GFile                *file,
342                                                        const char           *etag,
343                                                        gboolean              make_backup,
344                                                        GFileCreateFlags      flags,
345                                                        int                   io_priority,
346                                                        GCancellable         *cancellable,
347                                                        GAsyncReadyCallback   callback,
348                                                        gpointer              user_data);
349   GFileOutputStream * (* replace_finish)              (GFile                *file,
350                                                        GAsyncResult         *res,
351                                                        GError              **error);
352
353   gboolean            (* delete_file)                 (GFile                *file,
354                                                        GCancellable         *cancellable,
355                                                        GError              **error);
356   void                (* _delete_file_async)          (void);
357   void                (* _delete_file_finish)         (void);
358
359   gboolean            (* trash)                       (GFile                *file,
360                                                        GCancellable         *cancellable,
361                                                        GError              **error);
362   void                (* _trash_async)                (void);
363   void                (* _trash_finish)               (void);
364
365   gboolean            (* make_directory)              (GFile                *file,
366                                                        GCancellable         *cancellable,
367                                                        GError              **error);
368   void                (* _make_directory_async)       (void);
369   void                (* _make_directory_finish)      (void);
370
371   gboolean            (* make_symbolic_link)          (GFile                *file,
372                                                        const char           *symlink_value,
373                                                        GCancellable         *cancellable,
374                                                        GError              **error);
375   void                (* _make_symbolic_link_async)   (void);
376   void                (* _make_symbolic_link_finish)  (void);
377
378   gboolean            (* copy)                        (GFile                *source,
379                                                        GFile                *destination,
380                                                        GFileCopyFlags        flags,
381                                                        GCancellable         *cancellable,
382                                                        GFileProgressCallback progress_callback,
383                                                        gpointer              progress_callback_data,
384                                                        GError              **error);
385   void                (* copy_async)                  (GFile                *source,
386                                                        GFile                *destination,
387                                                        GFileCopyFlags        flags,
388                                                        int                   io_priority,
389                                                        GCancellable         *cancellable,
390                                                        GFileProgressCallback progress_callback,
391                                                        gpointer              progress_callback_data,
392                                                        GAsyncReadyCallback   callback,
393                                                        gpointer              user_data);
394   gboolean            (* copy_finish)                 (GFile                *file,
395                                                        GAsyncResult         *res,
396                                                        GError              **error);
397
398   gboolean            (* move)                        (GFile                *source,
399                                                        GFile                *destination,
400                                                        GFileCopyFlags        flags,
401                                                        GCancellable         *cancellable,
402                                                        GFileProgressCallback progress_callback,
403                                                        gpointer              progress_callback_data,
404                                                        GError              **error);
405   void                (* _move_async)                 (void);
406   void                (* _move_finish)                (void);
407
408   void                (* mount_mountable)             (GFile                *file,
409                                                        GMountMountFlags      flags,
410                                                        GMountOperation      *mount_operation,
411                                                        GCancellable         *cancellable,
412                                                        GAsyncReadyCallback   callback,
413                                                        gpointer              user_data);
414   GFile *             (* mount_mountable_finish)      (GFile                *file,
415                                                        GAsyncResult         *result,
416                                                        GError              **error);
417
418   void                (* unmount_mountable)           (GFile                *file,
419                                                        GMountUnmountFlags    flags,
420                                                        GCancellable         *cancellable,
421                                                        GAsyncReadyCallback   callback,
422                                                        gpointer              user_data);
423   gboolean            (* unmount_mountable_finish)    (GFile                *file,
424                                                        GAsyncResult         *result,
425                                                        GError              **error);
426
427   void                (* eject_mountable)             (GFile                *file,
428                                                        GMountUnmountFlags    flags,
429                                                        GCancellable         *cancellable,
430                                                        GAsyncReadyCallback   callback,
431                                                        gpointer              user_data);
432   gboolean            (* eject_mountable_finish)      (GFile                *file,
433                                                        GAsyncResult         *result,
434                                                        GError              **error);
435
436   void                (* mount_enclosing_volume)      (GFile                *location,
437                                                        GMountMountFlags      flags,
438                                                        GMountOperation      *mount_operation,
439                                                        GCancellable         *cancellable,
440                                                        GAsyncReadyCallback   callback,
441                                                        gpointer              user_data);
442   gboolean         (* mount_enclosing_volume_finish)  (GFile                *location,
443                                                        GAsyncResult         *result,
444                                                        GError              **error);
445
446   GFileMonitor *      (* monitor_dir)                 (GFile                *file,
447                                                        GFileMonitorFlags     flags,
448                                                        GCancellable         *cancellable,
449                                                        GError              **error);
450   GFileMonitor *      (* monitor_file)                (GFile                *file,
451                                                        GFileMonitorFlags     flags,
452                                                        GCancellable         *cancellable,
453                                                        GError              **error);
454
455   GFileIOStream *     (* open_readwrite)              (GFile                *file,
456                                                        GCancellable         *cancellable,
457                                                        GError              **error);
458   void                (* open_readwrite_async)        (GFile                *file,
459                                                        int                   io_priority,
460                                                        GCancellable         *cancellable,
461                                                        GAsyncReadyCallback   callback,
462                                                        gpointer              user_data);
463   GFileIOStream *     (* open_readwrite_finish)       (GFile                *file,
464                                                        GAsyncResult         *res,
465                                                        GError              **error);
466   GFileIOStream *     (* create_readwrite)            (GFile                *file,
467                                                        GFileCreateFlags      flags,
468                                                        GCancellable         *cancellable,
469                                                        GError              **error);
470   void                (* create_readwrite_async)      (GFile                *file,
471                                                        GFileCreateFlags      flags,
472                                                        int                   io_priority,
473                                                        GCancellable         *cancellable,
474                                                        GAsyncReadyCallback   callback,
475                                                        gpointer              user_data);
476   GFileIOStream *     (* create_readwrite_finish)      (GFile                *file,
477                                                        GAsyncResult         *res,
478                                                        GError              **error);
479   GFileIOStream *     (* replace_readwrite)           (GFile                *file,
480                                                        const char           *etag,
481                                                        gboolean              make_backup,
482                                                        GFileCreateFlags      flags,
483                                                        GCancellable         *cancellable,
484                                                        GError              **error);
485   void                (* replace_readwrite_async)     (GFile                *file,
486                                                        const char           *etag,
487                                                        gboolean              make_backup,
488                                                        GFileCreateFlags      flags,
489                                                        int                   io_priority,
490                                                        GCancellable         *cancellable,
491                                                        GAsyncReadyCallback   callback,
492                                                        gpointer              user_data);
493   GFileIOStream *     (* replace_readwrite_finish)    (GFile                *file,
494                                                        GAsyncResult         *res,
495                                                        GError              **error);
496
497   void                (* start_mountable)             (GFile                *file,
498                                                        GDriveStartFlags      flags,
499                                                        GMountOperation      *start_operation,
500                                                        GCancellable         *cancellable,
501                                                        GAsyncReadyCallback   callback,
502                                                        gpointer              user_data);
503   gboolean            (* start_mountable_finish)      (GFile                *file,
504                                                        GAsyncResult         *result,
505                                                        GError              **error);
506
507   void                (* stop_mountable)              (GFile                *file,
508                                                        GMountUnmountFlags    flags,
509                                                        GMountOperation      *mount_operation,
510                                                        GCancellable         *cancellable,
511                                                        GAsyncReadyCallback   callback,
512                                                        gpointer              user_data);
513   gboolean            (* stop_mountable_finish)       (GFile                *file,
514                                                        GAsyncResult         *result,
515                                                        GError              **error);
516
517   gboolean            supports_thread_contexts;
518
519   void                (* unmount_mountable_with_operation) (GFile           *file,
520                                                        GMountUnmountFlags    flags,
521                                                        GMountOperation      *mount_operation,
522                                                        GCancellable         *cancellable,
523                                                        GAsyncReadyCallback   callback,
524                                                        gpointer              user_data);
525   gboolean            (* unmount_mountable_with_operation_finish) (GFile    *file,
526                                                        GAsyncResult         *result,
527                                                        GError              **error);
528
529   void                (* eject_mountable_with_operation) (GFile             *file,
530                                                        GMountUnmountFlags    flags,
531                                                        GMountOperation      *mount_operation,
532                                                        GCancellable         *cancellable,
533                                                        GAsyncReadyCallback   callback,
534                                                        gpointer              user_data);
535   gboolean            (* eject_mountable_with_operation_finish) (GFile      *file,
536                                                        GAsyncResult         *result,
537                                                        GError              **error);
538
539   void                (* poll_mountable)              (GFile                *file,
540                                                        GCancellable         *cancellable,
541                                                        GAsyncReadyCallback   callback,
542                                                        gpointer              user_data);
543   gboolean            (* poll_mountable_finish)       (GFile                *file,
544                                                        GAsyncResult         *result,
545                                                        GError              **error);
546 };
547
548 GType                   g_file_get_type                   (void) G_GNUC_CONST;
549
550 GFile *                 g_file_new_for_path               (const char                 *path);
551 GFile *                 g_file_new_for_uri                (const char                 *uri);
552 GFile *                 g_file_new_for_commandline_arg    (const char                 *arg);
553 GLIB_AVAILABLE_IN_2_32
554 GFile *                 g_file_new_tmp                    (const char                 *tmpl,
555                                                            GFileIOStream             **iostream,
556                                                            GError                    **error);
557 GFile *                 g_file_parse_name                 (const char                 *parse_name);
558 GFile *                 g_file_dup                        (GFile                      *file);
559 guint                   g_file_hash                       (gconstpointer               file);
560 gboolean                g_file_equal                      (GFile                      *file1,
561                                                            GFile                      *file2);
562 char *                  g_file_get_basename               (GFile                      *file);
563 char *                  g_file_get_path                   (GFile                      *file);
564 char *                  g_file_get_uri                    (GFile                      *file);
565 char *                  g_file_get_parse_name             (GFile                      *file);
566 GFile *                 g_file_get_parent                 (GFile                      *file);
567 gboolean                g_file_has_parent                 (GFile                      *file,
568                                                            GFile                      *parent);
569 GFile *                 g_file_get_child                  (GFile                      *file,
570                                                            const char                 *name);
571 GFile *                 g_file_get_child_for_display_name (GFile                      *file,
572                                                            const char                 *display_name,
573                                                            GError                    **error);
574 gboolean                g_file_has_prefix                 (GFile                      *file,
575                                                            GFile                      *prefix);
576 char *                  g_file_get_relative_path          (GFile                      *parent,
577                                                            GFile                      *descendant);
578 GFile *                 g_file_resolve_relative_path      (GFile                      *file,
579                                                            const char                 *relative_path);
580 gboolean                g_file_is_native                  (GFile                      *file);
581 gboolean                g_file_has_uri_scheme             (GFile                      *file,
582                                                            const char                 *uri_scheme);
583 char *                  g_file_get_uri_scheme             (GFile                      *file);
584 GFileInputStream *      g_file_read                       (GFile                      *file,
585                                                            GCancellable               *cancellable,
586                                                            GError                    **error);
587 void                    g_file_read_async                 (GFile                      *file,
588                                                            int                         io_priority,
589                                                            GCancellable               *cancellable,
590                                                            GAsyncReadyCallback         callback,
591                                                            gpointer                    user_data);
592 GFileInputStream *      g_file_read_finish                (GFile                      *file,
593                                                            GAsyncResult               *res,
594                                                            GError                    **error);
595 GFileOutputStream *     g_file_append_to                  (GFile                      *file,
596                                                            GFileCreateFlags             flags,
597                                                            GCancellable               *cancellable,
598                                                            GError                    **error);
599 GFileOutputStream *     g_file_create                     (GFile                      *file,
600                                                            GFileCreateFlags             flags,
601                                                            GCancellable               *cancellable,
602                                                            GError                    **error);
603 GFileOutputStream *     g_file_replace                    (GFile                      *file,
604                                                            const char                 *etag,
605                                                            gboolean                    make_backup,
606                                                            GFileCreateFlags            flags,
607                                                            GCancellable               *cancellable,
608                                                            GError                    **error);
609 void                    g_file_append_to_async            (GFile                      *file,
610                                                            GFileCreateFlags            flags,
611                                                            int                         io_priority,
612                                                            GCancellable               *cancellable,
613                                                            GAsyncReadyCallback         callback,
614                                                            gpointer                    user_data);
615 GFileOutputStream *     g_file_append_to_finish           (GFile                      *file,
616                                                            GAsyncResult               *res,
617                                                            GError                    **error);
618 void                    g_file_create_async               (GFile                      *file,
619                                                            GFileCreateFlags            flags,
620                                                            int                         io_priority,
621                                                            GCancellable               *cancellable,
622                                                            GAsyncReadyCallback         callback,
623                                                            gpointer                    user_data);
624 GFileOutputStream *     g_file_create_finish              (GFile                      *file,
625                                                            GAsyncResult               *res,
626                                                            GError                    **error);
627 void                    g_file_replace_async              (GFile                      *file,
628                                                            const char                 *etag,
629                                                            gboolean                    make_backup,
630                                                            GFileCreateFlags            flags,
631                                                            int                         io_priority,
632                                                            GCancellable               *cancellable,
633                                                            GAsyncReadyCallback         callback,
634                                                            gpointer                    user_data);
635 GFileOutputStream *     g_file_replace_finish             (GFile                      *file,
636                                                            GAsyncResult               *res,
637                                                            GError                    **error);
638 GFileIOStream *         g_file_open_readwrite             (GFile                      *file,
639                                                            GCancellable               *cancellable,
640                                                            GError                    **error);
641 void                    g_file_open_readwrite_async       (GFile                      *file,
642                                                            int                         io_priority,
643                                                            GCancellable               *cancellable,
644                                                            GAsyncReadyCallback         callback,
645                                                            gpointer                    user_data);
646 GFileIOStream *         g_file_open_readwrite_finish      (GFile                      *file,
647                                                            GAsyncResult               *res,
648                                                            GError                    **error);
649 GFileIOStream *         g_file_create_readwrite           (GFile                      *file,
650                                                            GFileCreateFlags            flags,
651                                                            GCancellable               *cancellable,
652                                                            GError                    **error);
653 void                    g_file_create_readwrite_async     (GFile                      *file,
654                                                            GFileCreateFlags            flags,
655                                                            int                         io_priority,
656                                                            GCancellable               *cancellable,
657                                                            GAsyncReadyCallback         callback,
658                                                            gpointer                    user_data);
659 GFileIOStream *         g_file_create_readwrite_finish    (GFile                      *file,
660                                                            GAsyncResult               *res,
661                                                            GError                    **error);
662 GFileIOStream *         g_file_replace_readwrite          (GFile                      *file,
663                                                            const char                 *etag,
664                                                            gboolean                    make_backup,
665                                                            GFileCreateFlags            flags,
666                                                            GCancellable               *cancellable,
667                                                            GError                    **error);
668 void                    g_file_replace_readwrite_async    (GFile                      *file,
669                                                            const char                 *etag,
670                                                            gboolean                    make_backup,
671                                                            GFileCreateFlags            flags,
672                                                            int                         io_priority,
673                                                            GCancellable               *cancellable,
674                                                            GAsyncReadyCallback         callback,
675                                                            gpointer                    user_data);
676 GFileIOStream *         g_file_replace_readwrite_finish   (GFile                      *file,
677                                                            GAsyncResult               *res,
678                                                            GError                    **error);
679 gboolean                g_file_query_exists               (GFile                      *file,
680                                                            GCancellable               *cancellable);
681 GFileType               g_file_query_file_type            (GFile                      *file,
682                                                            GFileQueryInfoFlags         flags,
683                                                            GCancellable               *cancellable);
684 GFileInfo *             g_file_query_info                 (GFile                      *file,
685                                                            const char                 *attributes,
686                                                            GFileQueryInfoFlags         flags,
687                                                            GCancellable               *cancellable,
688                                                            GError                    **error);
689 void                    g_file_query_info_async           (GFile                      *file,
690                                                            const char                 *attributes,
691                                                            GFileQueryInfoFlags         flags,
692                                                            int                         io_priority,
693                                                            GCancellable               *cancellable,
694                                                            GAsyncReadyCallback         callback,
695                                                            gpointer                    user_data);
696 GFileInfo *             g_file_query_info_finish          (GFile                      *file,
697                                                            GAsyncResult               *res,
698                                                            GError                    **error);
699 GFileInfo *             g_file_query_filesystem_info      (GFile                      *file,
700                                                            const char                 *attributes,
701                                                            GCancellable               *cancellable,
702                                                            GError                    **error);
703 void                    g_file_query_filesystem_info_async (GFile                      *file,
704                                                            const char                 *attributes,
705                                                            int                         io_priority,
706                                                            GCancellable               *cancellable,
707                                                            GAsyncReadyCallback         callback,
708                                                            gpointer                    user_data);
709 GFileInfo *             g_file_query_filesystem_info_finish (GFile                      *file,
710                                                            GAsyncResult               *res,
711                                                            GError                    **error);
712 GMount *                g_file_find_enclosing_mount       (GFile                      *file,
713                                                            GCancellable               *cancellable,
714                                                            GError                    **error);
715 void                    g_file_find_enclosing_mount_async (GFile                      *file,
716                                                            int                         io_priority,
717                                                            GCancellable               *cancellable,
718                                                            GAsyncReadyCallback         callback,
719                                                            gpointer                    user_data);
720 GMount *                g_file_find_enclosing_mount_finish (GFile                     *file,
721                                                             GAsyncResult              *res,
722                                                             GError                   **error);
723 GFileEnumerator *       g_file_enumerate_children         (GFile                      *file,
724                                                            const char                 *attributes,
725                                                            GFileQueryInfoFlags         flags,
726                                                            GCancellable               *cancellable,
727                                                            GError                    **error);
728 void                    g_file_enumerate_children_async   (GFile                      *file,
729                                                            const char                 *attributes,
730                                                            GFileQueryInfoFlags         flags,
731                                                            int                         io_priority,
732                                                            GCancellable               *cancellable,
733                                                            GAsyncReadyCallback         callback,
734                                                            gpointer                    user_data);
735 GFileEnumerator *       g_file_enumerate_children_finish  (GFile                      *file,
736                                                            GAsyncResult               *res,
737                                                            GError                    **error);
738 GFile *                 g_file_set_display_name           (GFile                      *file,
739                                                            const char                 *display_name,
740                                                            GCancellable               *cancellable,
741                                                            GError                    **error);
742 void                    g_file_set_display_name_async     (GFile                      *file,
743                                                            const char                 *display_name,
744                                                            int                         io_priority,
745                                                            GCancellable               *cancellable,
746                                                            GAsyncReadyCallback         callback,
747                                                            gpointer                    user_data);
748 GFile *                 g_file_set_display_name_finish    (GFile                      *file,
749                                                            GAsyncResult               *res,
750                                                            GError                    **error);
751 gboolean                g_file_delete                     (GFile                      *file,
752                                                            GCancellable               *cancellable,
753                                                            GError                    **error);
754 gboolean                g_file_trash                      (GFile                      *file,
755                                                            GCancellable               *cancellable,
756                                                            GError                    **error);
757 gboolean                g_file_copy                       (GFile                      *source,
758                                                            GFile                      *destination,
759                                                            GFileCopyFlags              flags,
760                                                            GCancellable               *cancellable,
761                                                            GFileProgressCallback       progress_callback,
762                                                            gpointer                    progress_callback_data,
763                                                            GError                    **error);
764 void                    g_file_copy_async                 (GFile                      *source,
765                                                            GFile                      *destination,
766                                                            GFileCopyFlags              flags,
767                                                            int                         io_priority,
768                                                            GCancellable               *cancellable,
769                                                            GFileProgressCallback       progress_callback,
770                                                            gpointer                    progress_callback_data,
771                                                            GAsyncReadyCallback         callback,
772                                                            gpointer                    user_data);
773 gboolean                g_file_copy_finish                (GFile                      *file,
774                                                            GAsyncResult               *res,
775                                                            GError                    **error);
776 gboolean                g_file_move                       (GFile                      *source,
777                                                            GFile                      *destination,
778                                                            GFileCopyFlags              flags,
779                                                            GCancellable               *cancellable,
780                                                            GFileProgressCallback       progress_callback,
781                                                            gpointer                    progress_callback_data,
782                                                            GError                    **error);
783 gboolean                g_file_make_directory             (GFile                      *file,
784                                                            GCancellable               *cancellable,
785                                                            GError                    **error);
786 gboolean                g_file_make_directory_with_parents (GFile                     *file,
787                                                            GCancellable               *cancellable,
788                                                            GError                    **error);
789 gboolean                g_file_make_symbolic_link         (GFile                      *file,
790                                                            const char                 *symlink_value,
791                                                            GCancellable               *cancellable,
792                                                            GError                    **error);
793 GFileAttributeInfoList *g_file_query_settable_attributes  (GFile                      *file,
794                                                            GCancellable               *cancellable,
795                                                            GError                    **error);
796 GFileAttributeInfoList *g_file_query_writable_namespaces  (GFile                      *file,
797                                                            GCancellable               *cancellable,
798                                                            GError                    **error);
799 gboolean                g_file_set_attribute              (GFile                      *file,
800                                                            const char                 *attribute,
801                                                            GFileAttributeType          type,
802                                                            gpointer                    value_p,
803                                                            GFileQueryInfoFlags         flags,
804                                                            GCancellable               *cancellable,
805                                                            GError                    **error);
806 gboolean                g_file_set_attributes_from_info   (GFile                      *file,
807                                                            GFileInfo                  *info,
808                                                            GFileQueryInfoFlags         flags,
809                                                            GCancellable               *cancellable,
810                                                            GError                    **error);
811 void                    g_file_set_attributes_async       (GFile                      *file,
812                                                            GFileInfo                  *info,
813                                                            GFileQueryInfoFlags         flags,
814                                                            int                         io_priority,
815                                                            GCancellable               *cancellable,
816                                                            GAsyncReadyCallback         callback,
817                                                            gpointer                    user_data);
818 gboolean                g_file_set_attributes_finish      (GFile                      *file,
819                                                            GAsyncResult               *result,
820                                                            GFileInfo                 **info,
821                                                            GError                    **error);
822 gboolean                g_file_set_attribute_string       (GFile                      *file,
823                                                            const char                 *attribute,
824                                                            const char                 *value,
825                                                            GFileQueryInfoFlags         flags,
826                                                            GCancellable               *cancellable,
827                                                            GError                    **error);
828 gboolean                g_file_set_attribute_byte_string  (GFile                      *file,
829                                                            const char                 *attribute,
830                                                            const char                 *value,
831                                                            GFileQueryInfoFlags         flags,
832                                                            GCancellable               *cancellable,
833                                                            GError                    **error);
834 gboolean                g_file_set_attribute_uint32       (GFile                      *file,
835                                                            const char                 *attribute,
836                                                            guint32                     value,
837                                                            GFileQueryInfoFlags         flags,
838                                                            GCancellable               *cancellable,
839                                                            GError                    **error);
840 gboolean                g_file_set_attribute_int32        (GFile                      *file,
841                                                            const char                 *attribute,
842                                                            gint32                      value,
843                                                            GFileQueryInfoFlags         flags,
844                                                            GCancellable               *cancellable,
845                                                            GError                    **error);
846 gboolean                g_file_set_attribute_uint64       (GFile                      *file,
847                                                            const char                 *attribute,
848                                                            guint64                     value,
849                                                            GFileQueryInfoFlags         flags,
850                                                            GCancellable               *cancellable,
851                                                            GError                    **error);
852 gboolean                g_file_set_attribute_int64        (GFile                      *file,
853                                                            const char                 *attribute,
854                                                            gint64                      value,
855                                                            GFileQueryInfoFlags         flags,
856                                                            GCancellable               *cancellable,
857                                                            GError                    **error);
858 void                    g_file_mount_enclosing_volume     (GFile                      *location,
859                                                            GMountMountFlags            flags,
860                                                            GMountOperation            *mount_operation,
861                                                            GCancellable               *cancellable,
862                                                            GAsyncReadyCallback         callback,
863                                                            gpointer                    user_data);
864 gboolean                g_file_mount_enclosing_volume_finish (GFile                      *location,
865                                                            GAsyncResult               *result,
866                                                            GError                    **error);
867 void                    g_file_mount_mountable            (GFile                      *file,
868                                                            GMountMountFlags            flags,
869                                                            GMountOperation            *mount_operation,
870                                                            GCancellable               *cancellable,
871                                                            GAsyncReadyCallback         callback,
872                                                            gpointer                    user_data);
873 GFile *                 g_file_mount_mountable_finish     (GFile                      *file,
874                                                            GAsyncResult               *result,
875                                                            GError                    **error);
876 GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation)
877 void                    g_file_unmount_mountable          (GFile                      *file,
878                                                            GMountUnmountFlags          flags,
879                                                            GCancellable               *cancellable,
880                                                            GAsyncReadyCallback         callback,
881                                                            gpointer                    user_data);
882
883 GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation_finish)
884 gboolean                g_file_unmount_mountable_finish   (GFile                      *file,
885                                                            GAsyncResult               *result,
886                                                            GError                    **error);
887 void                    g_file_unmount_mountable_with_operation (GFile                *file,
888                                                            GMountUnmountFlags          flags,
889                                                            GMountOperation            *mount_operation,
890                                                            GCancellable               *cancellable,
891                                                            GAsyncReadyCallback         callback,
892                                                            gpointer                    user_data);
893 gboolean                g_file_unmount_mountable_with_operation_finish (GFile         *file,
894                                                            GAsyncResult               *result,
895                                                            GError                    **error);
896 GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation)
897 void                    g_file_eject_mountable            (GFile                      *file,
898                                                            GMountUnmountFlags          flags,
899                                                            GCancellable               *cancellable,
900                                                            GAsyncReadyCallback         callback,
901                                                            gpointer                    user_data);
902
903 GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation_finish)
904 gboolean                g_file_eject_mountable_finish     (GFile                      *file,
905                                                            GAsyncResult               *result,
906                                                            GError                    **error);
907 void                    g_file_eject_mountable_with_operation (GFile                  *file,
908                                                            GMountUnmountFlags          flags,
909                                                            GMountOperation            *mount_operation,
910                                                            GCancellable               *cancellable,
911                                                            GAsyncReadyCallback         callback,
912                                                            gpointer                    user_data);
913 gboolean                g_file_eject_mountable_with_operation_finish (GFile           *file,
914                                                            GAsyncResult               *result,
915                                                            GError                    **error);
916
917 gboolean                g_file_copy_attributes            (GFile                      *source,
918                                                            GFile                      *destination,
919                                                            GFileCopyFlags              flags,
920                                                            GCancellable               *cancellable,
921                                                            GError                    **error);
922
923
924 GFileMonitor*           g_file_monitor_directory          (GFile                  *file,
925                                                            GFileMonitorFlags       flags,
926                                                            GCancellable           *cancellable,
927                                                            GError                **error);
928 GFileMonitor*           g_file_monitor_file               (GFile                  *file,
929                                                            GFileMonitorFlags       flags,
930                                                            GCancellable           *cancellable,
931                                                            GError                **error);
932 GFileMonitor*           g_file_monitor                    (GFile                  *file,
933                                                            GFileMonitorFlags       flags,
934                                                            GCancellable           *cancellable,
935                                                            GError                **error);
936
937 void                    g_file_start_mountable            (GFile                      *file,
938                                                            GDriveStartFlags            flags,
939                                                            GMountOperation            *start_operation,
940                                                            GCancellable               *cancellable,
941                                                            GAsyncReadyCallback         callback,
942                                                            gpointer                    user_data);
943 gboolean                g_file_start_mountable_finish     (GFile                      *file,
944                                                            GAsyncResult               *result,
945                                                            GError                    **error);
946 void                    g_file_stop_mountable             (GFile                      *file,
947                                                            GMountUnmountFlags          flags,
948                                                            GMountOperation            *mount_operation,
949                                                            GCancellable               *cancellable,
950                                                            GAsyncReadyCallback         callback,
951                                                            gpointer                    user_data);
952 gboolean                g_file_stop_mountable_finish      (GFile                      *file,
953                                                            GAsyncResult               *result,
954                                                            GError                    **error);
955
956 void                    g_file_poll_mountable             (GFile                      *file,
957                                                            GCancellable               *cancellable,
958                                                            GAsyncReadyCallback         callback,
959                                                            gpointer                    user_data);
960 gboolean                g_file_poll_mountable_finish      (GFile                      *file,
961                                                            GAsyncResult               *result,
962                                                            GError                    **error);
963
964 /* Utilities */
965
966 GAppInfo *g_file_query_default_handler       (GFile                  *file,
967                                               GCancellable           *cancellable,
968                                               GError                **error);
969 gboolean g_file_load_contents                (GFile                  *file,
970                                               GCancellable           *cancellable,
971                                               char                  **contents,
972                                               gsize                  *length,
973                                               char                  **etag_out,
974                                               GError                **error);
975 void     g_file_load_contents_async          (GFile                  *file,
976                                               GCancellable           *cancellable,
977                                               GAsyncReadyCallback     callback,
978                                               gpointer                user_data);
979 gboolean g_file_load_contents_finish         (GFile                  *file,
980                                               GAsyncResult           *res,
981                                               char                  **contents,
982                                               gsize                  *length,
983                                               char                  **etag_out,
984                                               GError                **error);
985 void     g_file_load_partial_contents_async  (GFile                  *file,
986                                               GCancellable           *cancellable,
987                                               GFileReadMoreCallback   read_more_callback,
988                                               GAsyncReadyCallback     callback,
989                                               gpointer                user_data);
990 gboolean g_file_load_partial_contents_finish (GFile                  *file,
991                                               GAsyncResult           *res,
992                                               char                  **contents,
993                                               gsize                  *length,
994                                               char                  **etag_out,
995                                               GError                **error);
996 gboolean g_file_replace_contents             (GFile                  *file,
997                                               const char             *contents,
998                                               gsize                   length,
999                                               const char             *etag,
1000                                               gboolean                make_backup,
1001                                               GFileCreateFlags        flags,
1002                                               char                  **new_etag,
1003                                               GCancellable           *cancellable,
1004                                               GError                **error);
1005 void     g_file_replace_contents_async       (GFile                  *file,
1006                                               const char             *contents,
1007                                               gsize                   length,
1008                                               const char             *etag,
1009                                               gboolean                make_backup,
1010                                               GFileCreateFlags        flags,
1011                                               GCancellable           *cancellable,
1012                                               GAsyncReadyCallback     callback,
1013                                               gpointer                user_data);
1014 gboolean g_file_replace_contents_finish      (GFile                  *file,
1015                                               GAsyncResult           *res,
1016                                               char                  **new_etag,
1017                                               GError                **error);
1018
1019 gboolean g_file_supports_thread_contexts     (GFile                  *file);
1020
1021 G_END_DECLS
1022
1023 #endif /* __G_FILE_H__ */