gio/tests/file: skip the file monitor tests if using GPollFileMonitor
[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)           (GFile                *file,
357                                                        int                   io_priority,
358                                                        GCancellable         *cancellable,
359                                                        GAsyncReadyCallback   callback,
360                                                        gpointer              user_data);
361   gboolean            (* delete_file_finish)          (GFile                *file,
362                                                        GAsyncResult         *result,
363                                                        GError              **error);
364
365   gboolean            (* trash)                       (GFile                *file,
366                                                        GCancellable         *cancellable,
367                                                        GError              **error);
368   void                (* _trash_async)                (void);
369   void                (* _trash_finish)               (void);
370
371   gboolean            (* make_directory)              (GFile                *file,
372                                                        GCancellable         *cancellable,
373                                                        GError              **error);
374   void                (* _make_directory_async)       (void);
375   void                (* _make_directory_finish)      (void);
376
377   gboolean            (* make_symbolic_link)          (GFile                *file,
378                                                        const char           *symlink_value,
379                                                        GCancellable         *cancellable,
380                                                        GError              **error);
381   void                (* _make_symbolic_link_async)   (void);
382   void                (* _make_symbolic_link_finish)  (void);
383
384   gboolean            (* copy)                        (GFile                *source,
385                                                        GFile                *destination,
386                                                        GFileCopyFlags        flags,
387                                                        GCancellable         *cancellable,
388                                                        GFileProgressCallback progress_callback,
389                                                        gpointer              progress_callback_data,
390                                                        GError              **error);
391   void                (* copy_async)                  (GFile                *source,
392                                                        GFile                *destination,
393                                                        GFileCopyFlags        flags,
394                                                        int                   io_priority,
395                                                        GCancellable         *cancellable,
396                                                        GFileProgressCallback progress_callback,
397                                                        gpointer              progress_callback_data,
398                                                        GAsyncReadyCallback   callback,
399                                                        gpointer              user_data);
400   gboolean            (* copy_finish)                 (GFile                *file,
401                                                        GAsyncResult         *res,
402                                                        GError              **error);
403
404   gboolean            (* move)                        (GFile                *source,
405                                                        GFile                *destination,
406                                                        GFileCopyFlags        flags,
407                                                        GCancellable         *cancellable,
408                                                        GFileProgressCallback progress_callback,
409                                                        gpointer              progress_callback_data,
410                                                        GError              **error);
411   void                (* _move_async)                 (void);
412   void                (* _move_finish)                (void);
413
414   void                (* mount_mountable)             (GFile                *file,
415                                                        GMountMountFlags      flags,
416                                                        GMountOperation      *mount_operation,
417                                                        GCancellable         *cancellable,
418                                                        GAsyncReadyCallback   callback,
419                                                        gpointer              user_data);
420   GFile *             (* mount_mountable_finish)      (GFile                *file,
421                                                        GAsyncResult         *result,
422                                                        GError              **error);
423
424   void                (* unmount_mountable)           (GFile                *file,
425                                                        GMountUnmountFlags    flags,
426                                                        GCancellable         *cancellable,
427                                                        GAsyncReadyCallback   callback,
428                                                        gpointer              user_data);
429   gboolean            (* unmount_mountable_finish)    (GFile                *file,
430                                                        GAsyncResult         *result,
431                                                        GError              **error);
432
433   void                (* eject_mountable)             (GFile                *file,
434                                                        GMountUnmountFlags    flags,
435                                                        GCancellable         *cancellable,
436                                                        GAsyncReadyCallback   callback,
437                                                        gpointer              user_data);
438   gboolean            (* eject_mountable_finish)      (GFile                *file,
439                                                        GAsyncResult         *result,
440                                                        GError              **error);
441
442   void                (* mount_enclosing_volume)      (GFile                *location,
443                                                        GMountMountFlags      flags,
444                                                        GMountOperation      *mount_operation,
445                                                        GCancellable         *cancellable,
446                                                        GAsyncReadyCallback   callback,
447                                                        gpointer              user_data);
448   gboolean         (* mount_enclosing_volume_finish)  (GFile                *location,
449                                                        GAsyncResult         *result,
450                                                        GError              **error);
451
452   GFileMonitor *      (* monitor_dir)                 (GFile                *file,
453                                                        GFileMonitorFlags     flags,
454                                                        GCancellable         *cancellable,
455                                                        GError              **error);
456   GFileMonitor *      (* monitor_file)                (GFile                *file,
457                                                        GFileMonitorFlags     flags,
458                                                        GCancellable         *cancellable,
459                                                        GError              **error);
460
461   GFileIOStream *     (* open_readwrite)              (GFile                *file,
462                                                        GCancellable         *cancellable,
463                                                        GError              **error);
464   void                (* open_readwrite_async)        (GFile                *file,
465                                                        int                   io_priority,
466                                                        GCancellable         *cancellable,
467                                                        GAsyncReadyCallback   callback,
468                                                        gpointer              user_data);
469   GFileIOStream *     (* open_readwrite_finish)       (GFile                *file,
470                                                        GAsyncResult         *res,
471                                                        GError              **error);
472   GFileIOStream *     (* create_readwrite)            (GFile                *file,
473                                                        GFileCreateFlags      flags,
474                                                        GCancellable         *cancellable,
475                                                        GError              **error);
476   void                (* create_readwrite_async)      (GFile                *file,
477                                                        GFileCreateFlags      flags,
478                                                        int                   io_priority,
479                                                        GCancellable         *cancellable,
480                                                        GAsyncReadyCallback   callback,
481                                                        gpointer              user_data);
482   GFileIOStream *     (* create_readwrite_finish)      (GFile                *file,
483                                                        GAsyncResult         *res,
484                                                        GError              **error);
485   GFileIOStream *     (* replace_readwrite)           (GFile                *file,
486                                                        const char           *etag,
487                                                        gboolean              make_backup,
488                                                        GFileCreateFlags      flags,
489                                                        GCancellable         *cancellable,
490                                                        GError              **error);
491   void                (* replace_readwrite_async)     (GFile                *file,
492                                                        const char           *etag,
493                                                        gboolean              make_backup,
494                                                        GFileCreateFlags      flags,
495                                                        int                   io_priority,
496                                                        GCancellable         *cancellable,
497                                                        GAsyncReadyCallback   callback,
498                                                        gpointer              user_data);
499   GFileIOStream *     (* replace_readwrite_finish)    (GFile                *file,
500                                                        GAsyncResult         *res,
501                                                        GError              **error);
502
503   void                (* start_mountable)             (GFile                *file,
504                                                        GDriveStartFlags      flags,
505                                                        GMountOperation      *start_operation,
506                                                        GCancellable         *cancellable,
507                                                        GAsyncReadyCallback   callback,
508                                                        gpointer              user_data);
509   gboolean            (* start_mountable_finish)      (GFile                *file,
510                                                        GAsyncResult         *result,
511                                                        GError              **error);
512
513   void                (* stop_mountable)              (GFile                *file,
514                                                        GMountUnmountFlags    flags,
515                                                        GMountOperation      *mount_operation,
516                                                        GCancellable         *cancellable,
517                                                        GAsyncReadyCallback   callback,
518                                                        gpointer              user_data);
519   gboolean            (* stop_mountable_finish)       (GFile                *file,
520                                                        GAsyncResult         *result,
521                                                        GError              **error);
522
523   gboolean            supports_thread_contexts;
524
525   void                (* unmount_mountable_with_operation) (GFile           *file,
526                                                        GMountUnmountFlags    flags,
527                                                        GMountOperation      *mount_operation,
528                                                        GCancellable         *cancellable,
529                                                        GAsyncReadyCallback   callback,
530                                                        gpointer              user_data);
531   gboolean            (* unmount_mountable_with_operation_finish) (GFile    *file,
532                                                        GAsyncResult         *result,
533                                                        GError              **error);
534
535   void                (* eject_mountable_with_operation) (GFile             *file,
536                                                        GMountUnmountFlags    flags,
537                                                        GMountOperation      *mount_operation,
538                                                        GCancellable         *cancellable,
539                                                        GAsyncReadyCallback   callback,
540                                                        gpointer              user_data);
541   gboolean            (* eject_mountable_with_operation_finish) (GFile      *file,
542                                                        GAsyncResult         *result,
543                                                        GError              **error);
544
545   void                (* poll_mountable)              (GFile                *file,
546                                                        GCancellable         *cancellable,
547                                                        GAsyncReadyCallback   callback,
548                                                        gpointer              user_data);
549   gboolean            (* poll_mountable_finish)       (GFile                *file,
550                                                        GAsyncResult         *result,
551                                                        GError              **error);
552 };
553
554 GType                   g_file_get_type                   (void) G_GNUC_CONST;
555
556 GFile *                 g_file_new_for_path               (const char                 *path);
557 GFile *                 g_file_new_for_uri                (const char                 *uri);
558 GFile *                 g_file_new_for_commandline_arg    (const char                 *arg);
559 GLIB_AVAILABLE_IN_2_32
560 GFile *                 g_file_new_tmp                    (const char                 *tmpl,
561                                                            GFileIOStream             **iostream,
562                                                            GError                    **error);
563 GFile *                 g_file_parse_name                 (const char                 *parse_name);
564 GFile *                 g_file_dup                        (GFile                      *file);
565 guint                   g_file_hash                       (gconstpointer               file);
566 gboolean                g_file_equal                      (GFile                      *file1,
567                                                            GFile                      *file2);
568 char *                  g_file_get_basename               (GFile                      *file);
569 char *                  g_file_get_path                   (GFile                      *file);
570 char *                  g_file_get_uri                    (GFile                      *file);
571 char *                  g_file_get_parse_name             (GFile                      *file);
572 GFile *                 g_file_get_parent                 (GFile                      *file);
573 gboolean                g_file_has_parent                 (GFile                      *file,
574                                                            GFile                      *parent);
575 GFile *                 g_file_get_child                  (GFile                      *file,
576                                                            const char                 *name);
577 GFile *                 g_file_get_child_for_display_name (GFile                      *file,
578                                                            const char                 *display_name,
579                                                            GError                    **error);
580 gboolean                g_file_has_prefix                 (GFile                      *file,
581                                                            GFile                      *prefix);
582 char *                  g_file_get_relative_path          (GFile                      *parent,
583                                                            GFile                      *descendant);
584 GFile *                 g_file_resolve_relative_path      (GFile                      *file,
585                                                            const char                 *relative_path);
586 gboolean                g_file_is_native                  (GFile                      *file);
587 gboolean                g_file_has_uri_scheme             (GFile                      *file,
588                                                            const char                 *uri_scheme);
589 char *                  g_file_get_uri_scheme             (GFile                      *file);
590 GFileInputStream *      g_file_read                       (GFile                      *file,
591                                                            GCancellable               *cancellable,
592                                                            GError                    **error);
593 void                    g_file_read_async                 (GFile                      *file,
594                                                            int                         io_priority,
595                                                            GCancellable               *cancellable,
596                                                            GAsyncReadyCallback         callback,
597                                                            gpointer                    user_data);
598 GFileInputStream *      g_file_read_finish                (GFile                      *file,
599                                                            GAsyncResult               *res,
600                                                            GError                    **error);
601 GFileOutputStream *     g_file_append_to                  (GFile                      *file,
602                                                            GFileCreateFlags             flags,
603                                                            GCancellable               *cancellable,
604                                                            GError                    **error);
605 GFileOutputStream *     g_file_create                     (GFile                      *file,
606                                                            GFileCreateFlags             flags,
607                                                            GCancellable               *cancellable,
608                                                            GError                    **error);
609 GFileOutputStream *     g_file_replace                    (GFile                      *file,
610                                                            const char                 *etag,
611                                                            gboolean                    make_backup,
612                                                            GFileCreateFlags            flags,
613                                                            GCancellable               *cancellable,
614                                                            GError                    **error);
615 void                    g_file_append_to_async            (GFile                      *file,
616                                                            GFileCreateFlags            flags,
617                                                            int                         io_priority,
618                                                            GCancellable               *cancellable,
619                                                            GAsyncReadyCallback         callback,
620                                                            gpointer                    user_data);
621 GFileOutputStream *     g_file_append_to_finish           (GFile                      *file,
622                                                            GAsyncResult               *res,
623                                                            GError                    **error);
624 void                    g_file_create_async               (GFile                      *file,
625                                                            GFileCreateFlags            flags,
626                                                            int                         io_priority,
627                                                            GCancellable               *cancellable,
628                                                            GAsyncReadyCallback         callback,
629                                                            gpointer                    user_data);
630 GFileOutputStream *     g_file_create_finish              (GFile                      *file,
631                                                            GAsyncResult               *res,
632                                                            GError                    **error);
633 void                    g_file_replace_async              (GFile                      *file,
634                                                            const char                 *etag,
635                                                            gboolean                    make_backup,
636                                                            GFileCreateFlags            flags,
637                                                            int                         io_priority,
638                                                            GCancellable               *cancellable,
639                                                            GAsyncReadyCallback         callback,
640                                                            gpointer                    user_data);
641 GFileOutputStream *     g_file_replace_finish             (GFile                      *file,
642                                                            GAsyncResult               *res,
643                                                            GError                    **error);
644 GFileIOStream *         g_file_open_readwrite             (GFile                      *file,
645                                                            GCancellable               *cancellable,
646                                                            GError                    **error);
647 void                    g_file_open_readwrite_async       (GFile                      *file,
648                                                            int                         io_priority,
649                                                            GCancellable               *cancellable,
650                                                            GAsyncReadyCallback         callback,
651                                                            gpointer                    user_data);
652 GFileIOStream *         g_file_open_readwrite_finish      (GFile                      *file,
653                                                            GAsyncResult               *res,
654                                                            GError                    **error);
655 GFileIOStream *         g_file_create_readwrite           (GFile                      *file,
656                                                            GFileCreateFlags            flags,
657                                                            GCancellable               *cancellable,
658                                                            GError                    **error);
659 void                    g_file_create_readwrite_async     (GFile                      *file,
660                                                            GFileCreateFlags            flags,
661                                                            int                         io_priority,
662                                                            GCancellable               *cancellable,
663                                                            GAsyncReadyCallback         callback,
664                                                            gpointer                    user_data);
665 GFileIOStream *         g_file_create_readwrite_finish    (GFile                      *file,
666                                                            GAsyncResult               *res,
667                                                            GError                    **error);
668 GFileIOStream *         g_file_replace_readwrite          (GFile                      *file,
669                                                            const char                 *etag,
670                                                            gboolean                    make_backup,
671                                                            GFileCreateFlags            flags,
672                                                            GCancellable               *cancellable,
673                                                            GError                    **error);
674 void                    g_file_replace_readwrite_async    (GFile                      *file,
675                                                            const char                 *etag,
676                                                            gboolean                    make_backup,
677                                                            GFileCreateFlags            flags,
678                                                            int                         io_priority,
679                                                            GCancellable               *cancellable,
680                                                            GAsyncReadyCallback         callback,
681                                                            gpointer                    user_data);
682 GFileIOStream *         g_file_replace_readwrite_finish   (GFile                      *file,
683                                                            GAsyncResult               *res,
684                                                            GError                    **error);
685 gboolean                g_file_query_exists               (GFile                      *file,
686                                                            GCancellable               *cancellable);
687 GFileType               g_file_query_file_type            (GFile                      *file,
688                                                            GFileQueryInfoFlags         flags,
689                                                            GCancellable               *cancellable);
690 GFileInfo *             g_file_query_info                 (GFile                      *file,
691                                                            const char                 *attributes,
692                                                            GFileQueryInfoFlags         flags,
693                                                            GCancellable               *cancellable,
694                                                            GError                    **error);
695 void                    g_file_query_info_async           (GFile                      *file,
696                                                            const char                 *attributes,
697                                                            GFileQueryInfoFlags         flags,
698                                                            int                         io_priority,
699                                                            GCancellable               *cancellable,
700                                                            GAsyncReadyCallback         callback,
701                                                            gpointer                    user_data);
702 GFileInfo *             g_file_query_info_finish          (GFile                      *file,
703                                                            GAsyncResult               *res,
704                                                            GError                    **error);
705 GFileInfo *             g_file_query_filesystem_info      (GFile                      *file,
706                                                            const char                 *attributes,
707                                                            GCancellable               *cancellable,
708                                                            GError                    **error);
709 void                    g_file_query_filesystem_info_async (GFile                      *file,
710                                                            const char                 *attributes,
711                                                            int                         io_priority,
712                                                            GCancellable               *cancellable,
713                                                            GAsyncReadyCallback         callback,
714                                                            gpointer                    user_data);
715 GFileInfo *             g_file_query_filesystem_info_finish (GFile                      *file,
716                                                            GAsyncResult               *res,
717                                                            GError                    **error);
718 GMount *                g_file_find_enclosing_mount       (GFile                      *file,
719                                                            GCancellable               *cancellable,
720                                                            GError                    **error);
721 void                    g_file_find_enclosing_mount_async (GFile                      *file,
722                                                            int                         io_priority,
723                                                            GCancellable               *cancellable,
724                                                            GAsyncReadyCallback         callback,
725                                                            gpointer                    user_data);
726 GMount *                g_file_find_enclosing_mount_finish (GFile                     *file,
727                                                             GAsyncResult              *res,
728                                                             GError                   **error);
729 GFileEnumerator *       g_file_enumerate_children         (GFile                      *file,
730                                                            const char                 *attributes,
731                                                            GFileQueryInfoFlags         flags,
732                                                            GCancellable               *cancellable,
733                                                            GError                    **error);
734 void                    g_file_enumerate_children_async   (GFile                      *file,
735                                                            const char                 *attributes,
736                                                            GFileQueryInfoFlags         flags,
737                                                            int                         io_priority,
738                                                            GCancellable               *cancellable,
739                                                            GAsyncReadyCallback         callback,
740                                                            gpointer                    user_data);
741 GFileEnumerator *       g_file_enumerate_children_finish  (GFile                      *file,
742                                                            GAsyncResult               *res,
743                                                            GError                    **error);
744 GFile *                 g_file_set_display_name           (GFile                      *file,
745                                                            const char                 *display_name,
746                                                            GCancellable               *cancellable,
747                                                            GError                    **error);
748 void                    g_file_set_display_name_async     (GFile                      *file,
749                                                            const char                 *display_name,
750                                                            int                         io_priority,
751                                                            GCancellable               *cancellable,
752                                                            GAsyncReadyCallback         callback,
753                                                            gpointer                    user_data);
754 GFile *                 g_file_set_display_name_finish    (GFile                      *file,
755                                                            GAsyncResult               *res,
756                                                            GError                    **error);
757 gboolean                g_file_delete                     (GFile                      *file,
758                                                            GCancellable               *cancellable,
759                                                            GError                    **error);
760
761 GLIB_AVAILABLE_IN_2_34
762 void                    g_file_delete_async               (GFile                      *file,
763                                                            int                         io_priority,
764                                                            GCancellable               *cancellable,
765                                                            GAsyncReadyCallback         callback,
766                                                            gpointer                    user_data);
767
768 GLIB_AVAILABLE_IN_2_34
769 gboolean                g_file_delete_finish              (GFile                      *file,
770                                                            GAsyncResult               *result,
771                                                            GError                    **error);
772
773 gboolean                g_file_trash                      (GFile                      *file,
774                                                            GCancellable               *cancellable,
775                                                            GError                    **error);
776 gboolean                g_file_copy                       (GFile                      *source,
777                                                            GFile                      *destination,
778                                                            GFileCopyFlags              flags,
779                                                            GCancellable               *cancellable,
780                                                            GFileProgressCallback       progress_callback,
781                                                            gpointer                    progress_callback_data,
782                                                            GError                    **error);
783 void                    g_file_copy_async                 (GFile                      *source,
784                                                            GFile                      *destination,
785                                                            GFileCopyFlags              flags,
786                                                            int                         io_priority,
787                                                            GCancellable               *cancellable,
788                                                            GFileProgressCallback       progress_callback,
789                                                            gpointer                    progress_callback_data,
790                                                            GAsyncReadyCallback         callback,
791                                                            gpointer                    user_data);
792 gboolean                g_file_copy_finish                (GFile                      *file,
793                                                            GAsyncResult               *res,
794                                                            GError                    **error);
795 gboolean                g_file_move                       (GFile                      *source,
796                                                            GFile                      *destination,
797                                                            GFileCopyFlags              flags,
798                                                            GCancellable               *cancellable,
799                                                            GFileProgressCallback       progress_callback,
800                                                            gpointer                    progress_callback_data,
801                                                            GError                    **error);
802 gboolean                g_file_make_directory             (GFile                      *file,
803                                                            GCancellable               *cancellable,
804                                                            GError                    **error);
805 gboolean                g_file_make_directory_with_parents (GFile                     *file,
806                                                            GCancellable               *cancellable,
807                                                            GError                    **error);
808 gboolean                g_file_make_symbolic_link         (GFile                      *file,
809                                                            const char                 *symlink_value,
810                                                            GCancellable               *cancellable,
811                                                            GError                    **error);
812 GFileAttributeInfoList *g_file_query_settable_attributes  (GFile                      *file,
813                                                            GCancellable               *cancellable,
814                                                            GError                    **error);
815 GFileAttributeInfoList *g_file_query_writable_namespaces  (GFile                      *file,
816                                                            GCancellable               *cancellable,
817                                                            GError                    **error);
818 gboolean                g_file_set_attribute              (GFile                      *file,
819                                                            const char                 *attribute,
820                                                            GFileAttributeType          type,
821                                                            gpointer                    value_p,
822                                                            GFileQueryInfoFlags         flags,
823                                                            GCancellable               *cancellable,
824                                                            GError                    **error);
825 gboolean                g_file_set_attributes_from_info   (GFile                      *file,
826                                                            GFileInfo                  *info,
827                                                            GFileQueryInfoFlags         flags,
828                                                            GCancellable               *cancellable,
829                                                            GError                    **error);
830 void                    g_file_set_attributes_async       (GFile                      *file,
831                                                            GFileInfo                  *info,
832                                                            GFileQueryInfoFlags         flags,
833                                                            int                         io_priority,
834                                                            GCancellable               *cancellable,
835                                                            GAsyncReadyCallback         callback,
836                                                            gpointer                    user_data);
837 gboolean                g_file_set_attributes_finish      (GFile                      *file,
838                                                            GAsyncResult               *result,
839                                                            GFileInfo                 **info,
840                                                            GError                    **error);
841 gboolean                g_file_set_attribute_string       (GFile                      *file,
842                                                            const char                 *attribute,
843                                                            const char                 *value,
844                                                            GFileQueryInfoFlags         flags,
845                                                            GCancellable               *cancellable,
846                                                            GError                    **error);
847 gboolean                g_file_set_attribute_byte_string  (GFile                      *file,
848                                                            const char                 *attribute,
849                                                            const char                 *value,
850                                                            GFileQueryInfoFlags         flags,
851                                                            GCancellable               *cancellable,
852                                                            GError                    **error);
853 gboolean                g_file_set_attribute_uint32       (GFile                      *file,
854                                                            const char                 *attribute,
855                                                            guint32                     value,
856                                                            GFileQueryInfoFlags         flags,
857                                                            GCancellable               *cancellable,
858                                                            GError                    **error);
859 gboolean                g_file_set_attribute_int32        (GFile                      *file,
860                                                            const char                 *attribute,
861                                                            gint32                      value,
862                                                            GFileQueryInfoFlags         flags,
863                                                            GCancellable               *cancellable,
864                                                            GError                    **error);
865 gboolean                g_file_set_attribute_uint64       (GFile                      *file,
866                                                            const char                 *attribute,
867                                                            guint64                     value,
868                                                            GFileQueryInfoFlags         flags,
869                                                            GCancellable               *cancellable,
870                                                            GError                    **error);
871 gboolean                g_file_set_attribute_int64        (GFile                      *file,
872                                                            const char                 *attribute,
873                                                            gint64                      value,
874                                                            GFileQueryInfoFlags         flags,
875                                                            GCancellable               *cancellable,
876                                                            GError                    **error);
877 void                    g_file_mount_enclosing_volume     (GFile                      *location,
878                                                            GMountMountFlags            flags,
879                                                            GMountOperation            *mount_operation,
880                                                            GCancellable               *cancellable,
881                                                            GAsyncReadyCallback         callback,
882                                                            gpointer                    user_data);
883 gboolean                g_file_mount_enclosing_volume_finish (GFile                      *location,
884                                                            GAsyncResult               *result,
885                                                            GError                    **error);
886 void                    g_file_mount_mountable            (GFile                      *file,
887                                                            GMountMountFlags            flags,
888                                                            GMountOperation            *mount_operation,
889                                                            GCancellable               *cancellable,
890                                                            GAsyncReadyCallback         callback,
891                                                            gpointer                    user_data);
892 GFile *                 g_file_mount_mountable_finish     (GFile                      *file,
893                                                            GAsyncResult               *result,
894                                                            GError                    **error);
895 GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation)
896 void                    g_file_unmount_mountable          (GFile                      *file,
897                                                            GMountUnmountFlags          flags,
898                                                            GCancellable               *cancellable,
899                                                            GAsyncReadyCallback         callback,
900                                                            gpointer                    user_data);
901
902 GLIB_DEPRECATED_FOR(g_file_unmount_mountable_with_operation_finish)
903 gboolean                g_file_unmount_mountable_finish   (GFile                      *file,
904                                                            GAsyncResult               *result,
905                                                            GError                    **error);
906 void                    g_file_unmount_mountable_with_operation (GFile                *file,
907                                                            GMountUnmountFlags          flags,
908                                                            GMountOperation            *mount_operation,
909                                                            GCancellable               *cancellable,
910                                                            GAsyncReadyCallback         callback,
911                                                            gpointer                    user_data);
912 gboolean                g_file_unmount_mountable_with_operation_finish (GFile         *file,
913                                                            GAsyncResult               *result,
914                                                            GError                    **error);
915 GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation)
916 void                    g_file_eject_mountable            (GFile                      *file,
917                                                            GMountUnmountFlags          flags,
918                                                            GCancellable               *cancellable,
919                                                            GAsyncReadyCallback         callback,
920                                                            gpointer                    user_data);
921
922 GLIB_DEPRECATED_FOR(g_file_eject_mountable_with_operation_finish)
923 gboolean                g_file_eject_mountable_finish     (GFile                      *file,
924                                                            GAsyncResult               *result,
925                                                            GError                    **error);
926 void                    g_file_eject_mountable_with_operation (GFile                  *file,
927                                                            GMountUnmountFlags          flags,
928                                                            GMountOperation            *mount_operation,
929                                                            GCancellable               *cancellable,
930                                                            GAsyncReadyCallback         callback,
931                                                            gpointer                    user_data);
932 gboolean                g_file_eject_mountable_with_operation_finish (GFile           *file,
933                                                            GAsyncResult               *result,
934                                                            GError                    **error);
935
936 gboolean                g_file_copy_attributes            (GFile                      *source,
937                                                            GFile                      *destination,
938                                                            GFileCopyFlags              flags,
939                                                            GCancellable               *cancellable,
940                                                            GError                    **error);
941
942
943 GFileMonitor*           g_file_monitor_directory          (GFile                  *file,
944                                                            GFileMonitorFlags       flags,
945                                                            GCancellable           *cancellable,
946                                                            GError                **error);
947 GFileMonitor*           g_file_monitor_file               (GFile                  *file,
948                                                            GFileMonitorFlags       flags,
949                                                            GCancellable           *cancellable,
950                                                            GError                **error);
951 GFileMonitor*           g_file_monitor                    (GFile                  *file,
952                                                            GFileMonitorFlags       flags,
953                                                            GCancellable           *cancellable,
954                                                            GError                **error);
955
956 void                    g_file_start_mountable            (GFile                      *file,
957                                                            GDriveStartFlags            flags,
958                                                            GMountOperation            *start_operation,
959                                                            GCancellable               *cancellable,
960                                                            GAsyncReadyCallback         callback,
961                                                            gpointer                    user_data);
962 gboolean                g_file_start_mountable_finish     (GFile                      *file,
963                                                            GAsyncResult               *result,
964                                                            GError                    **error);
965 void                    g_file_stop_mountable             (GFile                      *file,
966                                                            GMountUnmountFlags          flags,
967                                                            GMountOperation            *mount_operation,
968                                                            GCancellable               *cancellable,
969                                                            GAsyncReadyCallback         callback,
970                                                            gpointer                    user_data);
971 gboolean                g_file_stop_mountable_finish      (GFile                      *file,
972                                                            GAsyncResult               *result,
973                                                            GError                    **error);
974
975 void                    g_file_poll_mountable             (GFile                      *file,
976                                                            GCancellable               *cancellable,
977                                                            GAsyncReadyCallback         callback,
978                                                            gpointer                    user_data);
979 gboolean                g_file_poll_mountable_finish      (GFile                      *file,
980                                                            GAsyncResult               *result,
981                                                            GError                    **error);
982
983 /* Utilities */
984
985 GAppInfo *g_file_query_default_handler       (GFile                  *file,
986                                               GCancellable           *cancellable,
987                                               GError                **error);
988 gboolean g_file_load_contents                (GFile                  *file,
989                                               GCancellable           *cancellable,
990                                               char                  **contents,
991                                               gsize                  *length,
992                                               char                  **etag_out,
993                                               GError                **error);
994 void     g_file_load_contents_async          (GFile                  *file,
995                                               GCancellable           *cancellable,
996                                               GAsyncReadyCallback     callback,
997                                               gpointer                user_data);
998 gboolean g_file_load_contents_finish         (GFile                  *file,
999                                               GAsyncResult           *res,
1000                                               char                  **contents,
1001                                               gsize                  *length,
1002                                               char                  **etag_out,
1003                                               GError                **error);
1004 void     g_file_load_partial_contents_async  (GFile                  *file,
1005                                               GCancellable           *cancellable,
1006                                               GFileReadMoreCallback   read_more_callback,
1007                                               GAsyncReadyCallback     callback,
1008                                               gpointer                user_data);
1009 gboolean g_file_load_partial_contents_finish (GFile                  *file,
1010                                               GAsyncResult           *res,
1011                                               char                  **contents,
1012                                               gsize                  *length,
1013                                               char                  **etag_out,
1014                                               GError                **error);
1015 gboolean g_file_replace_contents             (GFile                  *file,
1016                                               const char             *contents,
1017                                               gsize                   length,
1018                                               const char             *etag,
1019                                               gboolean                make_backup,
1020                                               GFileCreateFlags        flags,
1021                                               char                  **new_etag,
1022                                               GCancellable           *cancellable,
1023                                               GError                **error);
1024 void     g_file_replace_contents_async       (GFile                  *file,
1025                                               const char             *contents,
1026                                               gsize                   length,
1027                                               const char             *etag,
1028                                               gboolean                make_backup,
1029                                               GFileCreateFlags        flags,
1030                                               GCancellable           *cancellable,
1031                                               GAsyncReadyCallback     callback,
1032                                               gpointer                user_data);
1033 gboolean g_file_replace_contents_finish      (GFile                  *file,
1034                                               GAsyncResult           *res,
1035                                               char                  **new_etag,
1036                                               GError                **error);
1037
1038 gboolean g_file_supports_thread_contexts     (GFile                  *file);
1039
1040 G_END_DECLS
1041
1042 #endif /* __G_FILE_H__ */