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