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