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