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