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