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