Gio.File¶
| Implementations: | |
|---|---|
| None | |
Methods¶
| class | new_for_commandline_arg(arg) | 
| class | new_for_commandline_arg_and_cwd(arg, cwd) | 
| class | new_for_path(path) | 
| class | new_for_uri(uri) | 
| class | new_tmp(tmpl) | 
| class | parse_name(parse_name) | 
| append_to(flags, cancellable) | |
| append_to_async(flags, io_priority, cancellable, callback, *user_data) | |
| append_to_finish(res) | |
| copy(destination, flags, cancellable, progress_callback, *progress_callback_data) | |
| copy_async(destination, flags, io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data) | |
| copy_attributes(destination, flags, cancellable) | |
| copy_finish(res) | |
| create(flags, cancellable) | |
| create_async(flags, io_priority, cancellable, callback, *user_data) | |
| create_finish(res) | |
| create_readwrite(flags, cancellable) | |
| create_readwrite_async(flags, io_priority, cancellable, callback, *user_data) | |
| create_readwrite_finish(res) | |
| delete(cancellable) | |
| delete_async(io_priority, cancellable, callback, *user_data) | |
| delete_finish(result) | |
| dup() | |
| eject_mountable(flags, cancellable, callback, *user_data) | |
| eject_mountable_finish(result) | |
| eject_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) | |
| eject_mountable_with_operation_finish(result) | |
| enumerate_children(attributes, flags, cancellable) | |
| enumerate_children_async(attributes, flags, io_priority, cancellable, callback, *user_data) | |
| enumerate_children_finish(res) | |
| equal(file2) | |
| find_enclosing_mount(cancellable) | |
| find_enclosing_mount_async(io_priority, cancellable, callback, *user_data) | |
| find_enclosing_mount_finish(res) | |
| get_basename() | |
| get_child(name) | |
| get_child_for_display_name(display_name) | |
| get_parent() | |
| get_parse_name() | |
| get_path() | |
| get_relative_path(descendant) | |
| get_uri() | |
| get_uri_scheme() | |
| has_parent(parent) | |
| has_prefix(prefix) | |
| has_uri_scheme(uri_scheme) | |
| hash() | |
| is_native() | |
| load_bytes(cancellable) | |
| load_bytes_async(cancellable, callback, *user_data) | |
| load_bytes_finish(result) | |
| load_contents(cancellable) | |
| load_contents_async(cancellable, callback, *user_data) | |
| load_contents_finish(res) | |
| load_partial_contents_finish(res) | |
| make_directory(cancellable) | |
| make_directory_async(io_priority, cancellable, callback, *user_data) | |
| make_directory_finish(result) | |
| make_directory_with_parents(cancellable) | |
| make_symbolic_link(symlink_value, cancellable) | |
| measure_disk_usage_finish(result) | |
| monitor(flags, cancellable) | |
| monitor_directory(flags, cancellable) | |
| monitor_file(flags, cancellable) | |
| mount_enclosing_volume(flags, mount_operation, cancellable, callback, *user_data) | |
| mount_enclosing_volume_finish(result) | |
| mount_mountable(flags, mount_operation, cancellable, callback, *user_data) | |
| mount_mountable_finish(result) | |
| move(destination, flags, cancellable, progress_callback, *progress_callback_data) | |
| open_readwrite(cancellable) | |
| open_readwrite_async(io_priority, cancellable, callback, *user_data) | |
| open_readwrite_finish(res) | |
| peek_path() | |
| poll_mountable(cancellable, callback, *user_data) | |
| poll_mountable_finish(result) | |
| query_default_handler(cancellable) | |
| query_default_handler_async(io_priority, cancellable, callback, *user_data) | |
| query_default_handler_finish(result) | |
| query_exists(cancellable) | |
| query_file_type(flags, cancellable) | |
| query_filesystem_info(attributes, cancellable) | |
| query_filesystem_info_async(attributes, io_priority, cancellable, callback, *user_data) | |
| query_filesystem_info_finish(res) | |
| query_info(attributes, flags, cancellable) | |
| query_info_async(attributes, flags, io_priority, cancellable, callback, *user_data) | |
| query_info_finish(res) | |
| query_settable_attributes(cancellable) | |
| query_writable_namespaces(cancellable) | |
| read(cancellable) | |
| read_async(io_priority, cancellable, callback, *user_data) | |
| read_finish(res) | |
| replace(etag, make_backup, flags, cancellable) | |
| replace_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) | |
| replace_contents(contents, etag, make_backup, flags, cancellable) | |
| replace_contents_async(contents, etag, make_backup, flags, cancellable, callback, *user_data) | |
| replace_contents_bytes_async(contents, etag, make_backup, flags, cancellable, callback, *user_data) | |
| replace_contents_finish(res) | |
| replace_finish(res) | |
| replace_readwrite(etag, make_backup, flags, cancellable) | |
| replace_readwrite_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) | |
| replace_readwrite_finish(res) | |
| resolve_relative_path(relative_path) | |
| set_attribute(attribute, type, value_p, flags, cancellable) | |
| set_attribute_byte_string(attribute, value, flags, cancellable) | |
| set_attribute_int32(attribute, value, flags, cancellable) | |
| set_attribute_int64(attribute, value, flags, cancellable) | |
| set_attribute_string(attribute, value, flags, cancellable) | |
| set_attribute_uint32(attribute, value, flags, cancellable) | |
| set_attribute_uint64(attribute, value, flags, cancellable) | |
| set_attributes_async(info, flags, io_priority, cancellable, callback, *user_data) | |
| set_attributes_finish(result) | |
| set_attributes_from_info(info, flags, cancellable) | |
| set_display_name(display_name, cancellable) | |
| set_display_name_async(display_name, io_priority, cancellable, callback, *user_data) | |
| set_display_name_finish(res) | |
| start_mountable(flags, start_operation, cancellable, callback, *user_data) | |
| start_mountable_finish(result) | |
| stop_mountable(flags, mount_operation, cancellable, callback, *user_data) | |
| stop_mountable_finish(result) | |
| supports_thread_contexts() | |
| trash(cancellable) | |
| trash_async(io_priority, cancellable, callback, *user_data) | |
| trash_finish(result) | |
| unmount_mountable(flags, cancellable, callback, *user_data) | |
| unmount_mountable_finish(result) | |
| unmount_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) | |
| unmount_mountable_with_operation_finish(result) | 
Virtual Methods¶
| do_append_to(flags, cancellable) | |
| do_append_to_async(flags, io_priority, cancellable, callback, *user_data) | |
| do_append_to_finish(res) | |
| do_copy(destination, flags, cancellable, progress_callback, progress_callback_data) | |
| do_copy_async(destination, flags, io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data) | |
| do_copy_finish(res) | |
| do_create(flags, cancellable) | |
| do_create_async(flags, io_priority, cancellable, callback, *user_data) | |
| do_create_finish(res) | |
| do_create_readwrite(flags, cancellable) | |
| do_create_readwrite_async(flags, io_priority, cancellable, callback, *user_data) | |
| do_create_readwrite_finish(res) | |
| do_delete_file(cancellable) | |
| do_delete_file_async(io_priority, cancellable, callback, *user_data) | |
| do_delete_file_finish(result) | |
| do_dup() | |
| do_eject_mountable(flags, cancellable, callback, *user_data) | |
| do_eject_mountable_finish(result) | |
| do_eject_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) | |
| do_eject_mountable_with_operation_finish(result) | |
| do_enumerate_children(attributes, flags, cancellable) | |
| do_enumerate_children_async(attributes, flags, io_priority, cancellable, callback, *user_data) | |
| do_enumerate_children_finish(res) | |
| do_equal(file2) | |
| do_find_enclosing_mount(cancellable) | |
| do_find_enclosing_mount_async(io_priority, cancellable, callback, *user_data) | |
| do_find_enclosing_mount_finish(res) | |
| do_get_basename() | |
| do_get_child_for_display_name(display_name) | |
| do_get_parent() | |
| do_get_parse_name() | |
| do_get_path() | |
| do_get_relative_path(descendant) | |
| do_get_uri() | |
| do_get_uri_scheme() | |
| do_has_uri_scheme(uri_scheme) | |
| do_hash() | |
| do_is_native() | |
| do_make_directory(cancellable) | |
| do_make_directory_async(io_priority, cancellable, callback, *user_data) | |
| do_make_directory_finish(result) | |
| do_make_symbolic_link(symlink_value, cancellable) | |
| do_measure_disk_usage_finish(result) | |
| do_monitor_dir(flags, cancellable) | |
| do_monitor_file(flags, cancellable) | |
| do_mount_enclosing_volume(flags, mount_operation, cancellable, callback, *user_data) | |
| do_mount_enclosing_volume_finish(result) | |
| do_mount_mountable(flags, mount_operation, cancellable, callback, *user_data) | |
| do_mount_mountable_finish(result) | |
| do_move(destination, flags, cancellable, progress_callback, progress_callback_data) | |
| do_open_readwrite(cancellable) | |
| do_open_readwrite_async(io_priority, cancellable, callback, *user_data) | |
| do_open_readwrite_finish(res) | |
| do_poll_mountable(cancellable, callback, *user_data) | |
| do_poll_mountable_finish(result) | |
| do_prefix_matches(file) | |
| do_query_filesystem_info(attributes, cancellable) | |
| do_query_filesystem_info_async(attributes, io_priority, cancellable, callback, *user_data) | |
| do_query_filesystem_info_finish(res) | |
| do_query_info(attributes, flags, cancellable) | |
| do_query_info_async(attributes, flags, io_priority, cancellable, callback, *user_data) | |
| do_query_info_finish(res) | |
| do_query_settable_attributes(cancellable) | |
| do_query_writable_namespaces(cancellable) | |
| do_read_async(io_priority, cancellable, callback, *user_data) | |
| do_read_finish(res) | |
| do_read_fn(cancellable) | |
| do_replace(etag, make_backup, flags, cancellable) | |
| do_replace_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) | |
| do_replace_finish(res) | |
| do_replace_readwrite(etag, make_backup, flags, cancellable) | |
| do_replace_readwrite_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) | |
| do_replace_readwrite_finish(res) | |
| do_resolve_relative_path(relative_path) | |
| do_set_attribute(attribute, type, value_p, flags, cancellable) | |
| do_set_attributes_async(info, flags, io_priority, cancellable, callback, *user_data) | |
| do_set_attributes_finish(result) | |
| do_set_attributes_from_info(info, flags, cancellable) | |
| do_set_display_name(display_name, cancellable) | |
| do_set_display_name_async(display_name, io_priority, cancellable, callback, *user_data) | |
| do_set_display_name_finish(res) | |
| do_start_mountable(flags, start_operation, cancellable, callback, *user_data) | |
| do_start_mountable_finish(result) | |
| do_stop_mountable(flags, mount_operation, cancellable, callback, *user_data) | |
| do_stop_mountable_finish(result) | |
| do_trash(cancellable) | |
| do_trash_async(io_priority, cancellable, callback, *user_data) | |
| do_trash_finish(result) | |
| do_unmount_mountable(flags, cancellable, callback, *user_data) | |
| do_unmount_mountable_finish(result) | |
| do_unmount_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) | |
| do_unmount_mountable_with_operation_finish(result) | 
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- 
class Gio.File¶
- Bases: - GObject.GInterface- Structure: - Gio.FileIface- Gio.Fileis a high level abstraction for manipulating files on a virtual file system.- Gio.Filesare lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that- Gio.Fileobjects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see- Gio.InputStreamand- Gio.OutputStream).- To construct a - Gio.File, you can use:- Gio.File.new_for_path() if you have a path.
- Gio.File.new_for_uri() if you have a URI.
- Gio.File.new_for_commandline_arg() for a command line argument.
- Gio.File.new_tmp() to create a temporary file from a template.
- Gio.File.parse_name() from a UTF-8 string gotten from- Gio.File.get_parse_name().
- g_file_new_build_filename() to create a file from path elements.
 - One way to think of a - Gio.Fileis as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as- Gio.Filesare extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.- Gio.Filesmake up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with- Gio.Fileusing- Gio.File.get_parent() to get an identifier for the parent directory,- Gio.File.get_child() to get a child within a directory,- Gio.File.resolve_relative_path() to resolve a relative path between two- Gio.Files. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call- Gio.File.get_parent() on two different files.- All - Gio.Fileshave a basename (get with- Gio.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- Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAMEattribute with- Gio.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- Gio.Fileto use to actually access the file, because there is no way to go from a display name to the actual name.- Using - Gio.Fileas 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- Gio.Filesto 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- Gio.Filespoint to the same file you can query for the- Gio.FILE_ATTRIBUTE_ID_FILEattribute. Note that- Gio.Filedoes 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- Gio.Files.- Many - Gio.Fileoperations 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- Gio.AsyncReadyCallbackwhich is then used to finalize the operation, producing a- Gio.AsyncResultwhich 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 - Gio.Fileoperations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:- Gio.File.mount_mountable() to mount a mountable file.
- Gio.File.unmount_mountable_with_operation() to unmount a mountable file.
- Gio.File.eject_mountable_with_operation() to eject a mountable file.
 - Entity Tags
 - One notable feature of - Gio.Filesare 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.- 
classmethod new_for_commandline_arg(arg)[source]¶
- Parameters: - arg ( - str) – a command line string- Returns: - a new - Gio.File. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Creates a - Gio.Filewith 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.- Note that on Windows, this function expects its argument to be in UTF-8 – not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. - Gio.Applicationalso uses UTF-8 but- Gio.ApplicationCommandLine.create_file_for_arg() may be more useful for you there. It is also always possible to use this function with- GLib.OptionContextarguments of type- GLib.OptionArg.FILENAME.
 - 
classmethod new_for_commandline_arg_and_cwd(arg, cwd)[source]¶
- Parameters: - Returns: - a new - Gio.File- Return type: - Creates a - Gio.Filewith the given argument from the command line.- This function is similar to - Gio.File.new_for_commandline_arg() except that it allows for passing the current working directory as an argument instead of using the current working directory of the process.- This is useful if the commandline argument was given in a context other than the invocation of the current process. - See also - Gio.ApplicationCommandLine.create_file_for_arg().- New in version 2.36. 
 - 
classmethod new_for_path(path)[source]¶
- Parameters: - path ( - str) – a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.- Returns: - a new - Gio.Filefor the given path. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Constructs a - Gio.Filefor a given path. This operation never fails, but the returned object might not support any I/O operation if path is malformed.
 - 
classmethod new_for_uri(uri)[source]¶
- Parameters: - uri ( - str) – a UTF-8 string containing a URI- Returns: - a new - Gio.Filefor the given uri. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Constructs a - Gio.Filefor 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.
 - 
classmethod new_tmp(tmpl)[source]¶
- Parameters: - tmpl ( - stror- None) – Template for the file name, as in- GLib.file_open_tmp(), or- Nonefor a default template- Raises: - GLib.Error- Returns: - a new - Gio.File. Free the returned object with- GObject.Object.unref().- iostream: - on return, a - Gio.FileIOStreamfor the created file- Return type: - ( - Gio.File, iostream:- Gio.FileIOStream)- Opens a file in the preferred directory for temporary files (as returned by - GLib.get_tmp_dir()) and returns a- Gio.Fileand- Gio.FileIOStreampointing to it.- tmpl should be a string in the GLib file name encoding containing a sequence of six ‘X’ characters, and containing no directory components. If it is - None, a default template is used.- Unlike the other - Gio.Fileconstructors, this will return- Noneif a temporary file could not be created.- New in version 2.32. 
 - 
classmethod parse_name(parse_name)[source]¶
- Parameters: - parse_name ( - str) – a file name or path to be parsed- Returns: - a new - Gio.File.- Return type: - Gio.File- Constructs a - Gio.Filewith the given parse_name (i.e. something given by- Gio.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.
 - 
append_to(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileOutputStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets an output stream for appending data to the file. If the file doesn’t already exist it is created. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- Some file systems don’t allow all file names, and may return an - Gio.IOErrorEnum.INVALID_FILENAMEerror. If the file is a directory the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- flags (
 - 
append_to_async(flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens self for appending. - For more details, see - Gio.File.append_to() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.append_to_finish() to get the result of the operation.
- flags (
 - 
append_to_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) –- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a valid - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file append operation started with - Gio.File.append_to_async().
 - 
copy(destination, flags, cancellable, progress_callback, *progress_callback_data)[source]¶
- Parameters: - destination (Gio.File) – destinationGio.File
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) – function to callback with progress information, orNoneif progress information is not needed
- progress_callback_data (objectorNone) – user data to pass to progress_callback
 - Raises: - Returns: - Return type: - Copies the file self to the location specified by destination. Can not handle recursive copies of directories. - If the flag - Gio.FileCopyFlags.OVERWRITEis specified an already existing destination file is overwritten.- If the flag - Gio.FileCopyFlags.NOFOLLOW_SYMLINKSis specified then symlinks will be copied as symlinks, otherwise the target of the self symlink will be copied.- If the flag - Gio.FileCopyFlags.ALL_METADATAis specified then all the metadata that is possible to copy is copied, not just the default subset (which, for instance, does not include the owner, see- Gio.FileInfo).- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If progress_callback is not - None, then the operation can be monitored by setting this to a- Gio.FileProgressCallbackfunction. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.- If the self file does not exist, then the - Gio.IOErrorEnum.NOT_FOUNDerror is returned, independent on the status of the destination.- If - Gio.FileCopyFlags.OVERWRITEis not specified and the target exists, then the error- Gio.IOErrorEnum.EXISTSis returned.- If trying to overwrite a file over a directory, the - Gio.IOErrorEnum.IS_DIRECTORYerror is returned. If trying to overwrite a directory with a directory the- Gio.IOErrorEnum.WOULD_MERGEerror is returned.- If the source is a directory and the target does not exist, or - Gio.FileCopyFlags.OVERWRITEis specified and the target is a file, then the- Gio.IOErrorEnum.WOULD_RECURSEerror is returned.- If you are interested in copying the - Gio.Fileobject itself (not the on-disk file), see- Gio.File.dup().
- destination (
 - 
copy_async(destination, flags, io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data)[source]¶
- Parameters: - destination (Gio.File) – destinationGio.File
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) – function to callback with progress information, orNoneif progress information is not needed
- progress_callback_data (objectorNone) – user data to pass to progress_callback
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Copies the file self to the location specified by destination asynchronously. For details of the behaviour, see - Gio.File.copy().- If progress_callback is not - None, then that function that will be called just like in- Gio.File.copy(). The callback will run in the default main context of the thread calling- Gio.File.copy_async() — the same context as callback is run in.- When the operation is finished, callback will be called. You can then call - Gio.File.copy_finish() to get the result of the operation.
- destination (
 - 
copy_attributes(destination, flags, cancellable)[source]¶
- Parameters: - destination (Gio.File) – aGio.Fileto copy attributes to
- flags (Gio.FileCopyFlags) – a set ofGio.FileCopyFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attributes were copied successfully,- Falseotherwise.- Return type: - Copies the file attributes from self to destination. - Normally only a subset of the file attributes are copied, those that are copies in a normal file copy operation (which for instance does not include e.g. owner). However if - Gio.FileCopyFlags.ALL_METADATAis specified in flags, then all the metadata that is possible to copy is copied. This is useful when implementing move by copy + delete source.
- destination (
 - 
copy_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Trueon success,- Falseon error.- Return type: - bool- Finishes copying the file started with - Gio.File.copy_async().
 - 
create(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileOutputStreamfor the newly created file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Creates a new file and returns an output stream for writing to it. The file must not already exist. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If a file or directory with this name already exists the - Gio.IOErrorEnum.EXISTSerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is to long- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- flags (
 - 
create_async(flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist. - For more details, see - Gio.File.create() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.create_finish() to get the result of the operation.
- flags (
 - 
create_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file create operation started with - Gio.File.create_async().
 - 
create_readwrite(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileIOStreamfor the newly created file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Creates a new file and returns a stream for reading and writing to it. The file must not already exist. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If a file or directory with this name already exists, the - Gio.IOErrorEnum.EXISTSerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is too long,- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.- Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing. - New in version 2.22. 
- flags (
 - 
create_readwrite_async(flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist. - For more details, see - Gio.File.create_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.create_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
create_readwrite_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file create operation started with - Gio.File.create_readwrite_async().- New in version 2.22. 
 - 
delete(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - Trueif the file was deleted.- Falseotherwise.- Return type: - bool- Deletes a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as - GLib.unlink().- If self doesn’t exist, - Gio.IOErrorEnum.NOT_FOUNDwill be returned. This allows for deletion to be implemented avoiding time-of-check to time-of-use races :- g_autoptr(GError) local_error = NULL; if (!g_file_delete (my_file, my_cancellable, &local_error) && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { // deletion failed for some reason other than the file not existing: // so report the error g_warning ("Failed to delete %s: %s", g_file_peek_path (my_file), local_error->message); }- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
delete_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously delete a file. If the self is a directory, it will only be deleted if it is empty. This has the same semantics as - GLib.unlink().- New in version 2.34. 
- io_priority (
 - 
delete_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the file was deleted.- Falseotherwise.- Return type: - bool- Finishes deleting a file started with - Gio.File.delete_async().- New in version 2.34. 
 - 
dup()[source]¶
- Returns: - a new - Gio.Filethat is a duplicate of the given- Gio.File.- Return type: - Gio.File- Duplicates a - Gio.Filehandle. This operation does not duplicate the actual file or directory represented by the- Gio.File; see- Gio.File.copy() if attempting to copy a file.- Gio.File.dup() is useful when a second handle is needed to the same underlying file, for use in a separate thread (- Gio.Fileis not thread-safe). For use within the same thread, use- GObject.Object.ref() to increment the existing object’s reference count.- This call does no blocking I/O. 
 - 
eject_mountable(flags, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.File.eject_mountable_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- Deprecated since version 2.22: Use - Gio.File.eject_mountable_with_operation() instead.
- flags (
 - 
eject_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the self was ejected successfully.- Falseotherwise.- Return type: - bool- Finishes an asynchronous eject operation started by - Gio.File.eject_mountable().- Deprecated since version 2.22: Use - Gio.File.eject_mountable_with_operation_finish() instead.
 - 
eject_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.File.eject_mountable_with_operation_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- New in version 2.22. 
- flags (
 - 
eject_mountable_with_operation_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the self was ejected successfully.- Falseotherwise.- Return type: - bool- Finishes an asynchronous eject operation started by - Gio.File.eject_mountable_with_operation().- New in version 2.22. 
 - 
enumerate_children(attributes, flags, cancellable)[source]¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - A - Gio.FileEnumeratorif successful,- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets the requested information about the files in a directory. The result is a - Gio.FileEnumeratorobject that will give out- Gio.FileInfoobjects for all the files in the directory.- The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “standard::*” means all attributes in the standard namespace. An example attribute query be “standard::*,owner::user”. The standard attributes are available as defines, like - Gio.FILE_ATTRIBUTE_STANDARD_NAME.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is not a directory, the- Gio.IOErrorEnum.NOT_DIRECTORYerror will be returned. Other errors are possible too.
- attributes (
 - 
enumerate_children_async(attributes, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about the files in a directory. The result is a - Gio.FileEnumeratorobject that will give out- Gio.FileInfoobjects for all the files in the directory.- For more details, see - Gio.File.enumerate_children() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.enumerate_children_finish() to get the result of the operation.
- attributes (
 - 
enumerate_children_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileEnumeratoror- Noneif an error occurred. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileEnumerator- Finishes an async enumerate children operation. See - Gio.File.enumerate_children_async().
 - 
equal(file2)[source]¶
- Parameters: - file2 ( - Gio.File) – the second- Gio.File- Returns: - Trueif self and file2 are equal.- Return type: - bool- Checks if the two given - Gio.Filesrefer to the same file.- Note that two - Gio.Filesthat differ can still refer to the same file on the filesystem due to various forms of filename aliasing.- This call does no blocking I/O. 
 - 
find_enclosing_mount(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - a - Gio.Mountwhere the self is located or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Gets a - Gio.Mountfor the- Gio.File.- Gio.Mountis returned only for user interesting locations, see- Gio.VolumeMonitor. If the- Gio.FileIfacefor self does not have a #mount, error will be set to- Gio.IOErrorEnum.NOT_FOUNDand- None#will be returned.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
find_enclosing_mount_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the mount for the file. - For more details, see - Gio.File.find_enclosing_mount() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.find_enclosing_mount_finish() to get the result of the operation.
- io_priority (
 - 
find_enclosing_mount_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Gio.Mountfor given self or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Finishes an asynchronous find mount request. See - Gio.File.find_enclosing_mount_async().
 - 
get_basename()[source]¶
- Returns: - string containing the - Gio.File’s base name, or- Noneif given- Gio.Fileis invalid. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - stror- None- Gets the base name (the last component of the path) for a given - Gio.File.- If called for the top level of a system (such as the filesystem root or a uri like sftp://host/) it will return a single directory separator (and on Windows, possibly a drive letter). - The base name is a byte string (not UTF-8). It has no defined encoding or rules other than it may not contain zero bytes. If you want to use filenames in a user interface you should use the display name that you can get by requesting the - Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAMEattribute with- Gio.File.query_info().- This call does no blocking I/O. 
 - 
get_child(name)[source]¶
- Parameters: - name ( - str) – string containing the child’s basename- Returns: - a - Gio.Fileto a child specified by name. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Gets a child of self with basename equal to name. - Note that the file with that specific name might not exist, but you can still have a - Gio.Filethat points to it. You can use this for instance to create that file.- This call does no blocking I/O. 
 - 
get_child_for_display_name(display_name)[source]¶
- Parameters: - display_name ( - str) – string to a possible child- Raises: - GLib.Error- Returns: - a - Gio.Fileto the specified child, or- Noneif the display name couldn’t be converted. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Gets the child of self for a given display_name (i.e. a UTF-8 version of the name). If this function fails, it returns - Noneand error will be set. This is very useful when constructing a- Gio.Filefor 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.- This call does no blocking I/O. 
 - 
get_parent()[source]¶
- Returns: - a - Gio.Filestructure to the parent of the given- Gio.Fileor- Noneif there is no parent. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Fileor- None- Gets the parent directory for the self. If the self represents the root directory of the file system, then - Nonewill be returned.- This call does no blocking I/O. 
 - 
get_parse_name()[source]¶
- Returns: - a string containing the - Gio.File’s parse name. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- Gets the parse name of the self. A parse name is a UTF-8 string that describes the file such that one can get the - Gio.Fileback using- Gio.File.parse_name().- This is generally used to show the - Gio.Fileas a nice full-pathname kind of string in a user interface, like in a location entry.- For local files with names that can safely be converted to UTF-8 the pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 characters unescaped). - This call does no blocking I/O. 
 - 
get_path()[source]¶
- Returns: - string containing the - Gio.File’s path, or- Noneif no such path exists. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - stror- None- Gets the local pathname for - Gio.File, if one exists. If non-- None, this is guaranteed to be an absolute, canonical path. It might contain symlinks.- This call does no blocking I/O. 
 - 
get_relative_path(descendant)[source]¶
- Parameters: - descendant ( - Gio.File) – input- Gio.File- Returns: - string with the relative path from descendant to self, or - Noneif descendant doesn’t have self as prefix. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - stror- None- Gets the path for descendant relative to self. - This call does no blocking I/O. 
 - 
get_uri()[source]¶
- Returns: - a string containing the - Gio.File’s URI. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- Gets the URI for the self. - This call does no blocking I/O. 
 - 
get_uri_scheme()[source]¶
- Returns: - a string containing the URI scheme for the given - Gio.File. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- Gets the URI scheme for a - Gio.File. RFC 3986 decodes the scheme as:- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]- Common schemes include “file”, “http”, “ftp”, etc. - This call does no blocking I/O. 
 - 
has_parent(parent)[source]¶
- Parameters: - parent ( - Gio.Fileor- None) – the parent to check for, or- None- Returns: - Trueif self is an immediate child of parent (or any parent in the case that parent is- None).- Return type: - bool- Checks if self has a parent, and optionally, if it is parent. - If parent is - Nonethen this function returns- Trueif self has any parent at all. If parent is non-- Nonethen- Trueis only returned if self is an immediate child of parent.- New in version 2.24. 
 - 
has_prefix(prefix)[source]¶
- Parameters: - prefix ( - Gio.File) – input- Gio.File- Returns: - Trueif the self’s parent, grandparent, etc is prefix,- Falseotherwise.- Return type: - bool- Checks whether self has the prefix specified by prefix. - In other words, if the names of initial elements of self’s pathname match prefix. Only full pathname elements are matched, so a path like /foo is not considered a prefix of /foobar, only of /foo/bar. - A - Gio.Fileis not a prefix of itself. If you want to check for equality, use- Gio.File.equal().- This call does no I/O, as it works purely on names. As such it can sometimes return - Falseeven if self is inside a prefix (from a filesystem point of view), because the prefix of self is an alias of prefix.
 - 
has_uri_scheme(uri_scheme)[source]¶
- Parameters: - uri_scheme ( - str) – a string containing a URI scheme- Returns: - Trueif- Gio.File’s backend supports the given URI scheme,- Falseif URI scheme is- None, not supported, or- Gio.Fileis invalid.- Return type: - bool- Checks to see if a - Gio.Filehas a given URI scheme.- This call does no blocking I/O. 
 - 
hash()[source]¶
- Returns: - 0 if self is not a valid - Gio.File, otherwise an integer that can be used as hash value for the- Gio.File. This function is intended for easily hashing a- Gio.Fileto add to a- GLib.HashTableor similar data structure.- Return type: - int- Creates a hash value for a - Gio.File.- This call does no blocking I/O. 
 - 
is_native()[source]¶
- Returns: - Trueif self is native- Return type: - bool- Checks to see if a file is native to the platform. - A native file is one expressed in the platform-native filename format, e.g. “C:\Windows” or “/usr/bin/”. This does not mean the file is local, as it might be on a locally mounted remote filesystem. - On some systems non-native files may be available using the native filesystem via a userspace filesystem (FUSE), in these cases this call will return - False, but- Gio.File.get_path() will still return a native path.- This call does no blocking I/O. 
 - 
load_bytes(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellableor- None- Raises: - GLib.Error- Returns: - a - GLib.Bytesor- Noneand error is set- etag_out: - a location to place the current entity tag for the file, or - Noneif the entity tag is not needed- Return type: - ( - GLib.Bytes, etag_out:- stror- None)- Loads the contents of self and returns it as - GLib.Bytes.- If self is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling - Gio.File.load_contents() and- GLib.Bytes.new_take().- For resources, etag_out will be set to - None.- The data contained in the resulting - GLib.Bytesis always zero-terminated, but this is not included in the- GLib.Byteslength. The resulting- GLib.Bytesshould be freed with- GLib.Bytes.unref() when no longer in use.- New in version 2.56. 
 - 
load_bytes_async(cancellable, callback, *user_data)[source]¶
- Parameters: - cancellable (Gio.CancellableorNone) – aGio.CancellableorNone
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously loads the contents of self as - GLib.Bytes.- If self is a resource:// based URI, the resulting bytes will reference the embedded resource instead of a copy. Otherwise, this is equivalent to calling - Gio.File.load_contents_async() and- GLib.Bytes.new_take().- callback should call - Gio.File.load_bytes_finish() to get the result of this asynchronous operation.- See - Gio.File.load_bytes() for more information.- New in version 2.56. 
- cancellable (
 - 
load_bytes_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResultprovided to the callback- Raises: - GLib.Error- Returns: - a - GLib.Bytesor- Noneand error is set- etag_out: - a location to place the current entity tag for the file, or - Noneif the entity tag is not needed- Return type: - ( - GLib.Bytes, etag_out:- stror- None)- Completes an asynchronous request to - Gio.File.load_bytes_async().- For resources, etag_out will be set to - None.- The data contained in the resulting - GLib.Bytesis always zero-terminated, but this is not included in the- GLib.Byteslength. The resulting- GLib.Bytesshould be freed with- GLib.Bytes.unref() when no longer in use.- See - Gio.File.load_bytes() for more information.- New in version 2.56. 
 - 
load_contents(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - Trueif the self’s contents were successfully loaded.- Falseif there were errors.- contents: - a location to place the contents of the file - etag_out: - a location to place the current entity tag for the file, or - Noneif the entity tag is not needed- Return type: - ( - bool, contents:- bytes, etag_out:- str)- 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 - GLib.free() when no longer needed.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
load_contents_async(cancellable, callback, *user_data)[source]¶
- Parameters: - cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Starts an asynchronous load of the self’s contents. - For more details, see - Gio.File.load_contents() which is the synchronous version of this call.- When the load operation has completed, callback will be called with user data. To finish the operation, call - Gio.File.load_contents_finish() with the- Gio.AsyncResultreturned by the callback.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- cancellable (
 - 
load_contents_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the load was successful. If- Falseand error is present, it will be set appropriately.- contents: - a location to place the contents of the file - etag_out: - a location to place the current entity tag for the file, or - Noneif the entity tag is not needed- Return type: - ( - bool, contents:- bytes, etag_out:- str)- Finishes an asynchronous load of the self’s contents. The contents are placed in contents, and length is set to the size of the contents string. The contents should be freed with - GLib.free() when no longer needed. If etag_out is present, it will be set to the new entity tag for the self.
 - 
load_partial_contents_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the load was successful. If- Falseand error is present, it will be set appropriately.- contents: - a location to place the contents of the file - etag_out: - a location to place the current entity tag for the file, or - Noneif the entity tag is not needed- Return type: - ( - bool, contents:- bytes, etag_out:- str)- 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 - GLib.free() when no longer needed.
 - 
make_directory(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - Trueon successful creation,- Falseotherwise.- Return type: - bool- 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 - Gio.File. To recursively create directories, see- Gio.File.make_directory_with_parents(). This function will fail if the parent directory does not exist, setting error to- Gio.IOErrorEnum.NOT_FOUND. If the file system doesn’t support creating directories, this function will fail, setting error to- Gio.IOErrorEnum.NOT_SUPPORTED.- For a local - Gio.Filethe newly created directory will have the default (current) ownership and permissions of the current process.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
make_directory_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a directory. - New in version 2.38. 
- io_priority (
 - 
make_directory_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon successful directory creation,- Falseotherwise.- Return type: - bool- Finishes an asynchronous directory creation, started with - Gio.File.make_directory_async().- New in version 2.38. 
 - 
make_directory_with_parents(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - Trueif all directories have been successfully created,- Falseotherwise.- Return type: - bool- 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 - Gio.IOErrorEnum.NOT_SUPPORTED. If the directory itself already exists, this function will fail setting error to- Gio.IOErrorEnum.EXISTS, unlike the similar- GLib.mkdir_with_parents().- For a local - Gio.Filethe newly created directories will have the default (current) ownership and permissions of the current process.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- New in version 2.18. 
 - 
make_symbolic_link(symlink_value, cancellable)[source]¶
- Parameters: - symlink_value (str) – a string with the path for the target of the new symlink
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Return type: - Creates a symbolic link named self which contains the string symlink_value. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- symlink_value (
 - 
measure_disk_usage_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – the- Gio.AsyncResultpassed to your- Gio.AsyncReadyCallback- Raises: - GLib.Error- Returns: - Trueif successful, with the out parameters set.- Falseotherwise, with error set.- disk_usage: - the number of bytes of disk space used - num_dirs: - the number of directories encountered - num_files: - the number of non-directories encountered - Return type: - ( - bool, disk_usage:- int, num_dirs:- int, num_files:- int)- Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information. - New in version 2.38. 
 - 
monitor(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileMonitorFlags) – a set ofGio.FileMonitorFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileMonitorfor the given self, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Obtains a file or directory monitor for the given file, depending on the type of the file. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- New in version 2.18. 
- flags (
 - 
monitor_directory(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileMonitorFlags) – a set ofGio.FileMonitorFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileMonitorfor the given self, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- It does not make sense for flags to contain - Gio.FileMonitorFlags.WATCH_HARD_LINKS, since hard links can not be made to directories. It is not possible to monitor all the files in a directory for changes made via hard links; if you want to do this then you must register individual watches with- Gio.File.monitor().
- flags (
 - 
monitor_file(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileMonitorFlags) – a set ofGio.FileMonitorFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileMonitorfor the given self, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If flags contains - Gio.FileMonitorFlags.WATCH_HARD_LINKSthen the monitor will also attempt to report changes made to the file via another filename (ie, a hard link). Without this flag, you can only rely on changes made through the filename contained in self to be reported. Using this flag may result in an increase in resource usage, and may not have any effect depending on the- Gio.FileMonitorbackend and/or filesystem type.
- flags (
 - 
mount_enclosing_volume(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountMountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Starts a mount_operation, mounting the volume that contains the file self. - When this operation has completed, callback will be called with user_user data, and the operation can be finalized with - Gio.File.mount_enclosing_volume_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- flags (
 - 
mount_enclosing_volume_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif successful. If an error has occurred, this function will return- Falseand set error appropriately if present.- Return type: - bool- Finishes a mount operation started by - Gio.File.mount_enclosing_volume().
 - 
mount_mountable(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountMountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Mounts a file of type - Gio.FileType.MOUNTABLE. Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.
- flags (
 - 
mount_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.Fileor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Finishes a mount operation. See - Gio.File.mount_mountable() for details.- Finish an asynchronous mount operation that was started with - Gio.File.mount_mountable().
 - 
move(destination, flags, cancellable, progress_callback, *progress_callback_data)[source]¶
- Parameters: - destination (Gio.File) –Gio.Filepointing to the destination location
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) –Gio.FileProgressCallbackfunction for updates
- progress_callback_data (objectorNone) –objectto user data for the callback function
 - Raises: - Returns: - Return type: - Tries to move the file or directory self 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. - If the flag - Gio.FileCopyFlags.OVERWRITEis specified an already existing destination file is overwritten.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If progress_callback is not - None, then the operation can be monitored by setting this to a- Gio.FileProgressCallbackfunction. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.- If the self file does not exist, then the - Gio.IOErrorEnum.NOT_FOUNDerror is returned, independent on the status of the destination.- If - Gio.FileCopyFlags.OVERWRITEis not specified and the target exists, then the error- Gio.IOErrorEnum.EXISTSis returned.- If trying to overwrite a file over a directory, the - Gio.IOErrorEnum.IS_DIRECTORYerror is returned. If trying to overwrite a directory with a directory the- Gio.IOErrorEnum.WOULD_MERGEerror is returned.- If the source is a directory and the target does not exist, or - Gio.FileCopyFlags.OVERWRITEis specified and the target is a file, then the- Gio.IOErrorEnum.WOULD_RECURSEerror may be returned (if the native move operation isn’t available).
- destination (
 - 
open_readwrite(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable- Raises: - GLib.Error- Returns: - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Opens an existing file for reading and writing. The result is a - Gio.FileIOStreamthat can be used to read and write the contents of the file.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is a directory, the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.- New in version 2.22. 
 - 
open_readwrite_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens self for reading and writing. - For more details, see - Gio.File.open_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.open_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- io_priority (
 - 
open_readwrite_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file read operation started with - Gio.File.open_readwrite_async().- New in version 2.22. 
 - 
peek_path()[source]¶
- Returns: - string containing the - Gio.File’s path, or- Noneif no such path exists. The returned string is owned by self.- Return type: - stror- None- Exactly like - Gio.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.- This call does no blocking I/O. - New in version 2.56. 
 - 
poll_mountable(cancellable, callback, *user_data)[source]¶
- Parameters: - cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Polls a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- cancellable (
 - 
poll_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a poll operation. See - Gio.File.poll_mountable() for details.- Finish an asynchronous poll operation that was polled with - Gio.File.poll_mountable().- New in version 2.22. 
 - 
query_default_handler(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - a - Gio.AppInfoif the handle was found,- Noneif there were errors. When you are done with it, release it with- GObject.Object.unref()- Return type: - Gio.AppInfo- Returns the - Gio.AppInfothat is registered as the default application to handle the file specified by self.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
query_default_handler_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is done
- user_data (objectorNone) – data to pass to callback
 - Async version of - Gio.File.query_default_handler().- New in version 2.60. 
- io_priority (
 - 
query_default_handler_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.AppInfoif the handle was found,- Noneif there were errors. When you are done with it, release it with- GObject.Object.unref()- Return type: - Gio.AppInfo- Finishes a - Gio.File.query_default_handler_async() operation.- New in version 2.60. 
 - 
query_exists(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - Trueif the file exists (and can be detected without error),- Falseotherwise (or if cancelled).- Return type: - bool- Utility function to check if a particular file exists. This is implemented using - Gio.File.query_info() and as such does blocking I/O.- Note that in many cases it is racy to first check for file existence and then execute something based on the outcome of that, because the file might have been created or removed in between the operations. The general approach to handling that is to not check, but just do the operation and handle the errors as they come. - As an example of race-free checking, take the case of reading a file, and if it doesn’t exist, creating it. There are two racy versions: read it, and on error create it; and: check if it exists, if not create it. These can both result in two processes creating the file (with perhaps a partially written file as the result). The correct approach is to always try to create the file with - Gio.File.create() which will either atomically create the file or fail with a- Gio.IOErrorEnum.EXISTSerror.- However, in many cases an existence check is useful in a user interface, for instance to make a menu item sensitive/insensitive, so that you don’t have to fool users that something is possible and then just show an error dialog. If you do this, you should make sure to also handle the errors that can happen due to races when you execute the operation. 
 - 
query_file_type(flags, cancellable)[source]¶
- Parameters: - flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlagspassed toGio.File.query_info()
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - The - Gio.FileTypeof the file and- Gio.FileType.UNKNOWNif the file does not exist- Return type: - Utility function to inspect the - Gio.FileTypeof a file. This is implemented using- Gio.File.query_info() and as such does blocking I/O.- The primary use case of this method is to check if a file is a regular file, directory, or symlink. - New in version 2.18. 
- flags (
 - 
query_filesystem_info(attributes, cancellable)[source]¶
- Parameters: - attributes (str) – an attribute query string
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileInfoor- Noneif there was an error. Free the returned object with- GObject.Object.unref().- Return type: - Similar to - Gio.File.query_info(), but obtains information about the filesystem the self is on, rather than the file itself. For instance the amount of space available and the type of the filesystem.- The attributes value is a string that specifies the attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “filesystem::*” means all attributes in the filesystem namespace. The standard namespace for filesystem attributes is “filesystem”. Common attributes of interest are - Gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE(the total size of the filesystem in bytes),- Gio.FILE_ATTRIBUTE_FILESYSTEM_FREE(number of bytes available), and- Gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE(type of the filesystem).- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- attributes (
 - 
query_filesystem_info_async(attributes, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - attributes (str) – an attribute query string
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about the filesystem that the specified self is on. The result is a - Gio.FileInfoobject that contains key-value attributes (such as type or size for the file).- For more details, see - Gio.File.query_filesystem_info() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.query_info_finish() to get the result of the operation.
- attributes (
 - 
query_filesystem_info_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Gio.FileInfofor given self or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInfo- Finishes an asynchronous filesystem info query. See - Gio.File.query_filesystem_info_async().
 - 
query_info(attributes, flags, cancellable)[source]¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileInfofor the given self, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets the requested information about specified self. The result is a - Gio.FileInfoobject that contains key-value attributes (such as the type or size of the file).- The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “standard::*” means all attributes in the standard namespace. An example attribute query be “standard::*,owner::user”. The standard attributes are available as defines, like - Gio.FILE_ATTRIBUTE_STANDARD_NAME.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKSin flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- attributes (
 - 
query_info_async(attributes, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about specified self. The result is a - Gio.FileInfoobject that contains key-value attributes (such as type or size for the file).- For more details, see - Gio.File.query_info() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.query_info_finish() to get the result of the operation.
- attributes (
 - 
query_info_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Gio.FileInfofor given self or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInfo- Finishes an asynchronous file info query. See - Gio.File.query_info_async().
 - 
query_settable_attributes(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - a - Gio.FileAttributeInfoListdescribing the settable attributes. When you are done with it, release it with- Gio.FileAttributeInfoList.unref()- Return type: - Gio.FileAttributeInfoList- Obtain the list of settable attributes for the file. - Returns the type and full attribute name of all the attributes that can be set on this file. This doesn’t mean setting it will always succeed though, you might get an access failure, or some specific file may not support a specific attribute. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
query_writable_namespaces(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - a - Gio.FileAttributeInfoListdescribing the writable namespaces. When you are done with it, release it with- Gio.FileAttributeInfoList.unref()- Return type: - Gio.FileAttributeInfoList- 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). - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
read(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable- Raises: - GLib.Error- Returns: - Gio.FileInputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInputStream- Opens a file for reading. The result is a - Gio.FileInputStreamthat can be used to read the contents of the file.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is a directory, the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
 - 
read_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens self for reading. - For more details, see - Gio.File.read() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.read_finish() to get the result of the operation.
- io_priority (
 - 
read_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileInputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInputStream- Finishes an asynchronous file read operation started with - Gio.File.read_async().
 - 
replace(etag, make_backup, flags, cancellable)[source]¶
- Parameters: - etag (strorNone) – an optional entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - 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. - This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If you pass in a non- - Noneetag value and self already exists, then this value is compared to the current entity tag of the file, and if they differ an- Gio.IOErrorEnum.WRONG_ETAGerror is returned. This generally means that the file has been changed since you last read it. You can get the new etag from- Gio.FileOutputStream.get_etag() after you’ve finished writing and closed the- Gio.FileOutputStream. When you load a new file you can use- Gio.FileInputStream.query_info() to get the etag of the file.- If make_backup is - True, this function will attempt to make a backup of the current file before overwriting it. If this fails a- Gio.IOErrorEnum.CANT_CREATE_BACKUPerror will be returned. If you want to replace anyway, try again with make_backup set to- False.- If the file is a directory the - Gio.IOErrorEnum.IS_DIRECTORYerror will be returned, and if the file is some other form of non-regular file then a- Gio.IOErrorEnum.NOT_REGULAR_FILEerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is to long- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- etag (
 - 
replace_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - etag (strorNone) – an entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. - For more details, see - Gio.File.replace() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.replace_finish() to get the result of the operation.
- etag (
 - 
replace_contents(contents, etag, make_backup, flags, cancellable)[source]¶
- Parameters: - contents (bytes) – a string containing the new contents for self
- etag (strorNone) – the old entity-tag for the document, orNone
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif successful. If an error has occurred, this function will return- Falseand set error appropriately if present.- new_etag: - a location to a new entity tag for the document. This should be freed with - GLib.free() when no longer needed, or- None- Return type: - Replaces the contents of self with contents of length bytes. - If etag is specified (not - None), any existing file must have that etag, or the error- Gio.IOErrorEnum.WRONG_ETAGwill be returned.- If make_backup is - True, this function will attempt to make a backup of self. Internally, it uses- Gio.File.replace(), so will try to replace the file contents in the safest way possible. For example, atomic renames are used when replacing local files’ contents.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- The returned new_etag can be used to verify that the file hasn’t changed the next time it is saved over. 
- contents (
 - 
replace_contents_async(contents, etag, make_backup, flags, cancellable, callback, *user_data)[source]¶
- Parameters: - contents (bytes) – string of contents to replace the file with
- etag (strorNone) – a new entity tag for the self, orNone
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Starts an asynchronous replacement of self with the given contents of length bytes. etag will replace the document’s current entity tag. - When this operation has completed, callback will be called with user_user data, and the operation can be finalized with - Gio.File.replace_contents_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If make_backup is - True, this function will attempt to make a backup of self.- Note that no copy of contents will be made, so it must stay valid until callback is called. See - Gio.File.replace_contents_bytes_async() for a- GLib.Bytesversion that will automatically hold a reference to the contents (without copying) for the duration of the call.
- contents (
 - 
replace_contents_bytes_async(contents, etag, make_backup, flags, cancellable, callback, *user_data)[source]¶
- Parameters: - contents (GLib.Bytes) – aGLib.Bytes
- etag (strorNone) – a new entity tag for the self, orNone
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Same as - Gio.File.replace_contents_async() but takes a- GLib.Bytesinput instead. This function will keep a ref on contents until the operation is done. Unlike- Gio.File.replace_contents_async() this allows forgetting about the content without waiting for the callback.- When this operation has completed, callback will be called with user_user data, and the operation can be finalized with - Gio.File.replace_contents_finish().- New in version 2.40. 
- contents (
 - 
replace_contents_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon success,- Falseon failure.- new_etag: - a location of a new entity tag for the document. This should be freed with - GLib.free() when it is no longer needed, or- None- Return type: - ( - bool, new_etag:- str)- Finishes an asynchronous replace of the given self. See - Gio.File.replace_contents_async(). Sets new_etag to the new entity tag for the document, if present.
 - 
replace_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileOutputStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file replace operation started with - Gio.File.replace_async().
 - 
replace_readwrite(etag, make_backup, flags, cancellable)[source]¶
- Parameters: - etag (strorNone) – an optional entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - 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. - For details about the behaviour, see - Gio.File.replace() which does the same thing but returns an output stream only.- Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing. - New in version 2.22. 
- etag (
 - 
replace_readwrite_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - etag (strorNone) – an entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first. - For more details, see - Gio.File.replace_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.replace_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- etag (
 - 
replace_readwrite_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.FileIOStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file replace operation started with - Gio.File.replace_readwrite_async().- New in version 2.22. 
 - 
resolve_relative_path(relative_path)[source]¶
- Parameters: - relative_path ( - str) – a given relative path string- Returns: - Gio.Fileto the resolved path.- Noneif relative_path is- Noneor if self is invalid. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Resolves a relative path for self to an absolute path. - This call does no blocking I/O. 
 - 
set_attribute(attribute, type, value_p, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- type (Gio.FileAttributeType) – The type of the attribute
- value_p (objectorNone) – a pointer to the value (or the pointer itself if the type is a pointer type)
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Return type: - Sets an attribute in the file with attribute name attribute to value_p. - Some attributes can be unset by setting type to - Gio.FileAttributeType.INVALIDand value_p to- None.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_byte_string(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (str) – a string containing the attribute’s new value
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set to value in the self,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.BYTE_STRINGto value. If attribute is of a different type, this operation will fail, returning- False.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_int32(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (int) – a #gint32 containing the attribute’s new value
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set to value in the self,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.INT32to value. If attribute is of a different type, this operation will fail.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_int64(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (int) – a #guint64 containing the attribute’s new value
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.INT64to value. If attribute is of a different type, this operation will fail.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_string(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (str) – a string containing the attribute’s value
- flags (Gio.FileQueryInfoFlags) –Gio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.STRINGto value. If attribute is of a different type, this operation will fail.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_uint32(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (int) – a #guint32 containing the attribute’s new value
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set to value in the self,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.UINT32to value. If attribute is of a different type, this operation will fail.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attribute_uint64(attribute, value, flags, cancellable)[source]¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- value (int) – a #guint64 containing the attribute’s new value
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Trueif the attribute was successfully set to value in the self,- Falseotherwise.- Return type: - Sets attribute of type - Gio.FileAttributeType.UINT64to value. If attribute is of a different type, this operation will fail.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
set_attributes_async(info, flags, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - info (Gio.FileInfo) – aGio.FileInfo
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback
- user_data (objectorNone) – aobject
 - Asynchronously sets the attributes of self with info. - For more details, see - Gio.File.set_attributes_from_info(), which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.set_attributes_finish() to get the result of the operation.
- info (
 - 
set_attributes_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the attributes were set correctly,- Falseotherwise.- info: - a - Gio.FileInfo- Return type: - ( - bool, info:- Gio.FileInfo)- Finishes setting an attribute started in - Gio.File.set_attributes_async().
 - 
set_attributes_from_info(info, flags, cancellable)[source]¶
- Parameters: - info (Gio.FileInfo) – aGio.FileInfo
- flags (Gio.FileQueryInfoFlags) –Gio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - Return type: - Tries to set all attributes in the - Gio.FileInfoon the target values, not stopping on the first error.- If there is any error during this operation then error will be set to the first error. Error on particular fields are flagged by setting the “status” field in the attribute value to - Gio.FileAttributeStatus.ERROR_SETTING, which means you can also detect further errors.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- info (
 - 
set_display_name(display_name, cancellable)[source]¶
- Parameters: - display_name (str) – a string
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Raises: - Returns: - a - Gio.Filespecifying what self was renamed to, or- Noneif there was an error. Free the returned object with- GObject.Object.unref().- Return type: - Renames self to the specified display name. - The display name is converted from UTF-8 to the correct encoding for the target filesystem if possible and the self is renamed to this. - If you want to implement a rename operation in the user interface the edit name ( - Gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to- Gio.File.set_display_name().- On success the resulting converted filename is returned. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- display_name (
 - 
set_display_name_async(display_name, io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - display_name (str) – a string
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously sets the display name for a given - Gio.File.- For more details, see - Gio.File.set_display_name() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.set_display_name_finish() to get the result of the operation.
- display_name (
 - 
set_display_name_finish(res)[source]¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - a - Gio.Fileor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Finishes setting a display name started with - Gio.File.set_display_name_async().
 - 
start_mountable(flags, start_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.DriveStartFlags) – flags affecting the operation
- start_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Starts a file of type - Gio.FileType.MOUNTABLE. Using start_operation, you can request callbacks when, for instance, passwords are needed during authentication.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
start_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a start operation. See - Gio.File.start_mountable() for details.- Finish an asynchronous start operation that was started with - Gio.File.start_mountable().- New in version 2.22. 
 - 
stop_mountable(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Stops a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.stop_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
stop_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a stop operation, see - Gio.File.stop_mountable() for details.- Finish an asynchronous stop operation that was started with - Gio.File.stop_mountable().- New in version 2.22. 
 - 
supports_thread_contexts()[source]¶
- Returns: - Whether or not self supports thread-default contexts. - Return type: - bool- Checks if self supports ‘thread-default contexts [g-main-context-push-thread-default-context]’. If this returns - False, you cannot perform asynchronous operations on self in a thread that has a thread-default context.- New in version 2.22. 
 - 
trash(cancellable)[source]¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Raises: - GLib.Error- Returns: - Trueon successful trash,- Falseotherwise.- Return type: - bool- Sends self to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all file systems support trashing, so this call can return the - Gio.IOErrorEnum.NOT_SUPPORTEDerror. Since GLib 2.66, the- x-gvfs-notrashunix mount option can be used to disable- Gio.File.trash() support for certain mounts, the- Gio.IOErrorEnum.NOT_SUPPORTEDerror will be returned in that case.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
trash_async(io_priority, cancellable, callback, *user_data)[source]¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously sends self to the Trash location, if possible. - New in version 2.38. 
- io_priority (
 - 
trash_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon successful trash,- Falseotherwise.- Return type: - bool- Finishes an asynchronous file trashing operation, started with - Gio.File.trash_async().- New in version 2.38. 
 - 
unmount_mountable(flags, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Unmounts a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.unmount_mountable_finish() to get the result of the operation.- Deprecated since version 2.22: Use - Gio.File.unmount_mountable_with_operation() instead.
- flags (
 - 
unmount_mountable_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes an unmount operation, see - Gio.File.unmount_mountable() for details.- Finish an asynchronous unmount operation that was started with - Gio.File.unmount_mountable().- Deprecated since version 2.22: Use - Gio.File.unmount_mountable_with_operation_finish() instead.
 - 
unmount_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data)[source]¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Unmounts a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.unmount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
unmount_mountable_with_operation_finish(result)[source]¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes an unmount operation, see - Gio.File.unmount_mountable_with_operation() for details.- Finish an asynchronous unmount operation that was started with - Gio.File.unmount_mountable_with_operation().- New in version 2.22. 
 - 
do_append_to(flags, cancellable) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileOutputStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets an output stream for appending data to the file. If the file doesn’t already exist it is created. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- Some file systems don’t allow all file names, and may return an - Gio.IOErrorEnum.INVALID_FILENAMEerror. If the file is a directory the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- flags (
 - 
do_append_to_async(flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens file for appending. - For more details, see - Gio.File.append_to() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.append_to_finish() to get the result of the operation.
- flags (
 - 
do_append_to_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) –- Gio.AsyncResult- Returns: - a valid - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file append operation started with - Gio.File.append_to_async().
 - 
do_copy(destination, flags, cancellable, progress_callback, progress_callback_data) virtual¶
- Parameters: - destination (Gio.File) – destinationGio.File
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) – function to callback with progress information, orNoneif progress information is not needed
- progress_callback_data (objectorNone) – user data to pass to progress_callback
 - Returns: - Return type: - Copies the file source to the location specified by destination. Can not handle recursive copies of directories. - If the flag - Gio.FileCopyFlags.OVERWRITEis specified an already existing destination file is overwritten.- If the flag - Gio.FileCopyFlags.NOFOLLOW_SYMLINKSis specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied.- If the flag - Gio.FileCopyFlags.ALL_METADATAis specified then all the metadata that is possible to copy is copied, not just the default subset (which, for instance, does not include the owner, see- Gio.FileInfo).- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If progress_callback is not - None, then the operation can be monitored by setting this to a- Gio.FileProgressCallbackfunction. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.- If the source file does not exist, then the - Gio.IOErrorEnum.NOT_FOUNDerror is returned, independent on the status of the destination.- If - Gio.FileCopyFlags.OVERWRITEis not specified and the target exists, then the error- Gio.IOErrorEnum.EXISTSis returned.- If trying to overwrite a file over a directory, the - Gio.IOErrorEnum.IS_DIRECTORYerror is returned. If trying to overwrite a directory with a directory the- Gio.IOErrorEnum.WOULD_MERGEerror is returned.- If the source is a directory and the target does not exist, or - Gio.FileCopyFlags.OVERWRITEis specified and the target is a file, then the- Gio.IOErrorEnum.WOULD_RECURSEerror is returned.- If you are interested in copying the - Gio.Fileobject itself (not the on-disk file), see- Gio.File.dup().
- destination (
 - 
do_copy_async(destination, flags, io_priority, cancellable, progress_callback, progress_callback_data, callback, *user_data) virtual¶
- Parameters: - destination (Gio.File) – destinationGio.File
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) – function to callback with progress information, orNoneif progress information is not needed
- progress_callback_data (objectorNone) – user data to pass to progress_callback
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Copies the file source to the location specified by destination asynchronously. For details of the behaviour, see - Gio.File.copy().- If progress_callback is not - None, then that function that will be called just like in- Gio.File.copy(). The callback will run in the default main context of the thread calling- Gio.File.copy_async() — the same context as callback is run in.- When the operation is finished, callback will be called. You can then call - Gio.File.copy_finish() to get the result of the operation.
- destination (
 - 
do_copy_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Trueon success,- Falseon error.- Return type: - bool- Finishes copying the file started with - Gio.File.copy_async().
 - 
do_create(flags, cancellable) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileOutputStreamfor the newly created file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Creates a new file and returns an output stream for writing to it. The file must not already exist. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If a file or directory with this name already exists the - Gio.IOErrorEnum.EXISTSerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is to long- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- flags (
 - 
do_create_async(flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist. - For more details, see - Gio.File.create() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.create_finish() to get the result of the operation.
- flags (
 - 
do_create_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file create operation started with - Gio.File.create_async().
 - 
do_create_readwrite(flags, cancellable) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileIOStreamfor the newly created file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Creates a new file and returns a stream for reading and writing to it. The file must not already exist. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If a file or directory with this name already exists, the - Gio.IOErrorEnum.EXISTSerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is too long,- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.- Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing. - New in version 2.22. 
- flags (
 - 
do_create_readwrite_async(flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a new file and returns a stream for reading and writing to it. The file must not already exist. - For more details, see - Gio.File.create_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.create_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
do_create_readwrite_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file create operation started with - Gio.File.create_readwrite_async().- New in version 2.22. 
 - 
do_delete_file(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - Trueif the file was deleted.- Falseotherwise.- Return type: - bool- Deletes a file. If the file is a directory, it will only be deleted if it is empty. This has the same semantics as - GLib.unlink().- If file doesn’t exist, - Gio.IOErrorEnum.NOT_FOUNDwill be returned. This allows for deletion to be implemented avoiding time-of-check to time-of-use races :- g_autoptr(GError) local_error = NULL; if (!g_file_delete (my_file, my_cancellable, &local_error) && !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { // deletion failed for some reason other than the file not existing: // so report the error g_warning ("Failed to delete %s: %s", g_file_peek_path (my_file), local_error->message); }- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_delete_file_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - 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 - GLib.unlink().- New in version 2.34. 
- io_priority (
 - 
do_delete_file_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the file was deleted.- Falseotherwise.- Return type: - bool- Finishes deleting a file started with - Gio.File.delete_async().- New in version 2.34. 
 - 
do_dup() virtual¶
- Returns: - a new - Gio.Filethat is a duplicate of the given- Gio.File.- Return type: - Gio.File- Duplicates a - Gio.Filehandle. This operation does not duplicate the actual file or directory represented by the- Gio.File; see- Gio.File.copy() if attempting to copy a file.- Gio.File.dup() is useful when a second handle is needed to the same underlying file, for use in a separate thread (- Gio.Fileis not thread-safe). For use within the same thread, use- GObject.Object.ref() to increment the existing object’s reference count.- This call does no blocking I/O. 
 - 
do_eject_mountable(flags, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.File.eject_mountable_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- Deprecated since version 2.22: Use - Gio.File.eject_mountable_with_operation() instead.
- flags (
 - 
do_eject_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the file was ejected successfully.- Falseotherwise.- Return type: - bool- Finishes an asynchronous eject operation started by - Gio.File.eject_mountable().- Deprecated since version 2.22: Use - Gio.File.eject_mountable_with_operation_finish() instead.
 - 
do_eject_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - 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 - Gio.File.eject_mountable_with_operation_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- New in version 2.22. 
- flags (
 - 
do_eject_mountable_with_operation_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the file was ejected successfully.- Falseotherwise.- Return type: - bool- Finishes an asynchronous eject operation started by - Gio.File.eject_mountable_with_operation().- New in version 2.22. 
 - 
do_enumerate_children(attributes, flags, cancellable) virtual¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - A - Gio.FileEnumeratorif successful,- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets the requested information about the files in a directory. The result is a - Gio.FileEnumeratorobject that will give out- Gio.FileInfoobjects for all the files in the directory.- The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “standard::*” means all attributes in the standard namespace. An example attribute query be “standard::*,owner::user”. The standard attributes are available as defines, like - Gio.FILE_ATTRIBUTE_STANDARD_NAME.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is not a directory, the- Gio.IOErrorEnum.NOT_DIRECTORYerror will be returned. Other errors are possible too.
- attributes (
 - 
do_enumerate_children_async(attributes, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about the files in a directory. The result is a - Gio.FileEnumeratorobject that will give out- Gio.FileInfoobjects for all the files in the directory.- For more details, see - Gio.File.enumerate_children() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.enumerate_children_finish() to get the result of the operation.
- attributes (
 - 
do_enumerate_children_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileEnumeratoror- Noneif an error occurred. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileEnumerator- Finishes an async enumerate children operation. See - Gio.File.enumerate_children_async().
 - 
do_equal(file2) virtual¶
- Parameters: - file2 ( - Gio.File) – the second- Gio.File- Returns: - Trueif file1 and file2 are equal.- Return type: - bool- Checks if the two given - Gio.Filesrefer to the same file.- Note that two - Gio.Filesthat differ can still refer to the same file on the filesystem due to various forms of filename aliasing.- This call does no blocking I/O. 
 - 
do_find_enclosing_mount(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - a - Gio.Mountwhere the file is located or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Gets a - Gio.Mountfor the- Gio.File.- Gio.Mountis returned only for user interesting locations, see- Gio.VolumeMonitor. If the- Gio.FileIfacefor file does not have a #mount, error will be set to- Gio.IOErrorEnum.NOT_FOUNDand- None#will be returned.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_find_enclosing_mount_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the mount for the file. - For more details, see - Gio.File.find_enclosing_mount() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.find_enclosing_mount_finish() to get the result of the operation.
- io_priority (
 - 
do_find_enclosing_mount_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Gio.Mountfor given file or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Mount- Finishes an asynchronous find mount request. See - Gio.File.find_enclosing_mount_async().
 - 
do_get_child_for_display_name(display_name) virtual¶
- Parameters: - display_name ( - str) – string to a possible child- Returns: - a - Gio.Fileto the specified child, or- Noneif the display name couldn’t be converted. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- 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 - Noneand error will be set. This is very useful when constructing a- Gio.Filefor 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.- This call does no blocking I/O. 
 - 
do_get_parent() virtual¶
- Returns: - a - Gio.Filestructure to the parent of the given- Gio.Fileor- Noneif there is no parent. Free the returned object with- GObject.Object.unref().- Return type: - Gio.Fileor- None- Gets the parent directory for the file. If the file represents the root directory of the file system, then - Nonewill be returned.- This call does no blocking I/O. 
 - 
do_get_parse_name() virtual¶
- Returns: - a string containing the - Gio.File’s parse name. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- 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 - Gio.Fileback using- Gio.File.parse_name().- This is generally used to show the - Gio.Fileas a nice full-pathname kind of string in a user interface, like in a location entry.- For local files with names that can safely be converted to UTF-8 the pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 characters unescaped). - This call does no blocking I/O. 
 - 
do_get_uri() virtual¶
- Returns: - a string containing the - Gio.File’s URI. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- Gets the URI for the file. - This call does no blocking I/O. 
 - 
do_get_uri_scheme() virtual¶
- Returns: - a string containing the URI scheme for the given - Gio.File. The returned string should be freed with- GLib.free() when no longer needed.- Return type: - str- Gets the URI scheme for a - Gio.File. RFC 3986 decodes the scheme as:- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]- Common schemes include “file”, “http”, “ftp”, etc. - This call does no blocking I/O. 
 - 
do_has_uri_scheme(uri_scheme) virtual¶
- Parameters: - uri_scheme ( - str) – a string containing a URI scheme- Returns: - Trueif- Gio.File’s backend supports the given URI scheme,- Falseif URI scheme is- None, not supported, or- Gio.Fileis invalid.- Return type: - bool- Checks to see if a - Gio.Filehas a given URI scheme.- This call does no blocking I/O. 
 - 
do_hash() virtual¶
- Returns: - 0 if file is not a valid - Gio.File, otherwise an integer that can be used as hash value for the- Gio.File. This function is intended for easily hashing a- Gio.Fileto add to a- GLib.HashTableor similar data structure.- Return type: - int- Creates a hash value for a - Gio.File.- This call does no blocking I/O. 
 - 
do_is_native() virtual¶
- Returns: - Trueif file is native- Return type: - bool- Checks to see if a file is native to the platform. - A native file is one expressed in the platform-native filename format, e.g. “C:\Windows” or “/usr/bin/”. This does not mean the file is local, as it might be on a locally mounted remote filesystem. - On some systems non-native files may be available using the native filesystem via a userspace filesystem (FUSE), in these cases this call will return - False, but- Gio.File.get_path() will still return a native path.- This call does no blocking I/O. 
 - 
do_make_directory(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - Trueon successful creation,- Falseotherwise.- Return type: - bool- 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 - Gio.File. To recursively create directories, see- Gio.File.make_directory_with_parents(). This function will fail if the parent directory does not exist, setting error to- Gio.IOErrorEnum.NOT_FOUND. If the file system doesn’t support creating directories, this function will fail, setting error to- Gio.IOErrorEnum.NOT_SUPPORTED.- For a local - Gio.Filethe newly created directory will have the default (current) ownership and permissions of the current process.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_make_directory_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously creates a directory. - New in version 2.38. 
- io_priority (
 - 
do_make_directory_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueon successful directory creation,- Falseotherwise.- Return type: - bool- Finishes an asynchronous directory creation, started with - Gio.File.make_directory_async().- New in version 2.38. 
 - 
do_make_symbolic_link(symlink_value, cancellable) virtual¶
- Parameters: - symlink_value (str) – a string with the path for the target of the new symlink
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - Return type: - Creates a symbolic link named file which contains the string symlink_value. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- symlink_value (
 - 
do_measure_disk_usage_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – the- Gio.AsyncResultpassed to your- Gio.AsyncReadyCallback- Returns: - Trueif successful, with the out parameters set.- Falseotherwise, with error set.- disk_usage: - the number of bytes of disk space used - num_dirs: - the number of directories encountered - num_files: - the number of non-directories encountered - Return type: - ( - bool, disk_usage:- int, num_dirs:- int, num_files:- int)- Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information. - New in version 2.38. 
 - 
do_monitor_dir(flags, cancellable) virtual¶
- Parameters: - flags (Gio.FileMonitorFlags) – a set ofGio.FileMonitorFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileMonitorfor the given file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- It does not make sense for flags to contain - Gio.FileMonitorFlags.WATCH_HARD_LINKS, since hard links can not be made to directories. It is not possible to monitor all the files in a directory for changes made via hard links; if you want to do this then you must register individual watches with- Gio.File.monitor().
- flags (
 - 
do_monitor_file(flags, cancellable) virtual¶
- Parameters: - flags (Gio.FileMonitorFlags) – a set ofGio.FileMonitorFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileMonitorfor the given file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Obtains a file monitor for the given file. If no file notification mechanism exists, then regular polling of the file is used. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If flags contains - Gio.FileMonitorFlags.WATCH_HARD_LINKSthen the monitor will also attempt to report changes made to the file via another filename (ie, a hard link). Without this flag, you can only rely on changes made through the filename contained in file to be reported. Using this flag may result in an increase in resource usage, and may not have any effect depending on the- Gio.FileMonitorbackend and/or filesystem type.
- flags (
 - 
do_mount_enclosing_volume(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountMountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperationorNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Starts a mount_operation, mounting the volume that contains the file location. - When this operation has completed, callback will be called with user_user data, and the operation can be finalized with - Gio.File.mount_enclosing_volume_finish().- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- flags (
 - 
do_mount_enclosing_volume_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif successful. If an error has occurred, this function will return- Falseand set error appropriately if present.- Return type: - bool- Finishes a mount operation started by - Gio.File.mount_enclosing_volume().
 - 
do_mount_mountable(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountMountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Mounts a file of type - Gio.FileType.MOUNTABLE. Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.
- flags (
 - 
do_mount_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.Fileor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Finishes a mount operation. See - Gio.File.mount_mountable() for details.- Finish an asynchronous mount operation that was started with - Gio.File.mount_mountable().
 - 
do_move(destination, flags, cancellable, progress_callback, progress_callback_data) virtual¶
- Parameters: - destination (Gio.File) –Gio.Filepointing to the destination location
- flags (Gio.FileCopyFlags) – set ofGio.FileCopyFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- progress_callback (Gio.FileProgressCallbackorNone) –Gio.FileProgressCallbackfunction for updates
- progress_callback_data (objectorNone) –objectto user data for the callback function
 - Returns: - Return type: - 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. - If the flag - Gio.FileCopyFlags.OVERWRITEis specified an already existing destination file is overwritten.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If progress_callback is not - None, then the operation can be monitored by setting this to a- Gio.FileProgressCallbackfunction. progress_callback_data will be passed to this function. It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation.- If the source file does not exist, then the - Gio.IOErrorEnum.NOT_FOUNDerror is returned, independent on the status of the destination.- If - Gio.FileCopyFlags.OVERWRITEis not specified and the target exists, then the error- Gio.IOErrorEnum.EXISTSis returned.- If trying to overwrite a file over a directory, the - Gio.IOErrorEnum.IS_DIRECTORYerror is returned. If trying to overwrite a directory with a directory the- Gio.IOErrorEnum.WOULD_MERGEerror is returned.- If the source is a directory and the target does not exist, or - Gio.FileCopyFlags.OVERWRITEis specified and the target is a file, then the- Gio.IOErrorEnum.WOULD_RECURSEerror may be returned (if the native move operation isn’t available).
- destination (
 - 
do_open_readwrite(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable- Returns: - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Opens an existing file for reading and writing. The result is a - Gio.FileIOStreamthat can be used to read and write the contents of the file.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is a directory, the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing.- New in version 2.22. 
 - 
do_open_readwrite_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens file for reading and writing. - For more details, see - Gio.File.open_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.open_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- io_priority (
 - 
do_open_readwrite_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file read operation started with - Gio.File.open_readwrite_async().- New in version 2.22. 
 - 
do_poll_mountable(cancellable, callback, *user_data) virtual¶
- Parameters: - cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Polls a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- cancellable (
 - 
do_poll_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a poll operation. See - Gio.File.poll_mountable() for details.- Finish an asynchronous poll operation that was polled with - Gio.File.poll_mountable().- New in version 2.22. 
 - 
do_prefix_matches(file) virtual¶
- Parameters: - file ( - Gio.File) – input- Gio.File- Returns: - Trueif the file’s parent, grandparent, etc is prefix,- Falseotherwise.- Return type: - bool- Checks whether file has the prefix specified by prefix. - In other words, if the names of initial elements of file’s pathname match prefix. Only full pathname elements are matched, so a path like /foo is not considered a prefix of /foobar, only of /foo/bar. - A - Gio.Fileis not a prefix of itself. If you want to check for equality, use- Gio.File.equal().- This call does no I/O, as it works purely on names. As such it can sometimes return - Falseeven if file is inside a prefix (from a filesystem point of view), because the prefix of file is an alias of prefix.
 - 
do_query_filesystem_info(attributes, cancellable) virtual¶
- Parameters: - attributes (str) – an attribute query string
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileInfoor- Noneif there was an error. Free the returned object with- GObject.Object.unref().- Return type: - Similar to - Gio.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.- The attributes value is a string that specifies the attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “filesystem::*” means all attributes in the filesystem namespace. The standard namespace for filesystem attributes is “filesystem”. Common attributes of interest are - Gio.FILE_ATTRIBUTE_FILESYSTEM_SIZE(the total size of the filesystem in bytes),- Gio.FILE_ATTRIBUTE_FILESYSTEM_FREE(number of bytes available), and- Gio.FILE_ATTRIBUTE_FILESYSTEM_TYPE(type of the filesystem).- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- attributes (
 - 
do_query_filesystem_info_async(attributes, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - attributes (str) – an attribute query string
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about the filesystem that the specified file is on. The result is a - Gio.FileInfoobject that contains key-value attributes (such as type or size for the file).- For more details, see - Gio.File.query_filesystem_info() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.query_info_finish() to get the result of the operation.
- attributes (
 - 
do_query_filesystem_info_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Gio.FileInfofor given file or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInfo- Finishes an asynchronous filesystem info query. See - Gio.File.query_filesystem_info_async().
 - 
do_query_info(attributes, flags, cancellable) virtual¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileInfofor the given file, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gets the requested information about specified file. The result is a - Gio.FileInfoobject that contains key-value attributes (such as the type or size of the file).- The attributes value is a string that specifies the file attributes that should be gathered. It is not an error if it’s not possible to read a particular requested attribute from a file - it just won’t be set. attributes should be a comma-separated list of attributes or attribute wildcards. The wildcard “*” means all attributes, and a wildcard like “standard::*” means all attributes in the standard namespace. An example attribute query be “standard::*,owner::user”. The standard attributes are available as defines, like - Gio.FILE_ATTRIBUTE_STANDARD_NAME.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKSin flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- attributes (
 - 
do_query_info_async(attributes, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - attributes (str) – an attribute query string
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously gets the requested information about specified file. The result is a - Gio.FileInfoobject that contains key-value attributes (such as type or size for the file).- For more details, see - Gio.File.query_info() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.query_info_finish() to get the result of the operation.
- attributes (
 - 
do_query_info_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Gio.FileInfofor given file or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInfo- Finishes an asynchronous file info query. See - Gio.File.query_info_async().
 - 
do_query_settable_attributes(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - a - Gio.FileAttributeInfoListdescribing the settable attributes. When you are done with it, release it with- Gio.FileAttributeInfoList.unref()- Return type: - Gio.FileAttributeInfoList- Obtain the list of settable attributes for the file. - Returns the type and full attribute name of all the attributes that can be set on this file. This doesn’t mean setting it will always succeed though, you might get an access failure, or some specific file may not support a specific attribute. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_query_writable_namespaces(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - a - Gio.FileAttributeInfoListdescribing the writable namespaces. When you are done with it, release it with- Gio.FileAttributeInfoList.unref()- Return type: - Gio.FileAttributeInfoList- 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). - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_read_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously opens file for reading. - For more details, see - Gio.File.read() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.read_finish() to get the result of the operation.
- io_priority (
 - 
do_read_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileInputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInputStream- Finishes an asynchronous file read operation started with - Gio.File.read_async().
 - 
do_read_fn(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellable- Returns: - Gio.FileInputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileInputStream- Opens a file for reading. The result is a - Gio.FileInputStreamthat can be used to read the contents of the file.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If the file does not exist, the - Gio.IOErrorEnum.NOT_FOUNDerror will be returned. If the file is a directory, the- Gio.IOErrorEnum.IS_DIRECTORYerror will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
 - 
do_replace(etag, make_backup, flags, cancellable) virtual¶
- Parameters: - etag (strorNone) – an optional entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileOutputStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - 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. - This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed. - By default files created are generally readable by everyone, but if you pass - Gio.FileCreateFlags.PRIVATEin flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- If you pass in a non- - Noneetag value and file already exists, then this value is compared to the current entity tag of the file, and if they differ an- Gio.IOErrorEnum.WRONG_ETAGerror is returned. This generally means that the file has been changed since you last read it. You can get the new etag from- Gio.FileOutputStream.get_etag() after you’ve finished writing and closed the- Gio.FileOutputStream. When you load a new file you can use- Gio.FileInputStream.query_info() to get the etag of the file.- If make_backup is - True, this function will attempt to make a backup of the current file before overwriting it. If this fails a- Gio.IOErrorEnum.CANT_CREATE_BACKUPerror will be returned. If you want to replace anyway, try again with make_backup set to- False.- If the file is a directory the - Gio.IOErrorEnum.IS_DIRECTORYerror will be returned, and if the file is some other form of non-regular file then a- Gio.IOErrorEnum.NOT_REGULAR_FILEerror will be returned. Some file systems don’t allow all file names, and may return an- Gio.IOErrorEnum.INVALID_FILENAMEerror, and if the name is to long- Gio.IOErrorEnum.FILENAME_TOO_LONGwill be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- etag (
 - 
do_replace_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - etag (strorNone) – an entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. - For more details, see - Gio.File.replace() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.replace_finish() to get the result of the operation.
- etag (
 - 
do_replace_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileOutputStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileOutputStream- Finishes an asynchronous file replace operation started with - Gio.File.replace_async().
 - 
do_replace_readwrite(etag, make_backup, flags, cancellable) virtual¶
- Parameters: - etag (strorNone) – an optional entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.FileIOStreamor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - 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. - For details about the behaviour, see - Gio.File.replace() which does the same thing but returns an output stream only.- Note that in many non-local file cases read and write streams are not supported, so make sure you really need to do read and write streaming, rather than just opening for reading or writing. - New in version 2.22. 
- etag (
 - 
do_replace_readwrite_async(etag, make_backup, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - etag (strorNone) – an entity tag for the currentGio.File, orNoneto ignore
- make_backup (bool) –Trueif a backup should be created
- flags (Gio.FileCreateFlags) – a set ofGio.FileCreateFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first. - For more details, see - Gio.File.replace_readwrite() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.replace_readwrite_finish() to get the result of the operation.- New in version 2.22. 
- etag (
 - 
do_replace_readwrite_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.FileIOStream, or- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.FileIOStream- Finishes an asynchronous file replace operation started with - Gio.File.replace_readwrite_async().- New in version 2.22. 
 - 
do_resolve_relative_path(relative_path) virtual¶
- Parameters: - relative_path ( - str) – a given relative path string- Returns: - Gio.Fileto the resolved path.- Noneif relative_path is- Noneor if file is invalid. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Resolves a relative path for file to an absolute path. - This call does no blocking I/O. 
 - 
do_set_attribute(attribute, type, value_p, flags, cancellable) virtual¶
- Parameters: - attribute (str) – a string containing the attribute’s name
- type (Gio.FileAttributeType) – The type of the attribute
- value_p (objectorNone) – a pointer to the value (or the pointer itself if the type is a pointer type)
- flags (Gio.FileQueryInfoFlags) – a set ofGio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - Return type: - Sets an attribute in the file with attribute name attribute to value_p. - Some attributes can be unset by setting type to - Gio.FileAttributeType.INVALIDand value_p to- None.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- attribute (
 - 
do_set_attributes_async(info, flags, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - info (Gio.FileInfo) – aGio.FileInfo
- flags (Gio.FileQueryInfoFlags) – aGio.FileQueryInfoFlags
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallback
- user_data (objectorNone) – aobject
 - Asynchronously sets the attributes of file with info. - For more details, see - Gio.File.set_attributes_from_info(), which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.set_attributes_finish() to get the result of the operation.
- info (
 - 
do_set_attributes_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the attributes were set correctly,- Falseotherwise.- info: - a - Gio.FileInfo- Return type: - ( - bool, info:- Gio.FileInfo)- Finishes setting an attribute started in - Gio.File.set_attributes_async().
 - 
do_set_attributes_from_info(info, flags, cancellable) virtual¶
- Parameters: - info (Gio.FileInfo) – aGio.FileInfo
- flags (Gio.FileQueryInfoFlags) –Gio.FileQueryInfoFlags
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - Return type: - Tries to set all attributes in the - Gio.FileInfoon the target values, not stopping on the first error.- If there is any error during this operation then error will be set to the first error. Error on particular fields are flagged by setting the “status” field in the attribute value to - Gio.FileAttributeStatus.ERROR_SETTING, which means you can also detect further errors.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- info (
 - 
do_set_display_name(display_name, cancellable) virtual¶
- Parameters: - display_name (str) – a string
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
 - Returns: - a - Gio.Filespecifying what file was renamed to, or- Noneif there was an error. Free the returned object with- GObject.Object.unref().- Return type: - Renames file to the specified display name. - The display name is converted from UTF-8 to the correct encoding for the target filesystem if possible and the file is renamed to this. - If you want to implement a rename operation in the user interface the edit name ( - Gio.FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to- Gio.File.set_display_name().- On success the resulting converted filename is returned. - If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
- display_name (
 - 
do_set_display_name_async(display_name, io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - display_name (str) – a string
- io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously sets the display name for a given - Gio.File.- For more details, see - Gio.File.set_display_name() which is the synchronous version of this call.- When the operation is finished, callback will be called. You can then call - Gio.File.set_display_name_finish() to get the result of the operation.
- display_name (
 - 
do_set_display_name_finish(res) virtual¶
- Parameters: - res ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - a - Gio.Fileor- Noneon error. Free the returned object with- GObject.Object.unref().- Return type: - Gio.File- Finishes setting a display name started with - Gio.File.set_display_name_async().
 - 
do_start_mountable(flags, start_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.DriveStartFlags) – flags affecting the operation
- start_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Starts a file of type - Gio.FileType.MOUNTABLE. Using start_operation, you can request callbacks when, for instance, passwords are needed during authentication.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.mount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
do_start_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a start operation. See - Gio.File.start_mountable() for details.- Finish an asynchronous start operation that was started with - Gio.File.start_mountable().- New in version 2.22. 
 - 
do_stop_mountable(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction.
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Stops a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.stop_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
do_stop_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes a stop operation, see - Gio.File.stop_mountable() for details.- Finish an asynchronous stop operation that was started with - Gio.File.stop_mountable().- New in version 2.22. 
 - 
do_trash(cancellable) virtual¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject,- Noneto ignore- Returns: - Trueon successful trash,- Falseotherwise.- Return type: - bool- Sends file to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all file systems support trashing, so this call can return the - Gio.IOErrorEnum.NOT_SUPPORTEDerror. Since GLib 2.66, the- x-gvfs-notrashunix mount option can be used to disable- Gio.File.trash() support for certain mounts, the- Gio.IOErrorEnum.NOT_SUPPORTEDerror will be returned in that case.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.
 - 
do_trash_async(io_priority, cancellable, callback, *user_data) virtual¶
- Parameters: - io_priority (int) – the I/O priority of the request
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – the data to pass to callback function
 - Asynchronously sends file to the Trash location, if possible. - New in version 2.38. 
- io_priority (
 - 
do_trash_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueon successful trash,- Falseotherwise.- Return type: - bool- Finishes an asynchronous file trashing operation, started with - Gio.File.trash_async().- New in version 2.38. 
 - 
do_unmount_mountable(flags, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Unmounts a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.unmount_mountable_finish() to get the result of the operation.- Deprecated since version 2.22: Use - Gio.File.unmount_mountable_with_operation() instead.
- flags (
 - 
do_unmount_mountable_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes an unmount operation, see - Gio.File.unmount_mountable() for details.- Finish an asynchronous unmount operation that was started with - Gio.File.unmount_mountable().- Deprecated since version 2.22: Use - Gio.File.unmount_mountable_with_operation_finish() instead.
 - 
do_unmount_mountable_with_operation(flags, mount_operation, cancellable, callback, *user_data) virtual¶
- Parameters: - flags (Gio.MountUnmountFlags) – flags affecting the operation
- mount_operation (Gio.MountOperationorNone) – aGio.MountOperation, orNoneto avoid user interaction
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject,Noneto ignore
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied, orNone
- user_data (objectorNone) – the data to pass to callback function
 - Unmounts a file of type - Gio.FileType.MOUNTABLE.- If cancellable is not - None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error- Gio.IOErrorEnum.CANCELLEDwill be returned.- When the operation is finished, callback will be called. You can then call - Gio.File.unmount_mountable_finish() to get the result of the operation.- New in version 2.22. 
- flags (
 - 
do_unmount_mountable_with_operation_finish(result) virtual¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Returns: - Trueif the operation finished successfully.- Falseotherwise.- Return type: - bool- Finishes an unmount operation, see - Gio.File.unmount_mountable_with_operation() for details.- Finish an asynchronous unmount operation that was started with - Gio.File.unmount_mountable_with_operation().- New in version 2.22.