Interface

GioFile

Description [src]

interface Gio.File : GObject.Object

GFile is a high level abstraction for manipulating files on a virtual file system. GFiles are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that GFile objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see GInputStream and GOutputStream).

To construct a GFile, you can use:

One way to think of a GFile is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as GFiles are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.

GFiles make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with GFile using g_file_get_parent() to get an identifier for the parent directory, g_file_get_child() to get a child within a directory, and g_file_resolve_relative_path() to resolve a relative path between two GFiles. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call g_file_get_parent() on two different files.

All GFiles have a basename (get with g_file_get_basename()). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the GFile to use to actually access the file, because there is no way to go from a display name to the actual name.

Using GFile as an identifier has the same weaknesses as using a path in that there may be multiple aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE attribute. Note that GFile does some trivial canonicalization of pathnames passed in, so that trivial differences in the path string used at creation (duplicated slashes, slash at end of path, . or .. path segments, etc) does not create different GFiles.

Many GFile operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a GAsyncReadyCallback which is then used to finalize the operation, producing a GAsyncResult which is then passed to the function’s matching _finish() operation.

It is highly recommended to use asynchronous calls when running within a shared main loop, such as in the main thread of an application. This avoids I/O operations blocking other sources on the main loop from being dispatched. Synchronous I/O operations should be performed from worker threads. See the introduction to asynchronous programming section for more.

Some GFile operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:

Entity Tags

One notable feature of GFiles are entity tags, or ‘etags’ for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP ETag headers, which are a very similar concept.

Prerequisite

In order to implement File, your type must inherit fromGObject.

Functions

g_file_new_build_filename

Constructs a GFile from a series of elements using the correct separator for filenames.

since: 2.56

g_file_new_build_filenamev

Constructs a GFile from a vector of elements using the correct separator for filenames.

since: 2.78

g_file_new_for_commandline_arg

Creates a GFile with the given argument from the command line. The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.

g_file_new_for_commandline_arg_and_cwd

Creates a GFile with the given argument from the command line.

since: 2.36

g_file_new_for_path

Constructs a GFile for a given path. This operation never fails, but the returned object might not support any I/O operation if path is malformed.

g_file_new_for_uri

Constructs a GFile for a given URI. This operation never fails, but the returned object might not support any I/O operation if uri is malformed or if the uri type is not supported.

g_file_new_tmp

Opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) and returns a GFile and GFileIOStream pointing to it.

since: 2.32

g_file_new_tmp_async

Asynchronously opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_file_new_tmp().

since: 2.74

g_file_new_tmp_dir_async

Asynchronously creates a directory in the preferred directory for temporary files (as returned by g_get_tmp_dir()) as g_dir_make_tmp().

since: 2.74

g_file_new_tmp_dir_finish

Finishes a temporary directory creation started by g_file_new_tmp_dir_async().

since: 2.74

g_file_new_tmp_finish

Finishes a temporary file creation started by g_file_new_tmp_async().

since: 2.74

g_file_parse_name

Constructs a GFile with the given parse_name (i.e. something given by g_file_get_parse_name()). This operation never fails, but the returned object might not support any I/O operation if the parse_name cannot be parsed.

Instance methods

g_file_append_to

Gets an output stream for appending data to the file. If the file doesn’t already exist it is created.

g_file_append_to_async

Asynchronously opens file for appending.

g_file_append_to_finish

Finishes an asynchronous file append operation started with g_file_append_to_async().

g_file_build_attribute_list_for_copy

Prepares the file attribute query string for copying to file.

since: 2.68

g_file_copy

Copies the file source to the location specified by destination. Can not handle recursive copies of directories.

g_file_copy_async

Copies the file source to the location specified by destination asynchronously. For details of the behaviour, see g_file_copy().

g_file_copy_async_with_closures

Version of g_file_copy_async() using closures instead of callbacks for easier binding in other languages.

since: 2.82

g_file_copy_attributes

Copies the file attributes from source to destination.

g_file_copy_finish

Finishes copying the file started with g_file_copy_async().

g_file_create

Creates a new file and returns an output stream for writing to it. The file must not already exist.

g_file_create_async

Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.

g_file_create_finish

Finishes an asynchronous file create operation started with g_file_create_async().

g_file_create_readwrite

Creates a new file and returns a stream for reading and writing to it. The file must not already exist.

since: 2.22

g_file_create_readwrite_async

Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist.

since: 2.22

g_file_create_readwrite_finish

Finishes an asynchronous file create operation started with g_file_create_readwrite_async().

since: 2.22

g_file_delete

Deletes a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink().

g_file_delete_async

Asynchronously delete a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink().

since: 2.34

g_file_delete_finish

Finishes deleting a file started with g_file_delete_async().

since: 2.34

g_file_dup

Duplicates a GFile handle. This operation does not duplicate the actual file or directory represented by the GFile; see g_file_copy() if attempting to copy a file.

g_file_eject_mountable

Starts an asynchronous eject on a mountable. When this operation has completed, callback will be called with user_user data, and the operation can be finalized with g_file_eject_mountable_finish().

deprecated: 2.22 

g_file_eject_mountable_finish

Finishes an asynchronous eject operation started by g_file_eject_mountable().

deprecated: 2.22 

g_file_eject_mountable_with_operation

Starts an asynchronous eject on a mountable. When this operation has completed, callback will be called with user_user data, and the operation can be finalized with g_file_eject_mountable_with_operation_finish().

since: 2.22

g_file_eject_mountable_with_operation_finish

Finishes an asynchronous eject operation started by g_file_eject_mountable_with_operation().

since: 2.22

g_file_enumerate_children

Gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

g_file_enumerate_children_async

Asynchronously gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

g_file_enumerate_children_finish

Finishes an async enumerate children operation. See g_file_enumerate_children_async().

g_file_equal

Checks if the two given GFiles refer to the same file.

g_file_find_enclosing_mount

Gets a GMount for the GFile.

g_file_find_enclosing_mount_async

Asynchronously gets the mount for the file.

g_file_find_enclosing_mount_finish

Finishes an asynchronous find mount request. See g_file_find_enclosing_mount_async().

g_file_get_basename

Gets the base name (the last component of the path) for a given GFile.

g_file_get_child

Gets a child of file with basename equal to name.

g_file_get_child_for_display_name

Gets the child of file for a given display_name (i.e. a UTF-8 version of the name). If this function fails, it returns NULL and error will be set. This is very useful when constructing a GFile for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector.

g_file_get_parent

Gets the parent directory for the file. If the file represents the root directory of the file system, then NULL will be returned.

g_file_get_parse_name

Gets the parse name of the file. A parse name is a UTF-8 string that describes the file such that one can get the GFile back using g_file_parse_name().

g_file_get_path

Gets the local pathname for GFile, if one exists. If non-NULL, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

g_file_get_relative_path

Gets the path for descendant relative to parent.

g_file_get_uri

Gets the URI for the file.

g_file_get_uri_scheme

Gets the URI scheme for a GFile. RFC 3986 decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include “file”, “http”, “ftp”, etc.

g_file_has_parent

Checks if file has a parent, and optionally, if it is parent.

since: 2.24

g_file_has_prefix

Checks whether file has the prefix specified by prefix.

g_file_has_uri_scheme

Checks to see if a GFile has a given URI scheme.

g_file_hash

Creates a hash value for a GFile.

g_file_is_native

Checks to see if a file is native to the platform.

g_file_load_bytes

Loads the contents of file and returns it as GBytes.

since: 2.56

g_file_load_bytes_async

Asynchronously loads the contents of file as GBytes.

since: 2.56

g_file_load_bytes_finish

Completes an asynchronous request to g_file_load_bytes_async().

since: 2.56

g_file_load_contents

Loads the content of the file into memory. The data is always zero-terminated, but this is not included in the resultant length. The returned contents should be freed with g_free() when no longer needed.

g_file_load_contents_async

Starts an asynchronous load of the files contents.

g_file_load_contents_finish

Finishes an asynchronous load of the files contents. The contents are placed in contents, and length is set to the size of the contents string. The contents should be freed with g_free() when no longer needed. If etag_out is present, it will be set to the new entity tag for the file.

g_file_load_partial_contents_async

Reads the partial contents of a file. A GFileReadMoreCallback should be used to stop reading from the file when appropriate, else this function will behave exactly as g_file_load_contents_async(). This operation can be finished by g_file_load_partial_contents_finish().

g_file_load_partial_contents_finish

Finishes an asynchronous partial load operation that was started with g_file_load_partial_contents_async(). The data is always zero-terminated, but this is not included in the resultant length. The returned contents should be freed with g_free() when no longer needed.

g_file_make_directory

Creates a directory. Note that this will only create a child directory of the immediate parent directory of the path or URI given by the GFile. To recursively create directories, see g_file_make_directory_with_parents(). This function will fail if the parent directory does not exist, setting error to G_IO_ERROR_NOT_FOUND. If the file system doesn’t support creating directories, this function will fail, setting error to G_IO_ERROR_NOT_SUPPORTED.

g_file_make_directory_async

Asynchronously creates a directory.

since: 2.38

g_file_make_directory_finish

Finishes an asynchronous directory creation, started with g_file_make_directory_async().

since: 2.38

g_file_make_directory_with_parents

Creates a directory and any parent directories that may not exist similar to ‘mkdir -p’. If the file system does not support creating directories, this function will fail, setting error to G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, this function will fail setting error to G_IO_ERROR_EXISTS, unlike the similar g_mkdir_with_parents().

since: 2.18

g_file_make_symbolic_link

Creates a symbolic link named file which contains the string symlink_value.

g_file_make_symbolic_link_async

Asynchronously creates a symbolic link named file which contains the string symlink_value.

since: 2.74

g_file_make_symbolic_link_finish

Finishes an asynchronous symbolic link creation, started with g_file_make_symbolic_link_async().

since: 2.74

g_file_measure_disk_usage

Recursively measures the disk usage of file.

since: 2.38

g_file_measure_disk_usage_async

Recursively measures the disk usage of file.

since: 2.38

g_file_measure_disk_usage_finish

Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information.

since: 2.38

g_file_monitor

Obtains a file or directory monitor for the given file, depending on the type of the file.

since: 2.18

g_file_monitor_directory

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.

g_file_monitor_file

Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used.

g_file_mount_enclosing_volume

Starts a mount_operation, mounting the volume that contains the file location.

g_file_mount_enclosing_volume_finish

Finishes a mount operation started by g_file_mount_enclosing_volume().

g_file_mount_mountable

Mounts a file of type G_FILE_TYPE_MOUNTABLE. Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.

g_file_mount_mountable_finish

Finishes a mount operation. See g_file_mount_mountable() for details.

g_file_move

Tries to move the file or directory source to the location specified by destination. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.

g_file_move_async

Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().

since: 2.72

g_file_move_async_with_closures

Version of g_file_move_async() using closures instead of callbacks for easier binding in other languages.

since: 2.82

g_file_move_finish

Finishes an asynchronous file movement, started with g_file_move_async().

since: 2.72

g_file_open_readwrite

Opens an existing file for reading and writing. The result is a GFileIOStream that can be used to read and write the contents of the file.

since: 2.22

g_file_open_readwrite_async

Asynchronously opens file for reading and writing.

since: 2.22

g_file_open_readwrite_finish

Finishes an asynchronous file read operation started with g_file_open_readwrite_async().

since: 2.22

g_file_peek_path

Exactly like g_file_get_path(), but caches the result via g_object_set_qdata_full(). This is useful for example in C applications which mix g_file_* APIs with native ones. It also avoids an extra duplicated string when possible, so will be generally more efficient.

since: 2.56

g_file_poll_mountable

Polls a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

g_file_poll_mountable_finish

Finishes a poll operation. See g_file_poll_mountable() for details.

since: 2.22

g_file_query_default_handler

Returns the GAppInfo that is registered as the default application to handle the file specified by file.

g_file_query_default_handler_async

Async version of g_file_query_default_handler().

since: 2.60

g_file_query_default_handler_finish

Finishes a g_file_query_default_handler_async() operation.

since: 2.60

g_file_query_exists

Utility function to check if a particular file exists.

g_file_query_file_type

Utility function to inspect the GFileType of a file. This is implemented using g_file_query_info() and as such does blocking I/O.

since: 2.18

g_file_query_filesystem_info

Similar to g_file_query_info(), but obtains information about the filesystem the file is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

g_file_query_filesystem_info_async

Asynchronously gets the requested information about the filesystem that the specified file is on. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file).

g_file_query_filesystem_info_finish

Finishes an asynchronous filesystem info query. See g_file_query_filesystem_info_async().

g_file_query_info

Gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as the type or size of the file).

g_file_query_info_async

Asynchronously gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file).

g_file_query_info_finish

Finishes an asynchronous file info query. See g_file_query_info_async().

g_file_query_settable_attributes

Obtain the list of settable attributes for the file.

g_file_query_writable_namespaces

Obtain the list of attribute namespaces where new attributes can be created by a user. An example of this is extended attributes (in the “xattr” namespace).

g_file_read

Opens a file for reading. The result is a GFileInputStream that can be used to read the contents of the file.

g_file_read_async

Asynchronously opens file for reading.

g_file_read_finish

Finishes an asynchronous file read operation started with g_file_read_async().

g_file_replace

Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created.

g_file_replace_async

Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

g_file_replace_contents

Replaces the contents of file with contents of length bytes.

g_file_replace_contents_async

Starts an asynchronous replacement of file with the given contents of length bytes. etag will replace the document’s current entity tag.

g_file_replace_contents_bytes_async

Same as g_file_replace_contents_async() but takes a GBytes input instead. This function will keep a ref on contents until the operation is done. Unlike g_file_replace_contents_async() this allows forgetting about the content without waiting for the callback.

since: 2.40

g_file_replace_contents_finish

Finishes an asynchronous replace of the given file. See g_file_replace_contents_async(). Sets new_etag to the new entity tag for the document, if present.

g_file_replace_finish

Finishes an asynchronous file replace operation started with g_file_replace_async().

g_file_replace_readwrite

Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created.

since: 2.22

g_file_replace_readwrite_async

Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.

since: 2.22

g_file_replace_readwrite_finish

Finishes an asynchronous file replace operation started with g_file_replace_readwrite_async().

since: 2.22

g_file_resolve_relative_path

Resolves a relative path for file to an absolute path.

g_file_set_attribute

Sets an attribute in the file with attribute name attribute to value_p.

g_file_set_attribute_byte_string

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. If attribute is of a different type, this operation will fail, returning FALSE.

g_file_set_attribute_int32

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT32 to value. If attribute is of a different type, this operation will fail.

g_file_set_attribute_int64

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT64 to value. If attribute is of a different type, this operation will fail.

g_file_set_attribute_string

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_STRING to value. If attribute is of a different type, this operation will fail.

g_file_set_attribute_uint32

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT32 to value. If attribute is of a different type, this operation will fail.

g_file_set_attribute_uint64

Sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT64 to value. If attribute is of a different type, this operation will fail.

g_file_set_attributes_async

Asynchronously sets the attributes of file with info.

g_file_set_attributes_finish

Finishes setting an attribute started in g_file_set_attributes_async().

g_file_set_attributes_from_info

Tries to set all attributes in the GFileInfo on the target values, not stopping on the first error.

g_file_set_display_name

Renames file to the specified display name.

g_file_set_display_name_async

Asynchronously sets the display name for a given GFile.

g_file_set_display_name_finish

Finishes setting a display name started with g_file_set_display_name_async().

g_file_start_mountable

Starts a file of type G_FILE_TYPE_MOUNTABLE. Using start_operation, you can request callbacks when, for instance, passwords are needed during authentication.

since: 2.22

g_file_start_mountable_finish

Finishes a start operation. See g_file_start_mountable() for details.

since: 2.22

g_file_stop_mountable

Stops a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

g_file_stop_mountable_finish

Finishes a stop operation, see g_file_stop_mountable() for details.

since: 2.22

g_file_supports_thread_contexts

Checks if file supports [thread-default contexts][g-main-context-push-thread-default-context]. If this returns FALSE, you cannot perform asynchronous operations on file in a thread that has a thread-default context.

since: 2.22

g_file_trash

Sends file to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), so this call can return the G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable g_file_trash() support for particular mounts, the G_IO_ERROR_NOT_SUPPORTED error will be returned in that case. Since 2.82, the x-gvfs-trash unix mount option can be used to enable g_file_trash() support for particular system mounts.

g_file_trash_async

Asynchronously sends file to the Trash location, if possible.

since: 2.38

g_file_trash_finish

Finishes an asynchronous file trashing operation, started with g_file_trash_async().

since: 2.38

g_file_unmount_mountable

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

deprecated: 2.22 

g_file_unmount_mountable_finish

Finishes an unmount operation, see g_file_unmount_mountable() for details.

deprecated: 2.22 

g_file_unmount_mountable_with_operation

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

g_file_unmount_mountable_with_operation_finish

Finishes an unmount operation, see g_file_unmount_mountable_with_operation() for details.

since: 2.22

Interface structure

struct GioFileIface {
  GTypeInterface g_iface;
  GFile* (* dup) (
    GFile* file
  );
  guint (* hash) (
    GFile* file
  );
  gboolean (* equal) (
    GFile* file1,
    GFile* file2
  );
  gboolean (* is_native) (
    GFile* file
  );
  gboolean (* has_uri_scheme) (
    GFile* file,
    const char* uri_scheme
  );
  char* (* get_uri_scheme) (
    GFile* file
  );
  char* (* get_basename) (
    GFile* file
  );
  char* (* get_path) (
    GFile* file
  );
  char* (* get_uri) (
    GFile* file
  );
  char* (* get_parse_name) (
    GFile* file
  );
  GFile* (* get_parent) (
    GFile* file
  );
  gboolean (* prefix_matches) (
    GFile* prefix,
    GFile* file
  );
  char* (* get_relative_path) (
    GFile* parent,
    GFile* descendant
  );
  GFile* (* resolve_relative_path) (
    GFile* file,
    const char* relative_path
  );
  GFile* (* get_child_for_display_name) (
    GFile* file,
    const char* display_name,
    GError** error
  );
  GFileEnumerator* (* enumerate_children) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* enumerate_children_async) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileEnumerator* (* enumerate_children_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileInfo* (* query_info) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* query_info_async) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileInfo* (* query_info_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileInfo* (* query_filesystem_info) (
    GFile* file,
    const char* attributes,
    GCancellable* cancellable,
    GError** error
  );
  void (* query_filesystem_info_async) (
    GFile* file,
    const char* attributes,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileInfo* (* query_filesystem_info_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GMount* (* find_enclosing_mount) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* find_enclosing_mount_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GMount* (* find_enclosing_mount_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFile* (* set_display_name) (
    GFile* file,
    const char* display_name,
    GCancellable* cancellable,
    GError** error
  );
  void (* set_display_name_async) (
    GFile* file,
    const char* display_name,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFile* (* set_display_name_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileAttributeInfoList* (* query_settable_attributes) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* _query_settable_attributes_async) (
void
  );
  void (* _query_settable_attributes_finish) (
void
  );
  GFileAttributeInfoList* (* query_writable_namespaces) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* _query_writable_namespaces_async) (
void
  );
  void (* _query_writable_namespaces_finish) (
void
  );
  gboolean (* set_attribute) (
    GFile* file,
    const char* attribute,
    GFileAttributeType type,
    gpointer value_p,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  gboolean (* set_attributes_from_info) (
    GFile* file,
    GFileInfo* info,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* set_attributes_async) (
    GFile* file,
    GFileInfo* info,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* set_attributes_finish) (
    GFile* file,
    GAsyncResult* result,
    GFileInfo** info,
    GError** error
  );
  GFileInputStream* (* read_fn) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* read_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileInputStream* (* read_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileOutputStream* (* append_to) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* append_to_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileOutputStream* (* append_to_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileOutputStream* (* create) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* create_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileOutputStream* (* create_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileOutputStream* (* replace) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* replace_async) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileOutputStream* (* replace_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  gboolean (* delete_file) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* delete_file_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* delete_file_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* trash) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* trash_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* trash_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* make_directory) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* make_directory_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* make_directory_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* make_symbolic_link) (
    GFile* file,
    const char* symlink_value,
    GCancellable* cancellable,
    GError** error
  );
  void (* make_symbolic_link_async) (
    GFile* file,
    const char* symlink_value,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* make_symbolic_link_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* copy) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GError** error
  );
  void (* copy_async) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* copy_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  gboolean (* move) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GError** error
  );
  void (* move_async) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* move_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* mount_mountable) (
    GFile* file,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFile* (* mount_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* unmount_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* unmount_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* eject_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* eject_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* mount_enclosing_volume) (
    GFile* location,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* mount_enclosing_volume_finish) (
    GFile* location,
    GAsyncResult* result,
    GError** error
  );
  GFileMonitor* (* monitor_dir) (
    GFile* file,
    GFileMonitorFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  GFileMonitor* (* monitor_file) (
    GFile* file,
    GFileMonitorFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  GFileIOStream* (* open_readwrite) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  );
  void (* open_readwrite_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileIOStream* (* open_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileIOStream* (* create_readwrite) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* create_readwrite_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileIOStream* (* create_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  GFileIOStream* (* replace_readwrite) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  void (* replace_readwrite_async) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GFileIOStream* (* replace_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  );
  void (* start_mountable) (
    GFile* file,
    GDriveStartFlags flags,
    GMountOperation* start_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* start_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* stop_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* stop_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean supports_thread_contexts;
  void (* unmount_mountable_with_operation) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* unmount_mountable_with_operation_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* eject_mountable_with_operation) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* eject_mountable_with_operation_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  void (* poll_mountable) (
    GFile* file,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* poll_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  );
  gboolean (* measure_disk_usage) (
    GFile* file,
    GFileMeasureFlags flags,
    GCancellable* cancellable,
    GFileMeasureProgressCallback progress_callback,
    gpointer progress_data,
    guint64* disk_usage,
    guint64* num_dirs,
    guint64* num_files,
    GError** error
  );
  void (* measure_disk_usage_async) (
    GFile* file,
    GFileMeasureFlags flags,
    gint io_priority,
    GCancellable* cancellable,
    GFileMeasureProgressCallback progress_callback,
    gpointer progress_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gboolean (* measure_disk_usage_finish) (
    GFile* file,
    GAsyncResult* result,
    guint64* disk_usage,
    guint64* num_dirs,
    guint64* num_files,
    GError** error
  );
  gboolean (* query_exists) (
    GFile* file,
    GCancellable* cancellable
  );
  
}

An interface for writing VFS file handles.

Interface members
g_iface
GTypeInterface
 

The parent interface.

dup
GFile* (* dup) (
    GFile* file
  )
 

Duplicates a GFile.

hash
guint (* hash) (
    GFile* file
  )
 

Creates a hash of a GFile.

equal
gboolean (* equal) (
    GFile* file1,
    GFile* file2
  )
 

Checks equality of two given GFiles.

is_native
gboolean (* is_native) (
    GFile* file
  )
 

Checks to see if a file is native to the system.

has_uri_scheme
gboolean (* has_uri_scheme) (
    GFile* file,
    const char* uri_scheme
  )
 

Checks to see if a GFile has a given URI scheme.

get_uri_scheme
char* (* get_uri_scheme) (
    GFile* file
  )
 

Gets the URI scheme for a GFile.

get_basename
char* (* get_basename) (
    GFile* file
  )
 

Gets the basename for a given GFile.

get_path
char* (* get_path) (
    GFile* file
  )
 

Gets the current path within a GFile.

get_uri
char* (* get_uri) (
    GFile* file
  )
 

Gets a URI for the path within a GFile.

get_parse_name
char* (* get_parse_name) (
    GFile* file
  )
 

Gets the parsed name for the GFile.

get_parent
GFile* (* get_parent) (
    GFile* file
  )
 

Gets the parent directory for the GFile.

prefix_matches
gboolean (* prefix_matches) (
    GFile* prefix,
    GFile* file
  )
 

Checks whether a GFile contains a specified file.

get_relative_path
char* (* get_relative_path) (
    GFile* parent,
    GFile* descendant
  )
 

Gets the path for a GFile relative to a given path.

resolve_relative_path
GFile* (* resolve_relative_path) (
    GFile* file,
    const char* relative_path
  )
 

Resolves a relative path for a GFile to an absolute path.

get_child_for_display_name
GFile* (* get_child_for_display_name) (
    GFile* file,
    const char* display_name,
    GError** error
  )
 

Gets the child GFile for a given display name.

enumerate_children
GFileEnumerator* (* enumerate_children) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Gets a GFileEnumerator with the children of a GFile.

enumerate_children_async
void (* enumerate_children_async) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously gets a GFileEnumerator with the children of a GFile.

enumerate_children_finish
GFileEnumerator* (* enumerate_children_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously enumerating the children.

query_info
GFileInfo* (* query_info) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Gets the GFileInfo for a GFile.

query_info_async
void (* query_info_async) (
    GFile* file,
    const char* attributes,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously gets the GFileInfo for a GFile.

query_info_finish
GFileInfo* (* query_info_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous query info operation.

query_filesystem_info
GFileInfo* (* query_filesystem_info) (
    GFile* file,
    const char* attributes,
    GCancellable* cancellable,
    GError** error
  )
 

Gets a GFileInfo for the file system GFile is on.

query_filesystem_info_async
void (* query_filesystem_info_async) (
    GFile* file,
    const char* attributes,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously gets a GFileInfo for the file system GFile is on.

query_filesystem_info_finish
GFileInfo* (* query_filesystem_info_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously getting the file system info.

find_enclosing_mount
GMount* (* find_enclosing_mount) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Gets a GMount for the GFile.

find_enclosing_mount_async
void (* find_enclosing_mount_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously gets the GMount for a GFile.

find_enclosing_mount_finish
GMount* (* find_enclosing_mount_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously getting the volume.

set_display_name
GFile* (* set_display_name) (
    GFile* file,
    const char* display_name,
    GCancellable* cancellable,
    GError** error
  )
 

Sets the display name for a GFile.

set_display_name_async
void (* set_display_name_async) (
    GFile* file,
    const char* display_name,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously sets a GFiles display name.

set_display_name_finish
GFile* (* set_display_name_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously setting a GFiles display name.

query_settable_attributes
GFileAttributeInfoList* (* query_settable_attributes) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Returns a list of GFileAttributeInfos that can be set.

_query_settable_attributes_async
void (* _query_settable_attributes_async) (
void
  )
 

Asynchronously gets a list of GFileAttributeInfos that can be set.

_query_settable_attributes_finish
void (* _query_settable_attributes_finish) (
void
  )
 

Finishes asynchronously querying settable attributes.

query_writable_namespaces
GFileAttributeInfoList* (* query_writable_namespaces) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Returns a list of GFileAttributeInfo namespaces that are writable.

_query_writable_namespaces_async
void (* _query_writable_namespaces_async) (
void
  )
 

Asynchronously gets a list of GFileAttributeInfo namespaces that are writable.

_query_writable_namespaces_finish
void (* _query_writable_namespaces_finish) (
void
  )
 

Finishes asynchronously querying the writable namespaces.

set_attribute
gboolean (* set_attribute) (
    GFile* file,
    const char* attribute,
    GFileAttributeType type,
    gpointer value_p,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Sets a GFileAttributeInfo.

set_attributes_from_info
gboolean (* set_attributes_from_info) (
    GFile* file,
    GFileInfo* info,
    GFileQueryInfoFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Sets a GFileAttributeInfo with information from a GFileInfo.

set_attributes_async
void (* set_attributes_async) (
    GFile* file,
    GFileInfo* info,
    GFileQueryInfoFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously sets a file’s attributes.

set_attributes_finish
gboolean (* set_attributes_finish) (
    GFile* file,
    GAsyncResult* result,
    GFileInfo** info,
    GError** error
  )
 

Finishes setting a file’s attributes asynchronously.

read_fn
GFileInputStream* (* read_fn) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Reads a file asynchronously.

read_async
void (* read_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously reads a file.

read_finish
GFileInputStream* (* read_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously reading a file.

append_to
GFileOutputStream* (* append_to) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Writes to the end of a file.

append_to_async
void (* append_to_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously writes to the end of a file.

append_to_finish
GFileOutputStream* (* append_to_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous file append operation.

create
GFileOutputStream* (* create) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Creates a new file.

create_async
void (* create_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously creates a file.

create_finish
GFileOutputStream* (* create_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously creating a file.

replace
GFileOutputStream* (* replace) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Replaces the contents of a file.

replace_async
void (* replace_async) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously replaces the contents of a file.

replace_finish
GFileOutputStream* (* replace_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes asynchronously replacing a file.

delete_file
gboolean (* delete_file) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Deletes a file.

delete_file_async
void (* delete_file_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously deletes a file.

delete_file_finish
gboolean (* delete_file_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an asynchronous delete.

trash
gboolean (* trash) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Sends a GFile to the Trash location.

trash_async
void (* trash_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously sends a GFile to the Trash location.

trash_finish
gboolean (* trash_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an asynchronous file trashing operation.

make_directory
gboolean (* make_directory) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Makes a directory.

make_directory_async
void (* make_directory_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously makes a directory.

make_directory_finish
gboolean (* make_directory_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes making a directory asynchronously.

make_symbolic_link
gboolean (* make_symbolic_link) (
    GFile* file,
    const char* symlink_value,
    GCancellable* cancellable,
    GError** error
  )
 

Makes a symbolic link. NULL if symbolic links are unsupported.

make_symbolic_link_async
void (* make_symbolic_link_async) (
    GFile* file,
    const char* symlink_value,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously makes a symbolic link.

make_symbolic_link_finish
gboolean (* make_symbolic_link_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes making a symbolic link asynchronously.

copy
gboolean (* copy) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GError** error
  )
 

Copies a file. NULL if copying is unsupported, which will cause GFile to use a fallback copy method where it reads from the source and writes to the destination.

copy_async
void (* copy_async) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously copies a file.

copy_finish
gboolean (* copy_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous copy operation.

move
gboolean (* move) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GError** error
  )
 

Moves a file.

move_async
void (* move_async) (
    GFile* source,
    GFile* destination,
    GFileCopyFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GFileProgressCallback progress_callback,
    gpointer progress_callback_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously moves a file. Since: 2.72.

move_finish
gboolean (* move_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an asynchronous move operation. Since: 2.72.

mount_mountable
void (* mount_mountable) (
    GFile* file,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Mounts a mountable object.

mount_mountable_finish
GFile* (* mount_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a mounting operation.

unmount_mountable
void (* unmount_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Unmounts a mountable object.

unmount_mountable_finish
gboolean (* unmount_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an unmount operation.

eject_mountable
void (* eject_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Ejects a mountable.

eject_mountable_finish
gboolean (* eject_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an eject operation.

mount_enclosing_volume
void (* mount_enclosing_volume) (
    GFile* location,
    GMountMountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Mounts a specified location.

mount_enclosing_volume_finish
gboolean (* mount_enclosing_volume_finish) (
    GFile* location,
    GAsyncResult* result,
    GError** error
  )
 

Finishes mounting a specified location.

monitor_dir
GFileMonitor* (* monitor_dir) (
    GFile* file,
    GFileMonitorFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Creates a GFileMonitor for the location.

monitor_file
GFileMonitor* (* monitor_file) (
    GFile* file,
    GFileMonitorFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Creates a GFileMonitor for the location.

open_readwrite
GFileIOStream* (* open_readwrite) (
    GFile* file,
    GCancellable* cancellable,
    GError** error
  )
 

Open file read/write. Since 2.22.

open_readwrite_async
void (* open_readwrite_async) (
    GFile* file,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously opens file read/write. Since 2.22.

open_readwrite_finish
GFileIOStream* (* open_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous open read/write. Since 2.22.

create_readwrite
GFileIOStream* (* create_readwrite) (
    GFile* file,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Creates file read/write. Since 2.22.

create_readwrite_async
void (* create_readwrite_async) (
    GFile* file,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously creates file read/write. Since 2.22.

create_readwrite_finish
GFileIOStream* (* create_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous creates read/write. Since 2.22.

replace_readwrite
GFileIOStream* (* replace_readwrite) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    GCancellable* cancellable,
    GError** error
  )
 

Replaces file read/write. Since 2.22.

replace_readwrite_async
void (* replace_readwrite_async) (
    GFile* file,
    const char* etag,
    gboolean make_backup,
    GFileCreateFlags flags,
    int io_priority,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously replaces file read/write. Since 2.22.

replace_readwrite_finish
GFileIOStream* (* replace_readwrite_finish) (
    GFile* file,
    GAsyncResult* res,
    GError** error
  )
 

Finishes an asynchronous replace read/write. Since 2.22.

start_mountable
void (* start_mountable) (
    GFile* file,
    GDriveStartFlags flags,
    GMountOperation* start_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Starts a mountable object. Since 2.22.

start_mountable_finish
gboolean (* start_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a start operation. Since 2.22.

stop_mountable
void (* stop_mountable) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Stops a mountable. Since 2.22.

stop_mountable_finish
gboolean (* stop_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a stop operation. Since 2.22.

supports_thread_contexts
gboolean
 

A boolean that indicates whether the GFile implementation supports thread-default contexts. Since 2.22.

unmount_mountable_with_operation
void (* unmount_mountable_with_operation) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Unmounts a mountable object using a GMountOperation. Since 2.22.

unmount_mountable_with_operation_finish
gboolean (* unmount_mountable_with_operation_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an unmount operation using a GMountOperation. Since 2.22.

eject_mountable_with_operation
void (* eject_mountable_with_operation) (
    GFile* file,
    GMountUnmountFlags flags,
    GMountOperation* mount_operation,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Ejects a mountable object using a GMountOperation. Since 2.22.

eject_mountable_with_operation_finish
gboolean (* eject_mountable_with_operation_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes an eject operation using a GMountOperation. Since 2.22.

poll_mountable
void (* poll_mountable) (
    GFile* file,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Polls a mountable object for media changes. Since 2.22.

poll_mountable_finish
gboolean (* poll_mountable_finish) (
    GFile* file,
    GAsyncResult* result,
    GError** error
  )
 

Finishes a poll operation for media changes. Since 2.22.

measure_disk_usage
gboolean (* measure_disk_usage) (
    GFile* file,
    GFileMeasureFlags flags,
    GCancellable* cancellable,
    GFileMeasureProgressCallback progress_callback,
    gpointer progress_data,
    guint64* disk_usage,
    guint64* num_dirs,
    guint64* num_files,
    GError** error
  )
 

Recursively measures the disk usage of file. Since 2.38.

measure_disk_usage_async
void (* measure_disk_usage_async) (
    GFile* file,
    GFileMeasureFlags flags,
    gint io_priority,
    GCancellable* cancellable,
    GFileMeasureProgressCallback progress_callback,
    gpointer progress_data,
    GAsyncReadyCallback callback,
    gpointer user_data
  )
 

Asynchronously recursively measures the disk usage of file. Since 2.38.

measure_disk_usage_finish
gboolean (* measure_disk_usage_finish) (
    GFile* file,
    GAsyncResult* result,
    guint64* disk_usage,
    guint64* num_dirs,
    guint64* num_files,
    GError** error
  )
 

Finishes an asynchronous recursive measurement of the disk usage of file. Since 2.38.

query_exists
gboolean (* query_exists) (
    GFile* file,
    GCancellable* cancellable
  )
 

Queries whether a file exists. Since 2.84.

Virtual methods

Gio.File.append_to

Gets an output stream for appending data to the file. If the file doesn’t already exist it is created.

Gio.File.append_to_async

Asynchronously opens file for appending.

Gio.File.append_to_finish

Finishes an asynchronous file append operation started with g_file_append_to_async().

Gio.File.copy

Copies the file source to the location specified by destination. Can not handle recursive copies of directories.

Gio.File.copy_async

Copies the file source to the location specified by destination asynchronously. For details of the behaviour, see g_file_copy().

Gio.File.copy_finish

Finishes copying the file started with g_file_copy_async().

Gio.File.create

Creates a new file and returns an output stream for writing to it. The file must not already exist.

Gio.File.create_async

Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.

Gio.File.create_finish

Finishes an asynchronous file create operation started with g_file_create_async().

Gio.File.create_readwrite

Creates a new file and returns a stream for reading and writing to it. The file must not already exist.

since: 2.22

Gio.File.create_readwrite_async

Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist.

since: 2.22

Gio.File.create_readwrite_finish

Finishes an asynchronous file create operation started with g_file_create_readwrite_async().

since: 2.22

Gio.File.delete_file

Deletes a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink().

Gio.File.delete_file_async

Asynchronously delete a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as g_unlink().

since: 2.34

Gio.File.delete_file_finish

Finishes deleting a file started with g_file_delete_async().

since: 2.34

Gio.File.dup

Duplicates a GFile handle. This operation does not duplicate the actual file or directory represented by the GFile; see g_file_copy() if attempting to copy a file.

Gio.File.eject_mountable

Starts an asynchronous eject on a mountable. When this operation has completed, callback will be called with user_user data, and the operation can be finalized with g_file_eject_mountable_finish().

deprecated: 2.22 

Gio.File.eject_mountable_finish

Finishes an asynchronous eject operation started by g_file_eject_mountable().

deprecated: 2.22 

Gio.File.eject_mountable_with_operation

Starts an asynchronous eject on a mountable. When this operation has completed, callback will be called with user_user data, and the operation can be finalized with g_file_eject_mountable_with_operation_finish().

since: 2.22

Gio.File.eject_mountable_with_operation_finish

Finishes an asynchronous eject operation started by g_file_eject_mountable_with_operation().

since: 2.22

Gio.File.enumerate_children

Gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

Gio.File.enumerate_children_async

Asynchronously gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

Gio.File.enumerate_children_finish

Finishes an async enumerate children operation. See g_file_enumerate_children_async().

Gio.File.equal

Checks if the two given GFiles refer to the same file.

Gio.File.find_enclosing_mount

Gets a GMount for the GFile.

Gio.File.find_enclosing_mount_async

Asynchronously gets the mount for the file.

Gio.File.find_enclosing_mount_finish

Finishes an asynchronous find mount request. See g_file_find_enclosing_mount_async().

Gio.File.get_basename

Gets the base name (the last component of the path) for a given GFile.

Gio.File.get_child_for_display_name

Gets the child of file for a given display_name (i.e. a UTF-8 version of the name). If this function fails, it returns NULL and error will be set. This is very useful when constructing a GFile for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector.

Gio.File.get_parent

Gets the parent directory for the file. If the file represents the root directory of the file system, then NULL will be returned.

Gio.File.get_parse_name

Gets the parse name of the file. A parse name is a UTF-8 string that describes the file such that one can get the GFile back using g_file_parse_name().

Gio.File.get_path

Gets the local pathname for GFile, if one exists. If non-NULL, this is guaranteed to be an absolute, canonical path. It might contain symlinks.

Gio.File.get_relative_path

Gets the path for descendant relative to parent.

Gio.File.get_uri

Gets the URI for the file.

Gio.File.get_uri_scheme

Gets the URI scheme for a GFile. RFC 3986 decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include “file”, “http”, “ftp”, etc.

Gio.File.has_uri_scheme

Checks to see if a GFile has a given URI scheme.

Gio.File.hash

Creates a hash value for a GFile.

Gio.File.is_native

Checks to see if a file is native to the platform.

Gio.File.make_directory

Creates a directory. Note that this will only create a child directory of the immediate parent directory of the path or URI given by the GFile. To recursively create directories, see g_file_make_directory_with_parents(). This function will fail if the parent directory does not exist, setting error to G_IO_ERROR_NOT_FOUND. If the file system doesn’t support creating directories, this function will fail, setting error to G_IO_ERROR_NOT_SUPPORTED.

Gio.File.make_directory_async

Asynchronously creates a directory.

since: 2.38

Gio.File.make_directory_finish

Finishes an asynchronous directory creation, started with g_file_make_directory_async().

since: 2.38

Creates a symbolic link named file which contains the string symlink_value.

Asynchronously creates a symbolic link named file which contains the string symlink_value.

since: 2.74

Finishes an asynchronous symbolic link creation, started with g_file_make_symbolic_link_async().

since: 2.74

Gio.File.measure_disk_usage

Recursively measures the disk usage of file.

since: 2.38

Gio.File.measure_disk_usage_async

Recursively measures the disk usage of file.

since: 2.38

Gio.File.measure_disk_usage_finish

Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information.

since: 2.38

Gio.File.monitor_dir

Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.

Gio.File.monitor_file

Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used.

Gio.File.mount_enclosing_volume

Starts a mount_operation, mounting the volume that contains the file location.

Gio.File.mount_enclosing_volume_finish

Finishes a mount operation started by g_file_mount_enclosing_volume().

Gio.File.mount_mountable

Mounts a file of type G_FILE_TYPE_MOUNTABLE. Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.

Gio.File.mount_mountable_finish

Finishes a mount operation. See g_file_mount_mountable() for details.

Gio.File.move

Tries to move the file or directory source to the location specified by destination. If native move operations are supported then this is used, otherwise a copy + delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.

Gio.File.move_async

Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().

since: 2.72

Gio.File.move_finish

Finishes an asynchronous file movement, started with g_file_move_async().

since: 2.72

Gio.File.open_readwrite

Opens an existing file for reading and writing. The result is a GFileIOStream that can be used to read and write the contents of the file.

since: 2.22

Gio.File.open_readwrite_async

Asynchronously opens file for reading and writing.

since: 2.22

Gio.File.open_readwrite_finish

Finishes an asynchronous file read operation started with g_file_open_readwrite_async().

since: 2.22

Gio.File.poll_mountable

Polls a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

Gio.File.poll_mountable_finish

Finishes a poll operation. See g_file_poll_mountable() for details.

since: 2.22

Gio.File.prefix_matches

Checks whether file has the prefix specified by prefix.

Gio.File.query_exists

Utility function to check if a particular file exists.

Gio.File.query_filesystem_info

Similar to g_file_query_info(), but obtains information about the filesystem the file is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.

Gio.File.query_filesystem_info_async

Asynchronously gets the requested information about the filesystem that the specified file is on. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file).

Gio.File.query_filesystem_info_finish

Finishes an asynchronous filesystem info query. See g_file_query_filesystem_info_async().

Gio.File.query_info

Gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as the type or size of the file).

Gio.File.query_info_async

Asynchronously gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file).

Gio.File.query_info_finish

Finishes an asynchronous file info query. See g_file_query_info_async().

Gio.File.query_settable_attributes

Obtain the list of settable attributes for the file.

Gio.File.query_writable_namespaces

Obtain the list of attribute namespaces where new attributes can be created by a user. An example of this is extended attributes (in the “xattr” namespace).

Gio.File.read_async

Asynchronously opens file for reading.

Gio.File.read_finish

Finishes an asynchronous file read operation started with g_file_read_async().

Gio.File.read_fn

Opens a file for reading. The result is a GFileInputStream that can be used to read the contents of the file.

Gio.File.replace

Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created.

Gio.File.replace_async

Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

Gio.File.replace_finish

Finishes an asynchronous file replace operation started with g_file_replace_async().

Gio.File.replace_readwrite

Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. If the file doesn’t exist, it will be created.

since: 2.22

Gio.File.replace_readwrite_async

Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.

since: 2.22

Gio.File.replace_readwrite_finish

Finishes an asynchronous file replace operation started with g_file_replace_readwrite_async().

since: 2.22

Gio.File.resolve_relative_path

Resolves a relative path for file to an absolute path.

Gio.File.set_attribute

Sets an attribute in the file with attribute name attribute to value_p.

Gio.File.set_attributes_async

Asynchronously sets the attributes of file with info.

Gio.File.set_attributes_finish

Finishes setting an attribute started in g_file_set_attributes_async().

Gio.File.set_attributes_from_info

Tries to set all attributes in the GFileInfo on the target values, not stopping on the first error.

Gio.File.set_display_name

Renames file to the specified display name.

Gio.File.set_display_name_async

Asynchronously sets the display name for a given GFile.

Gio.File.set_display_name_finish

Finishes setting a display name started with g_file_set_display_name_async().

Gio.File.start_mountable

Starts a file of type G_FILE_TYPE_MOUNTABLE. Using start_operation, you can request callbacks when, for instance, passwords are needed during authentication.

since: 2.22

Gio.File.start_mountable_finish

Finishes a start operation. See g_file_start_mountable() for details.

since: 2.22

Gio.File.stop_mountable

Stops a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

Gio.File.stop_mountable_finish

Finishes a stop operation, see g_file_stop_mountable() for details.

since: 2.22

Gio.File.trash

Sends file to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), so this call can return the G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable g_file_trash() support for particular mounts, the G_IO_ERROR_NOT_SUPPORTED error will be returned in that case. Since 2.82, the x-gvfs-trash unix mount option can be used to enable g_file_trash() support for particular system mounts.

Gio.File.trash_async

Asynchronously sends file to the Trash location, if possible.

since: 2.38

Gio.File.trash_finish

Finishes an asynchronous file trashing operation, started with g_file_trash_async().

since: 2.38

Gio.File.unmount_mountable

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

deprecated: 2.22 

Gio.File.unmount_mountable_finish

Finishes an unmount operation, see g_file_unmount_mountable() for details.

deprecated: 2.22 

Gio.File.unmount_mountable_with_operation

Unmounts a file of type G_FILE_TYPE_MOUNTABLE.

since: 2.22

Gio.File.unmount_mountable_with_operation_finish

Finishes an unmount operation, see g_file_unmount_mountable_with_operation() for details.

since: 2.22