Internal$signalsCompile-time signal type information.
This instance property is generated only for TypeScript type checking. It is not defined at runtime and should not be accessed in JS code.
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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error. If the file is a directory the Gio.IOErrorEnum.IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileOutputStream, or null on error. Free the returned object with g_object_unref().
Asynchronously opens file for appending.
For more details, see g_file_append_to() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_append_to_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously opens file for appending.
For more details, see g_file_append_to() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_append_to_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously opens file for appending.
For more details, see g_file_append_to() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_append_to_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file append operation started with
g_file_append_to_async().
a valid Gio.FileOutputStream or null on error. Free the returned object with g_object_unref().
Prepares the file attribute query string for copying to file.
This function prepares an attribute query string to be
passed to g_file_query_info() to get a list of attributes
normally copied with the file (see g_file_copy_attributes()
for the detailed description). This function is used by the
implementation of g_file_copy_attributes() and is useful
when one needs to query and set the attributes in two
stages (e.g., for recursive move of a directory).
a set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
an attribute query string for g_file_query_info(), or null if an error occurs.
Copies the file source to the location specified by destination.
Can not handle recursive copies of directories.
If the flag Gio.FileCopyFlags.OVERWRITE is specified an already
existing destination file is overwritten.
If the flag Gio.FileCopyFlags.NOFOLLOW_SYMLINKS is specified then symlinks
will be copied as symlinks, otherwise the target of the
source symlink will be copied.
If the flag Gio.FileCopyFlags.ALL_METADATA is 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If progress_callback is not null, then the operation can be monitored
by setting this to a Gio.FileProgressCallback function.
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_FOUND error
is returned, independent on the status of the destination.
If Gio.FileCopyFlags.OVERWRITE is not specified and the target exists, then the error Gio.IOErrorEnum.EXISTS is returned.
If trying to overwrite a file over a directory, the Gio.IOErrorEnum.IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the Gio.IOErrorEnum.WOULD_MERGE error is returned.
If the source is a directory and the target does not exist, or Gio.FileCopyFlags.OVERWRITE is specified and the target is a file, then the Gio.IOErrorEnum.WOULD_RECURSE error is returned.
If you are interested in copying the Gio.File object itself (not the on-disk
file), see g_file_dup().
destination Gio.File
set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackfunction to callback with progress information, or null if progress information is not needed
true on success, false otherwise.
Copies the file source to the location specified by destination
asynchronously. For details of the behaviour, see g_file_copy().
If progress_callback is not null, then that function that will be called
just like in g_file_copy(). The callback will run in the default main context
of the thread calling g_file_copy_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_copy_finish() to get the result of the operation.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackfunction to callback with progress information, or null if progress information is not needed
Copies the file source to the location specified by destination
asynchronously. For details of the behaviour, see g_file_copy().
If progress_callback is not null, then that function that will be called
just like in g_file_copy(). The callback will run in the default main context
of the thread calling g_file_copy_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_copy_finish() to get the result of the operation.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
function to callback with progress information, or null if progress information is not needed
a Gio.AsyncReadyCallback to call when the request is satisfied
Copies the file source to the location specified by destination
asynchronously. For details of the behaviour, see g_file_copy().
If progress_callback is not null, then that function that will be called
just like in g_file_copy(). The callback will run in the default main context
of the thread calling g_file_copy_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_copy_finish() to get the result of the operation.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackfunction to callback with progress information, or null if progress information is not needed
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Version of Gio.File.copy_async using closures instead of callbacks for easier binding in other languages.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
optional Gio.Cancellable object, NULL to ignore
GObject.Closure to invoke with progress information, or NULL if progress information is not needed
GObject.Closure to invoke when the request is satisfied
Copies the file attributes from source 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_METADATA is specified in flags, then
all the metadata that is possible to copy is copied. This
is useful when implementing move by copy + delete source.
a Gio.File to copy attributes to
a set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attributes were copied successfully, false otherwise.
Finishes copying the file started with g_file_copy_async().
a true on success, false on error.
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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If a file or directory with this name already exists the Gio.IOErrorEnum.EXISTS error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is to long Gio.IOErrorEnum.FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileOutputStream for the newly created file, or null on error. Free the returned object with g_object_unref().
Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
For more details, see g_file_create() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
For more details, see g_file_create() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
For more details, see g_file_create() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file create operation started with
g_file_create_async().
a Gio.FileOutputStream or null on error. Free the returned object with g_object_unref().
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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If a file or directory with this name already exists, the Gio.IOErrorEnum.EXISTS error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is too long, Gio.IOErrorEnum.FILENAME_TOO_LONG 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.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileIOStream for the newly created file, or null on error. Free the returned object with g_object_unref().
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 g_file_create_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_readwrite_finish() to get
the result of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
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 g_file_create_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_readwrite_finish() to get
the result of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
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 g_file_create_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_readwrite_finish() to get
the result of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file create operation started with
g_file_create_readwrite_async().
a Gio.FileIOStream or null on error. Free the returned object with g_object_unref().
Deletes a file. If the file is a directory, it will only be
deleted if it is empty. This has the same semantics as g_unlink().
If file doesn’t exist, Gio.IOErrorEnum.NOT_FOUND will 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the file was deleted. false otherwise.
Asynchronously delete a file. If the file is a directory, it will
only be deleted if it is empty. This has the same semantics as
g_unlink().
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously delete a file. If the file is a directory, it will
only be deleted if it is empty. This has the same semantics as
g_unlink().
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously delete a file. If the file is a directory, it will
only be deleted if it is empty. This has the same semantics as
g_unlink().
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes deleting a file started with g_file_delete_async().
true if the file was deleted. false otherwise.
Duplicates a Gio.File handle. This operation does not duplicate
the actual file or directory represented by the Gio.File; see
g_file_copy() if attempting to copy a file.
g_file_dup() is useful when a second handle is needed to the same underlying
file, for use in a separate thread (Gio.File is not thread-safe). For use
within the same thread, use g_object_ref() to increment the existing object’s
reference count.
This call does no blocking I/O.
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous eject operation started by
g_file_eject_mountable().
true if the file was ejected successfully. false otherwise.
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_with_operation_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_with_operation_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
a Gio.MountOperation, or null to avoid user interaction
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_with_operation_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous eject operation started by
g_file_eject_mountable_with_operation().
true if the file was ejected successfully. false otherwise.
Gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects 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
G_FILE_ATTRIBUTE_STANDARD_NAME. G_FILE_ATTRIBUTE_STANDARD_NAME should
always be specified if you plan to call g_file_enumerator_get_child() or
g_file_enumerator_iterate() on the returned enumerator.
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is not a directory, the Gio.IOErrorEnum.NOT_DIRECTORY error will be returned. Other errors are possible too.
an attribute query string
a set of Gio.FileQueryInfoFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
A Gio.FileEnumerator if successful, null on error. Free the returned object with g_object_unref().
Asynchronously gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects for all the files in the directory.
For more details, see g_file_enumerate_children() which is
the synchronous version of this call.
When the operation is finished, callback will be called. You can
then call g_file_enumerate_children_finish() to get the result of
the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects for all the files in the directory.
For more details, see g_file_enumerate_children() which is
the synchronous version of this call.
When the operation is finished, callback will be called. You can
then call g_file_enumerate_children_finish() to get the result of
the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects for all the files in the directory.
For more details, see g_file_enumerate_children() which is
the synchronous version of this call.
When the operation is finished, callback will be called. You can
then call g_file_enumerate_children_finish() to get the result of
the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an async enumerate children operation.
See g_file_enumerate_children_async().
a Gio.FileEnumerator or null if an error occurred. Free the returned object with g_object_unref().
Checks if the two given GFiles refer to the same file.
Note that two GFiles that 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.
true if file1 and file2 are equal.
Gets a Gio.Mount for the Gio.File.
Gio.Mount is returned only for user interesting locations, see
Gio.VolumeMonitor. If the Gio.FileIface for file does not have a #mount,
error will be set to Gio.IOErrorEnum.NOT_FOUND and null #will be returned.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.Mount where the file is located or null on error. Free the returned object with g_object_unref().
Asynchronously gets the mount for the file.
For more details, see g_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 g_file_find_enclosing_mount_finish() to
get the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously gets the mount for the file.
For more details, see g_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 g_file_find_enclosing_mount_finish() to
get the result of the operation.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously gets the mount for the file.
For more details, see g_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 g_file_find_enclosing_mount_finish() to
get the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous find mount request.
See g_file_find_enclosing_mount_async().
Gio.Mount for given file or null on error. Free the returned object with g_object_unref().
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 G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
attribute with g_file_query_info().
This call does no blocking I/O.
string containing the Gio.File's base name, or null if given Gio.File is invalid. The returned string should be freed with g_free() when no longer needed.
Gets a child of file with basename equal to name.
Note that the file with that specific name might not exist, but you can still have a Gio.File that points to it. You can use this for instance to create that file.
This call does no blocking I/O.
string containing the child's basename
a Gio.File to a child specified by name. Free the returned object with g_object_unref().
Gets the child of file for a given display_name (i.e. a UTF-8
version of the name). If this function fails, it returns null
and error will be set. This is very useful when constructing a
Gio.File for a new file and the user entered the filename in the
user interface, for instance when you select a directory and
type a filename in the file selector.
This call does no blocking I/O.
string to a possible child
a Gio.File to the specified child, or null if the display name couldn't be converted. Free the returned object with g_object_unref().
Gets the parent directory for the file.
If the file represents the root directory of the
file system, then null will be returned.
This call does no blocking I/O.
a Gio.File structure to the parent of the given Gio.File or null if there is no parent. Free the returned object with g_object_unref().
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.File back using
g_file_parse_name().
This is generally used to show the Gio.File as 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.
a string containing the Gio.File's parse name. The returned string should be freed with g_free() when no longer needed.
Gets the local pathname for Gio.File, if one exists. If non-null, this is
guaranteed to be an absolute, canonical path. It might contain symlinks.
This call does no blocking I/O.
string containing the Gio.File's path, or null if no such path exists. The returned string should be freed with g_free() when no longer needed.
Gets the path for descendant relative to parent.
This call does no blocking I/O.
string with the relative path from descendant to parent, or null if descendant doesn't have parent as prefix. The returned string should be freed with g_free() when no longer needed.
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.
The scheme can be different from the one used to construct the Gio.File, in that it might be replaced with one that is logically equivalent to the Gio.File.
This call does no blocking I/O.
a string containing the URI scheme for the given Gio.File or null if the Gio.File was constructed with an invalid URI. The returned string should be freed with g_free() when no longer needed.
Checks if file has a parent, and optionally, if it is parent.
If parent is null then this function returns true if file has any
parent at all. If parent is non-null then true is only returned
if file is an immediate child of parent.
true if file is an immediate child of parent (or any parent in the case that parent is null).
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.File is not a prefix of itself. If you want to check for
equality, use g_file_equal().
This call does no I/O, as it works purely on names. As such it can
sometimes return false even if file is inside a prefix (from a
filesystem point of view), because the prefix of file is an alias
of prefix.
true if the file's parent, grandparent, etc is prefix, false otherwise.
Creates a hash value for a Gio.File.
This call does no blocking I/O.
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.File to add to a GLib.HashTable or similar data structure.
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 g_file_get_path() will still return a native path.
This call does no blocking I/O.
true if file is native
Loads the contents of file and returns it as GLib.Bytes.
If file is a resource:// based URI, the resulting bytes will reference the
embedded resource instead of a copy. Otherwise, this is equivalent to calling
g_file_load_contents() and g_bytes_new_take().
For resources, etag_out will be set to null.
The data contained in the resulting GLib.Bytes is always zero-terminated, but
this is not included in the GLib.Bytes length. The resulting GLib.Bytes should be
freed with g_bytes_unref() when no longer in use.
a Gio.Cancellable or null
a GLib.Bytes or null and error is set
Asynchronously loads the contents of file as GLib.Bytes.
If file is a resource:// based URI, the resulting bytes will reference the
embedded resource instead of a copy. Otherwise, this is equivalent to calling
g_file_load_contents_async() and g_bytes_new_take().
callback should call g_file_load_bytes_finish() to get the result of this
asynchronous operation.
See g_file_load_bytes() for more information.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Asynchronously loads the contents of file as GLib.Bytes.
If file is a resource:// based URI, the resulting bytes will reference the
embedded resource instead of a copy. Otherwise, this is equivalent to calling
g_file_load_contents_async() and g_bytes_new_take().
callback should call g_file_load_bytes_finish() to get the result of this
asynchronous operation.
See g_file_load_bytes() for more information.
a Gio.Cancellable or null
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously loads the contents of file as GLib.Bytes.
If file is a resource:// based URI, the resulting bytes will reference the
embedded resource instead of a copy. Otherwise, this is equivalent to calling
g_file_load_contents_async() and g_bytes_new_take().
callback should call g_file_load_bytes_finish() to get the result of this
asynchronous operation.
See g_file_load_bytes() for more information.
Optionalcancellable: Gio.Cancellablea Gio.Cancellable or null
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Completes an asynchronous request to g_file_load_bytes_async().
For resources, etag_out will be set to null.
The data contained in the resulting GLib.Bytes is always zero-terminated, but
this is not included in the GLib.Bytes length. The resulting GLib.Bytes should be
freed with g_bytes_unref() when no longer in use.
See g_file_load_bytes() for more information.
a Gio.AsyncResult provided to the callback
a GLib.Bytes or null and error is set
Loads the content of the file into memory. The data is always
zero-terminated, but this is not included in the resultant length.
The returned contents should be freed with g_free() when no longer
needed.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
optional Gio.Cancellable object, null to ignore
true if the file's contents were successfully loaded. false if there were errors.
Starts an asynchronous load of the file's contents.
For more details, see g_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
g_file_load_contents_finish() with the Gio.AsyncResult returned by
the callback.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Starts an asynchronous load of the file's contents.
For more details, see g_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
g_file_load_contents_finish() with the Gio.AsyncResult returned by
the callback.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Starts an asynchronous load of the file's contents.
For more details, see g_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
g_file_load_contents_finish() with the Gio.AsyncResult returned by
the callback.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous load of the file'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
g_free() when no longer needed. If etag_out is present, it will be
set to the new entity tag for the file.
true if the load was successful. If false and error is present, it will be set appropriately.
Finishes an asynchronous partial load operation that was started
with g_file_load_partial_contents_async(). The data is always
zero-terminated, but this is not included in the resultant length.
The returned contents should be freed with g_free() when no longer
needed.
true if the load was successful. If false and error is present, it will be set appropriately.
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 g_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. If the directory already exists,
Gio.IOErrorEnum.EXISTS will be returned.
For a local Gio.File the newly created directory will have the default (current) ownership and permissions of the current process.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true on successful creation, false otherwise.
Asynchronously creates a directory.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously creates a directory.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously creates a directory.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous directory creation, started with
g_file_make_directory_async().
true on successful directory creation, false otherwise.
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 g_mkdir_with_parents().
For a local Gio.File the newly created directories will have the default (current) ownership and permissions of the current process.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if all directories have been successfully created, false otherwise.
Creates a symbolic link named file which contains the string
symlink_value.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string with the path for the target of the new symlink
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true on the creation of a new symlink, false otherwise.
Asynchronously creates a symbolic link named file which contains the
string symlink_value.
a string with the path for the target of the new symlink
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously creates a symbolic link named file which contains the
string symlink_value.
a string with the path for the target of the new symlink
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously creates a symbolic link named file which contains the
string symlink_value.
a string with the path for the target of the new symlink
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous symbolic link creation, started with
g_file_make_symbolic_link_async().
true on successful directory creation, false otherwise.
Recursively measures the disk usage of file.
This is essentially an analog of the 'du' command, but it also reports the number of directories and non-directory files encountered (including things like symbolic links).
By default, errors are only reported against the toplevel file
itself. Errors found while recursing are silently ignored, unless
Gio.FileMeasureFlags.REPORT_ANY_ERROR is given in flags.
The returned size, disk_usage, is in bytes and should be formatted
with g_format_size() in order to get something reasonable for showing
in a user interface.
progress_callback and progress_data can be given to request
periodic progress updates while scanning. See the documentation for
Gio.FileMeasureProgressCallback for information about when and how the
callback will be invoked.
optional Gio.Cancellable
true if successful, with the out parameters set. false otherwise, with error set.
Collects the results from an earlier call to
g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for
more information.
the Gio.AsyncResult passed to your Gio.AsyncReadyCallback
true if successful, with the out parameters set. false otherwise, with error set.
Obtains a file or directory monitor for the given file, depending on the type of the file.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a set of Gio.FileMonitorFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileMonitor for the given file, or null on error. Free the returned object with g_object_unref().
Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will 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 g_file_monitor().
a set of Gio.FileMonitorFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileMonitor for the given file, or null on error. Free the returned object with g_object_unref().
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If flags contains Gio.FileMonitorFlags.WATCH_HARD_LINKS then 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.FileMonitor
backend and/or filesystem type.
a set of Gio.FileMonitorFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileMonitor for the given file, or null on error. Free the returned object with g_object_unref().
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
g_file_mount_enclosing_volume_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
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
g_file_mount_enclosing_volume_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
a Gio.MountOperation or null to avoid user interaction
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied, or null
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
g_file_mount_enclosing_volume_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Finishes a mount operation started by g_file_mount_enclosing_volume().
true if successful. If an error has occurred, this function will return false and set error appropriately if present.
Mounts a file of type G_FILE_TYPE_MOUNTABLE.
Using mount_operation, you can request callbacks when, for instance,
passwords are needed during authentication.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Mounts a file of type G_FILE_TYPE_MOUNTABLE.
Using mount_operation, you can request callbacks when, for instance,
passwords are needed during authentication.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
a Gio.MountOperation, or null to avoid user interaction
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Mounts a file of type G_FILE_TYPE_MOUNTABLE.
Using mount_operation, you can request callbacks when, for instance,
passwords are needed during authentication.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes a mount operation. See g_file_mount_mountable() for details.
Finish an asynchronous mount operation that was started
with g_file_mount_mountable().
a Gio.File or null on error. Free the returned object with g_object_unref().
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.OVERWRITE is specified an already
existing destination file is overwritten.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If progress_callback is not null, then the operation can be monitored
by setting this to a Gio.FileProgressCallback function.
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_FOUND
error is returned, independent on the status of the destination.
If Gio.FileCopyFlags.OVERWRITE is not specified and the target exists, then the error Gio.IOErrorEnum.EXISTS is returned.
If trying to overwrite a file over a directory, the Gio.IOErrorEnum.IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the Gio.IOErrorEnum.WOULD_MERGE error is returned.
If the source is a directory and the target does not exist, or Gio.FileCopyFlags.OVERWRITE is specified and the target is a file, then the Gio.IOErrorEnum.WOULD_RECURSE error may be returned (if the native move operation isn't available).
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackGio.FileProgressCallback function for updates
true on successful move, false otherwise.
Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().
If progress_callback is not null, then that function that will be called
just like in g_file_move(). The callback will run in the default main context
of the thread calling g_file_move_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_move_finish() to get the result of the operation.
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackGio.FileProgressCallback function for updates
Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().
If progress_callback is not null, then that function that will be called
just like in g_file_move(). The callback will run in the default main context
of the thread calling g_file_move_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_move_finish() to get the result of the operation.
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
Gio.FileProgressCallback function for updates
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().
If progress_callback is not null, then that function that will be called
just like in g_file_move(). The callback will run in the default main context
of the thread calling g_file_move_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_move_finish() to get the result of the operation.
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackGio.FileProgressCallback function for updates
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Version of Gio.File.move_async using closures instead of callbacks for easier binding in other languages.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
optional Gio.Cancellable object, NULL to ignore
GObject.Closure to invoke with progress information, or NULL if progress information is not needed
GObject.Closure to invoke when the request is satisfied
Finishes an asynchronous file movement, started with
g_file_move_async().
true on successful file move, false otherwise.
Opens an existing file for reading and writing. The result is a Gio.FileIOStream that can be used to read and write the contents of the file.
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is a directory, the Gio.IOErrorEnum.IS_DIRECTORY error 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.
Optionalcancellable: Gio.CancellableGio.FileIOStream or null on error. Free the returned object with g_object_unref().
Asynchronously opens file for reading and writing.
For more details, see g_file_open_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_open_readwrite_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously opens file for reading and writing.
For more details, see g_file_open_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_open_readwrite_finish() to get
the result of the operation.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously opens file for reading and writing.
For more details, see g_file_open_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_open_readwrite_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file read operation started with
g_file_open_readwrite_async().
a Gio.FileIOStream or null on error. Free the returned object with g_object_unref().
Exactly like g_file_get_path(), but caches the result via
g_object_set_qdata_full(). This is useful for example in C
applications which mix g_file_* APIs with native ones. It
also avoids an extra duplicated string when possible, so will be
generally more efficient.
This call does no blocking I/O.
string containing the Gio.File's path, or null if no such path exists. The returned string is owned by file.
Polls a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Polls a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Polls a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Finishes a poll operation. See g_file_poll_mountable() for details.
Finish an asynchronous poll operation that was polled
with g_file_poll_mountable().
true if the operation finished successfully. false otherwise.
Returns the Gio.AppInfo that is registered as the default
application to handle the file specified by file.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.AppInfo if the handle was found, null if there were errors. When you are done with it, release it with g_object_unref()
Async version of g_file_query_default_handler().
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Async version of g_file_query_default_handler().
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is done
Async version of g_file_query_default_handler().
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is done
Finishes a g_file_query_default_handler_async() operation.
a Gio.AppInfo if the handle was found, null if there were errors. When you are done with it, release it with g_object_unref()
Utility function to check if a particular file exists.
The fallback implementation of this API is using Gio.File.query_info and therefore may do blocking I/O. To asynchronously query the existence of a file, use Gio.File.query_info_async.
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 g_file_create() which will either
atomically create the file or fail with a Gio.IOErrorEnum.EXISTS error.
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.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the file exists (and can be detected without error), false otherwise (or if cancelled).
Utility function to inspect the Gio.FileType of a file. This is
implemented using g_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.
a set of Gio.FileQueryInfoFlags passed to g_file_query_info()
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
The Gio.FileType of the file and Gio.FileType.UNKNOWN if the file does not exist
Similar to g_file_query_info(), but obtains information
about the filesystem the file is on, rather than the file itself.
For instance the amount of space available and the type of
the filesystem.
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
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem
in bytes), G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available),
and G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
an attribute query string
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileInfo or null if there was an error. Free the returned object with g_object_unref().
Asynchronously gets the requested information about the filesystem
that the specified file is on. The result is a Gio.FileInfo object
that contains key-value attributes (such as type or size for the
file).
For more details, see g_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 g_file_query_info_finish() to get the result of the
operation.
an attribute query string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously gets the requested information about the filesystem
that the specified file is on. The result is a Gio.FileInfo object
that contains key-value attributes (such as type or size for the
file).
For more details, see g_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 g_file_query_info_finish() to get the result of the
operation.
an attribute query string
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously gets the requested information about the filesystem
that the specified file is on. The result is a Gio.FileInfo object
that contains key-value attributes (such as type or size for the
file).
For more details, see g_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 g_file_query_info_finish() to get the result of the
operation.
an attribute query string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous filesystem info query.
See g_file_query_filesystem_info_async().
Gio.FileInfo for given file or null on error. Free the returned object with g_object_unref().
Gets the requested information about specified file.
The result is a Gio.FileInfo object 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. In particular this means that if a file
is inaccessible (due to being in a folder with restrictive permissions), for
example, you can expect the returned Gio.FileInfo to have very few
attributes set. You should check whether an attribute is set using
Gio.FileInfo.has_attribute before trying to retrieve its value.
It is guaranteed that if any of the following attributes are listed in
attributes, they will always be set in the returned Gio.FileInfo,
even if the user doesn’t have permissions to access the file:
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 might be "standard::*,owner::user".
The standard attributes are available as defines, like
Gio.FILE_ATTRIBUTE_STANDARD_NAME.
If cancellable is not NULL, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will 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_SYMLINKS
in 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_FOUND error will be returned. Other errors are possible too, and depend on what kind of file system the file is on.
an attribute query string
flags to affect the query operation
Optionalcancellable: Gio.Cancellableoptional cancellable object
a Gio.FileInfo for the given file
Asynchronously gets the requested information about specified file.
The result is a Gio.FileInfo object that contains key-value attributes
(such as type or size for the file).
For more details, see g_file_query_info() which is the synchronous
version of this call.
When the operation is finished, callback will be called. You can
then call g_file_query_info_finish() to get the result of the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously gets the requested information about specified file.
The result is a Gio.FileInfo object that contains key-value attributes
(such as type or size for the file).
For more details, see g_file_query_info() which is the synchronous
version of this call.
When the operation is finished, callback will be called. You can
then call g_file_query_info_finish() to get the result of the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously gets the requested information about specified file.
The result is a Gio.FileInfo object that contains key-value attributes
(such as type or size for the file).
For more details, see g_file_query_info() which is the synchronous
version of this call.
When the operation is finished, callback will be called. You can
then call g_file_query_info_finish() to get the result of the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file info query.
See g_file_query_info_async().
Gio.FileInfo for given file or null on error. Free the returned object with g_object_unref().
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileAttributeInfoList describing the settable attributes. When you are done with it, release it with g_file_attribute_info_list_unref()
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileAttributeInfoList describing the writable namespaces. When you are done with it, release it with g_file_attribute_info_list_unref()
Opens a file for reading. The result is a Gio.FileInputStream that can be used to read the contents of the file.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is a directory, the Gio.IOErrorEnum.IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
Optionalcancellable: Gio.CancellableGio.FileInputStream or null on error. Free the returned object with g_object_unref().
Asynchronously opens file for reading.
For more details, see g_file_read() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_read_finish() to get the result
of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously opens file for reading.
For more details, see g_file_read() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_read_finish() to get the result
of the operation.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously opens file for reading.
For more details, see g_file_read() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_read_finish() to get the result
of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file read operation started with
g_file_read_async().
a Gio.FileInputStream or null on error. Free the returned object with g_object_unref().
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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If you pass in a non-null etag 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_ETAG error is returned. This
generally means that the file has been changed since you last read
it. You can get the new etag from g_file_output_stream_get_etag()
after you've finished writing and closed the Gio.FileOutputStream. When
you load a new file you can use g_file_input_stream_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_BACKUP error 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_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a Gio.IOErrorEnum.NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is to long Gio.IOErrorEnum.FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
an optional entity tag for the current Gio.File, or NULL to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileOutputStream or null on error. Free the returned object with g_object_unref().
Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_finish() to get the result
of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_finish() to get the result
of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_finish() to get the result
of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Replaces the contents of file with contents of length bytes.
If etag is specified (not null), any existing file must have that etag,
or the error Gio.IOErrorEnum.WRONG_ETAG will be returned.
If make_backup is true, this function will attempt to make a backup
of file. Internally, it uses g_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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
The returned new_etag can be used to verify that the file hasn't
changed the next time it is saved over.
a string containing the new contents for file
the old entity-tag for the document, or null
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if successful. If an error has occurred, this function will return false and set error appropriately if present.
Starts an asynchronous replacement of file 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
g_file_replace_contents_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If make_backup is true, this function will attempt to
make a backup of file.
Note that no copy of contents will be made, so it must stay valid
until callback is called. See g_file_replace_contents_bytes_async()
for a GLib.Bytes version that will automatically hold a reference to the
contents (without copying) for the duration of the call.
string of contents to replace the file with
a new entity tag for the file, or null
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Starts an asynchronous replacement of file 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
g_file_replace_contents_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If make_backup is true, this function will attempt to
make a backup of file.
Note that no copy of contents will be made, so it must stay valid
until callback is called. See g_file_replace_contents_bytes_async()
for a GLib.Bytes version that will automatically hold a reference to the
contents (without copying) for the duration of the call.
string of contents to replace the file with
a new entity tag for the file, or null
true if a backup should be created
a set of Gio.FileCreateFlags
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Starts an asynchronous replacement of file 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
g_file_replace_contents_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If make_backup is true, this function will attempt to
make a backup of file.
Note that no copy of contents will be made, so it must stay valid
until callback is called. See g_file_replace_contents_bytes_async()
for a GLib.Bytes version that will automatically hold a reference to the
contents (without copying) for the duration of the call.
string of contents to replace the file with
a new entity tag for the file, or null
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Same as g_file_replace_contents_async() but takes a GLib.Bytes input instead.
This function will keep a ref on contents until the operation is done.
Unlike g_file_replace_contents_async() this allows forgetting about the
content without waiting for the callback.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_replace_contents_finish().
a new entity tag for the file, or null
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous replace of the given file. See
g_file_replace_contents_async(). Sets new_etag to the new entity
tag for the document, if present.
true on success, false on failure.
Finishes an asynchronous file replace operation started with
g_file_replace_async().
a Gio.FileOutputStream, or null on error. Free the returned object with g_object_unref().
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 g_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.
an optional entity tag for the current Gio.File, or NULL to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.FileIOStream or null on error. Free the returned object with g_object_unref().
Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_readwrite_finish() to get
the result of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_readwrite_finish() to get
the result of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_readwrite_finish() to get
the result of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file replace operation started with
g_file_replace_readwrite_async().
a Gio.FileIOStream, or null on error. Free the returned object with g_object_unref().
Resolves a relative path for file to an absolute path.
This call does no blocking I/O.
If the relative_path is an absolute path name, the resolution
is done absolutely (without taking file path as base).
a given relative path string
a Gio.File for the resolved path.
Sets an attribute in the file with attribute name attribute to value_p.
Some attributes can be unset by setting type to
Gio.FileAttributeType.INVALID and value_p to null.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
The type of the attribute
a pointer to the value (or the pointer itself if the type is a pointer type)
a set of Gio.FileQueryInfoFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was set, false otherwise.
Sets attribute of type Gio.FileAttributeType.BYTE_STRING to value.
If attribute is of a different type, this operation will fail,
returning false.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a string containing the attribute's new value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set to value in the file, false otherwise.
Sets attribute of type Gio.FileAttributeType.INT32 to value.
If attribute is of a different type, this operation will fail.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a gint32 containing the attribute's new value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set to value in the file, false otherwise.
Sets attribute of type Gio.FileAttributeType.INT64 to value.
If attribute is of a different type, this operation will fail.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a guint64 containing the attribute's new value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set, false otherwise.
Sets attribute of type Gio.FileAttributeType.STRING to value.
If attribute is of a different type, this operation will fail.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a string containing the attribute's value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set, false otherwise.
Sets attribute of type Gio.FileAttributeType.UINT32 to value.
If attribute is of a different type, this operation will fail.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a guint32 containing the attribute's new value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set to value in the file, false otherwise.
Sets attribute of type Gio.FileAttributeType.UINT64 to value.
If attribute is of a different type, this operation will fail.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
a guint64 containing the attribute's new value
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true if the attribute was successfully set to value in the file, false otherwise.
Asynchronously sets the attributes of file with info.
For more details, see g_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 g_file_set_attributes_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously sets the attributes of file with info.
For more details, see g_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 g_file_set_attributes_finish() to get
the result of the operation.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously sets the attributes of file with info.
For more details, see g_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 g_file_set_attributes_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes setting an attribute started in g_file_set_attributes_async().
true if the attributes were set correctly, false otherwise.
Tries to set all attributes in the Gio.FileInfo on 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
false if there was any error, true otherwise.
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 (G_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 g_file_set_display_name().
On success the resulting converted filename is returned.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
a Gio.File specifying what file was renamed to, or null if there was an error. Free the returned object with g_object_unref().
Asynchronously sets the display name for a given Gio.File.
For more details, see g_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 g_file_set_display_name_finish() to get
the result of the operation.
a string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously sets the display name for a given Gio.File.
For more details, see g_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 g_file_set_display_name_finish() to get
the result of the operation.
a string
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously sets the display name for a given Gio.File.
For more details, see g_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 g_file_set_display_name_finish() to get
the result of the operation.
a string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes setting a display name started with
g_file_set_display_name_async().
a Gio.File or null on error. Free the returned object with g_object_unref().
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalstart_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
a Gio.MountOperation, or null to avoid user interaction
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied, or null
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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalstart_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Finishes a start operation. See g_file_start_mountable() for details.
Finish an asynchronous start operation that was started
with g_file_start_mountable().
true if the operation finished successfully. false otherwise.
Stops a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_stop_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Stops a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_stop_mountable_finish() to get
the result of the operation.
flags affecting the operation
a Gio.MountOperation, or null to avoid user interaction.
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Stops a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_stop_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Finishes a stop operation, see g_file_stop_mountable() for details.
Finish an asynchronous stop operation that was started
with g_file_stop_mountable().
true if the operation finished successfully. false otherwise.
Checks if file supports thread-default main contexts
(see GLib.MainContext.push_thread_default)
If this returns false, you cannot perform asynchronous operations on
file in a thread that has a thread-default context.
Whether or not file supports thread-default contexts.
Sends file to the "Trashcan", if possible. This is similar to
deleting it, but the user can recover it before emptying the trashcan.
Trashing is disabled for system mounts by default (see
g_unix_mount_entry_is_system_internal()), so this call can return the
Gio.IOErrorEnum.NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix
mount option can be used to disable g_file_trash() support for particular
mounts, the Gio.IOErrorEnum.NOT_SUPPORTED error will be returned in that case.
Since 2.82, the x-gvfs-trash unix mount option can be used to enable
g_file_trash() support for particular system mounts.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
true on successful trash, false otherwise.
Asynchronously sends file to the Trash location, if possible.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Asynchronously sends file to the Trash location, if possible.
the I/O priority of the request
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Asynchronously sends file to the Trash location, if possible.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an asynchronous file trashing operation, started with
g_file_trash_async().
true on successful trash, false otherwise.
Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an unmount operation, see g_file_unmount_mountable() for details.
Finish an asynchronous unmount operation that was started
with g_file_unmount_mountable().
true if the operation finished successfully. false otherwise.
Unmounts a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Unmounts a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
a Gio.MountOperation, or null to avoid user interaction
optional Gio.Cancellable object, null to ignore
a Gio.AsyncReadyCallback to call when the request is satisfied
Unmounts a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Finishes an unmount operation,
see g_file_unmount_mountable_with_operation() for details.
Finish an asynchronous unmount operation that was started
with g_file_unmount_mountable_with_operation().
true if the operation finished successfully. false otherwise.
Creates a binding between source_property on source and target_property
on target.
Whenever the source_property is changed the target_property is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget GObject.Object instance to be updated with the same value of the "active" property of the action GObject.Object instance.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well.
The binding will automatically be removed when either the source or the
target instances are finalized. To remove the binding without affecting the
source and the target you can just call g_object_unref() on the returned
GObject.Binding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source and target are only used from a single thread and it
is clear that both source and target outlive the binding. Especially it
is not safe to rely on this if the binding, source or target can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A GObject.Object can have multiple bindings.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Complete version of g_object_bind_property().
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
If flags contains GObject.BindingFlags.BIDIRECTIONAL then the binding will be mutual:
if target_property on target changes then the source_property on source
will be updated as well. The transform_from function is only used in case
of bidirectional bindings, otherwise it will be ignored
The binding will automatically be removed when either the source or the
target instances are finalized. This will release the reference that is
being held on the GObject.Binding instance; if you want to hold on to the
GObject.Binding instance, you will need to hold a reference to it.
To remove the binding, call g_binding_unbind().
A GObject.Object can have multiple bindings.
The same user_data parameter will be used for both transform_to
and transform_from transformation functions; the notify function will
be called once, when the binding is removed. If you need different data
for each transformation function, please use
g_object_bind_property_with_closures() instead.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
Optionaltransform_to: BindingTransformFuncthe transformation function from the source to the target, or null to use the default
Optionaltransform_from: BindingTransformFuncthe transformation function from the target to the source, or null to use the default
Optionalnotify: DestroyNotifya function to call when disposing the binding, to free resources used by the transformation functions, or null if not required
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Creates a binding between source_property on source and target_property
on target, allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of
g_object_bind_property_full(), using GClosures instead of
function pointers.
the property on source to bind
the target GObject.Object
the property on target to bind
flags to pass to GObject.Binding
a GObject.Closure wrapping the transformation function from the source to the target, or null to use the default
a GObject.Closure wrapping the transformation function from the target to the source, or null to use the default
the GObject.Binding instance representing the binding between the two GObject.Object instances. The binding is released whenever the GObject.Binding reference count reaches zero.
Blocks a handler of an instance so it will not be called during any signal emissions
Handler ID of the handler to be blocked
SignalconnectSignalconnect_Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
Handler ID of the handler to be disconnected
SignalemitThis function is intended for GObject.Object implementations to re-enforce
a [floating][floating-ref] object reference. Doing this is seldom
required: all GInitiallyUnowneds are created with a floating reference
which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object. If the freeze count is
non-zero, the emission of "notify" signals on object is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
GObject.Object::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
the data if found, or null if no such data exists.
Gets a property of an object.
The value can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
The name of the property to get
Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
This function gets back user data pointers stored via
g_object_set_qdata().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Gets n_properties properties for an object.
Obtained properties will be set to values. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
Checks whether object has a [floating][floating-ref] reference.
true if object has a floating reference
Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
the name of a property installed on the class of object.
Emits a "notify" signal for the property specified by pspec on object.
This function omits the property name lookup, hence it is faster than
g_object_notify().
One way to avoid using g_object_notify() from within the
class that registered the properties, and using g_object_notify_by_pspec()
instead, is to store the GParamSpec used with
g_object_class_install_property() inside a static array, e.g.:
typedef enum
{
PROP_FOO = 1,
PROP_LAST
} MyObjectProperty;
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
0, 100,
50,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the GObject.ParamSpec of a property installed on the class of object.
Increases the reference count of object.
Since GLib 2.56, if GLIB_VERSION_MAX_ALLOWED is 2.56 or greater, the type
of object will be propagated to the return type (using the GCC typeof()
extension), so any casting the caller needs to do on the return type must be
explicit.
the same object
Increase the reference count of object, and possibly remove the
[floating][floating-ref] reference, if object has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object will be propagated to the return type
under the same conditions as for g_object_ref().
object
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
Object containing the properties to set
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key is converted to a GLib.Quark using g_quark_from_string().
This means a copy of key is kept permanently (even after object has been
finalized) — so it is recommended to only use a small, bounded set of values
for key in your program, to avoid the GLib.Quark storage growing unbounded.
name of the key
Optionaldata: anydata to associate with that key
Sets a property on an object.
The name of the property to set
The value to set the property to
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
the data if found, or null if no such data exists.
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of
g_object_steal_qdata() would have left the destroy function set,
and thus the partial string list would have been freed upon
g_object_set_qdata_full().
A GLib.Quark, naming the user data pointer
The user data pointer set, or null
Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
Name of the signal to stop emission of
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one GObject.Object::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Unblocks a handler so it will be called again during any signal emissions
Handler ID of the handler to be unblocked
Decreases the reference count of object. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the GObject.Object may be reused in future (for example, if it is
an instance variable of another object), it is recommended to clear the
pointer to null rather than retain a dangling pointer to a potentially
invalid GObject.Object instance. Use g_clear_object() for this.
Virtualvfunc_the constructed function is called by g_object_new() as the
final step of the object creation process. At the point of the call, all
construction properties have been set on the object. The purpose of this
call is to allow for object initialisation steps that can only be performed
after construction properties have been set. constructed implementors
should chain up to the constructed call of their parent class to allow it
to complete its initialisation.
Virtualvfunc_Virtualvfunc_the dispose function is supposed to drop all references to other
objects, but keep the instance otherwise intact, so that client method
invocations still work. It may be run multiple times (due to reference
loops). Before returning, dispose should chain up to the dispose method
of the parent class.
Virtualvfunc_instance finalization function, should finish the finalization of
the instance begun in dispose and chain up to the finalize method of the
parent class.
Virtualvfunc_Virtualvfunc_Emits a "notify" signal for the property property_name on object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Note that emission of the notify signal may be blocked with
g_object_freeze_notify(). In this case, the signal emissions are queued
and will be emitted (in reverse order) when g_object_thaw_notify() is
called.
Virtualvfunc_the generic setter for all properties of this type. Should be
overridden for every type with properties. If implementations of
set_property don't emit property change notification explicitly, this will
be done implicitly by the type system. However, if the notify signal is
emitted explicitly, the type system will not emit it a second time.
This function essentially limits the life time of the closure to
the life time of the object. That is, when the object is finalized,
the closure is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure, to ensure that an extra
reference count is held on object during invocation of the
closure. Usually, this function will be called on closures that
use this object as closure data.
GObject.Closure to watch
Virtualvfunc_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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error. If the file is a directory the Gio.IOErrorEnum.IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously opens file for appending.
For more details, see g_file_append_to() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_append_to_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file append operation started with
g_file_append_to_async().
Virtualvfunc_Copies the file source to the location specified by destination.
Can not handle recursive copies of directories.
If the flag Gio.FileCopyFlags.OVERWRITE is specified an already
existing destination file is overwritten.
If the flag Gio.FileCopyFlags.NOFOLLOW_SYMLINKS is specified then symlinks
will be copied as symlinks, otherwise the target of the
source symlink will be copied.
If the flag Gio.FileCopyFlags.ALL_METADATA is 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If progress_callback is not null, then the operation can be monitored
by setting this to a Gio.FileProgressCallback function.
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_FOUND error
is returned, independent on the status of the destination.
If Gio.FileCopyFlags.OVERWRITE is not specified and the target exists, then the error Gio.IOErrorEnum.EXISTS is returned.
If trying to overwrite a file over a directory, the Gio.IOErrorEnum.IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the Gio.IOErrorEnum.WOULD_MERGE error is returned.
If the source is a directory and the target does not exist, or Gio.FileCopyFlags.OVERWRITE is specified and the target is a file, then the Gio.IOErrorEnum.WOULD_RECURSE error is returned.
If you are interested in copying the Gio.File object itself (not the on-disk
file), see g_file_dup().
destination Gio.File
set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackfunction to callback with progress information, or null if progress information is not needed
Virtualvfunc_Copies the file source to the location specified by destination
asynchronously. For details of the behaviour, see g_file_copy().
If progress_callback is not null, then that function that will be called
just like in g_file_copy(). The callback will run in the default main context
of the thread calling g_file_copy_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_copy_finish() to get the result of the operation.
destination Gio.File
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackfunction to callback with progress information, or null if progress information is not needed
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes copying the file started with g_file_copy_async().
Virtualvfunc_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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If a file or directory with this name already exists the Gio.IOErrorEnum.EXISTS error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is to long Gio.IOErrorEnum.FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist.
For more details, see g_file_create() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_finish() to get the result
of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file create operation started with
g_file_create_async().
Virtualvfunc_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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If a file or directory with this name already exists, the Gio.IOErrorEnum.EXISTS error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is too long, Gio.IOErrorEnum.FILENAME_TOO_LONG 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.
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_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 g_file_create_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_create_readwrite_finish() to get
the result of the operation.
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file create operation started with
g_file_create_readwrite_async().
Virtualvfunc_Deletes a file. If the file is a directory, it will only be
deleted if it is empty. This has the same semantics as g_unlink().
If file doesn’t exist, Gio.IOErrorEnum.NOT_FOUND will 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously delete a file. If the file is a directory, it will
only be deleted if it is empty. This has the same semantics as
g_unlink().
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes deleting a file started with g_file_delete_async().
Virtualvfunc_Duplicates a Gio.File handle. This operation does not duplicate
the actual file or directory represented by the Gio.File; see
g_file_copy() if attempting to copy a file.
g_file_dup() is useful when a second handle is needed to the same underlying
file, for use in a separate thread (Gio.File is not thread-safe). For use
within the same thread, use g_object_ref() to increment the existing object’s
reference count.
This call does no blocking I/O.
Virtualvfunc_Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous eject operation started by
g_file_eject_mountable().
Virtualvfunc_Starts an asynchronous eject on a mountable.
When this operation has completed, callback will be called with
user_user data, and the operation can be finalized with
g_file_eject_mountable_with_operation_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous eject operation started by
g_file_eject_mountable_with_operation().
Virtualvfunc_Gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects 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
G_FILE_ATTRIBUTE_STANDARD_NAME. G_FILE_ATTRIBUTE_STANDARD_NAME should
always be specified if you plan to call g_file_enumerator_get_child() or
g_file_enumerator_iterate() on the returned enumerator.
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is not a directory, the Gio.IOErrorEnum.NOT_DIRECTORY error will be returned. Other errors are possible too.
an attribute query string
a set of Gio.FileQueryInfoFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously gets the requested information about the files in a directory. The result is a Gio.FileEnumerator object that will give out Gio.FileInfo objects for all the files in the directory.
For more details, see g_file_enumerate_children() which is
the synchronous version of this call.
When the operation is finished, callback will be called. You can
then call g_file_enumerate_children_finish() to get the result of
the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an async enumerate children operation.
See g_file_enumerate_children_async().
Virtualvfunc_Virtualvfunc_Gets a Gio.Mount for the Gio.File.
Gio.Mount is returned only for user interesting locations, see
Gio.VolumeMonitor. If the Gio.FileIface for file does not have a #mount,
error will be set to Gio.IOErrorEnum.NOT_FOUND and null #will be returned.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously gets the mount for the file.
For more details, see g_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 g_file_find_enclosing_mount_finish() to
get the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous find mount request.
See g_file_find_enclosing_mount_async().
Virtualvfunc_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 G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
attribute with g_file_query_info().
This call does no blocking I/O.
Virtualvfunc_Gets the child of file for a given display_name (i.e. a UTF-8
version of the name). If this function fails, it returns null
and error will be set. This is very useful when constructing a
Gio.File for a new file and the user entered the filename in the
user interface, for instance when you select a directory and
type a filename in the file selector.
This call does no blocking I/O.
string to a possible child
Virtualvfunc_Virtualvfunc_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.File back using
g_file_parse_name().
This is generally used to show the Gio.File as 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.
Virtualvfunc_Gets the local pathname for Gio.File, if one exists. If non-null, this is
guaranteed to be an absolute, canonical path. It might contain symlinks.
This call does no blocking I/O.
Virtualvfunc_Virtualvfunc_Gets the URI for the file.
This call does no blocking I/O.
Virtualvfunc_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.
The scheme can be different from the one used to construct the Gio.File, in that it might be replaced with one that is logically equivalent to the Gio.File.
This call does no blocking I/O.
Virtualvfunc_Checks to see if a Gio.File has a given URI scheme.
This call does no blocking I/O.
a string containing a URI scheme
Virtualvfunc_Creates a hash value for a Gio.File.
This call does no blocking I/O.
Virtualvfunc_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 g_file_get_path() will still return a native path.
This call does no blocking I/O.
Virtualvfunc_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 g_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. If the directory already exists,
Gio.IOErrorEnum.EXISTS will be returned.
For a local Gio.File the newly created directory will have the default (current) ownership and permissions of the current process.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously creates a directory.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous directory creation, started with
g_file_make_directory_async().
Virtualvfunc_Creates a symbolic link named file which contains the string
symlink_value.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string with the path for the target of the new symlink
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously creates a symbolic link named file which contains the
string symlink_value.
a string with the path for the target of the new symlink
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous symbolic link creation, started with
g_file_make_symbolic_link_async().
Virtualvfunc_Recursively measures the disk usage of file.
This is essentially an analog of the 'du' command, but it also reports the number of directories and non-directory files encountered (including things like symbolic links).
By default, errors are only reported against the toplevel file
itself. Errors found while recursing are silently ignored, unless
Gio.FileMeasureFlags.REPORT_ANY_ERROR is given in flags.
The returned size, disk_usage, is in bytes and should be formatted
with g_format_size() in order to get something reasonable for showing
in a user interface.
progress_callback and progress_data can be given to request
periodic progress updates while scanning. See the documentation for
Gio.FileMeasureProgressCallback for information about when and how the
callback will be invoked.
optional Gio.Cancellable
Virtualvfunc_Collects the results from an earlier call to
g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for
more information.
the Gio.AsyncResult passed to your Gio.AsyncReadyCallback
Virtualvfunc_Obtains a directory monitor for the given file. This may fail if directory monitoring is not supported.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will 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 g_file_monitor().
a set of Gio.FileMonitorFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If flags contains Gio.FileMonitorFlags.WATCH_HARD_LINKS then 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.FileMonitor
backend and/or filesystem type.
a set of Gio.FileMonitorFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_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
g_file_mount_enclosing_volume_finish().
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Virtualvfunc_Finishes a mount operation started by g_file_mount_enclosing_volume().
Virtualvfunc_Mounts a file of type G_FILE_TYPE_MOUNTABLE.
Using mount_operation, you can request callbacks when, for instance,
passwords are needed during authentication.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes a mount operation. See g_file_mount_mountable() for details.
Finish an asynchronous mount operation that was started
with g_file_mount_mountable().
Virtualvfunc_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.OVERWRITE is specified an already
existing destination file is overwritten.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If progress_callback is not null, then the operation can be monitored
by setting this to a Gio.FileProgressCallback function.
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_FOUND
error is returned, independent on the status of the destination.
If Gio.FileCopyFlags.OVERWRITE is not specified and the target exists, then the error Gio.IOErrorEnum.EXISTS is returned.
If trying to overwrite a file over a directory, the Gio.IOErrorEnum.IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the Gio.IOErrorEnum.WOULD_MERGE error is returned.
If the source is a directory and the target does not exist, or Gio.FileCopyFlags.OVERWRITE is specified and the target is a file, then the Gio.IOErrorEnum.WOULD_RECURSE error may be returned (if the native move operation isn't available).
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackGio.FileProgressCallback function for updates
Virtualvfunc_Asynchronously moves a file source to the location of destination. For details of the behaviour, see g_file_move().
If progress_callback is not null, then that function that will be called
just like in g_file_move(). The callback will run in the default main context
of the thread calling g_file_move_async() — the same context as callback is
run in.
When the operation is finished, callback will be called. You can then call
g_file_move_finish() to get the result of the operation.
Gio.File pointing to the destination location
set of Gio.FileCopyFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalprogress_callback: FileProgressCallbackGio.FileProgressCallback function for updates
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file movement, started with
g_file_move_async().
Virtualvfunc_Opens an existing file for reading and writing. The result is a Gio.FileIOStream that can be used to read and write the contents of the file.
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is a directory, the Gio.IOErrorEnum.IS_DIRECTORY error 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.
Optionalcancellable: Gio.CancellableVirtualvfunc_Asynchronously opens file for reading and writing.
For more details, see g_file_open_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_open_readwrite_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file read operation started with
g_file_open_readwrite_async().
Virtualvfunc_Polls a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Virtualvfunc_Finishes a poll operation. See g_file_poll_mountable() for details.
Finish an asynchronous poll operation that was polled
with g_file_poll_mountable().
Virtualvfunc_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.File is not a prefix of itself. If you want to check for
equality, use g_file_equal().
This call does no I/O, as it works purely on names. As such it can
sometimes return false even if file is inside a prefix (from a
filesystem point of view), because the prefix of file is an alias
of prefix.
Virtualvfunc_Utility function to check if a particular file exists.
The fallback implementation of this API is using Gio.File.query_info and therefore may do blocking I/O. To asynchronously query the existence of a file, use Gio.File.query_info_async.
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 g_file_create() which will either
atomically create the file or fail with a Gio.IOErrorEnum.EXISTS error.
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.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Similar to g_file_query_info(), but obtains information
about the filesystem the file is on, rather than the file itself.
For instance the amount of space available and the type of
the filesystem.
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
G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem
in bytes), G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available),
and G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).
If cancellable is not null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
an attribute query string
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously gets the requested information about the filesystem
that the specified file is on. The result is a Gio.FileInfo object
that contains key-value attributes (such as type or size for the
file).
For more details, see g_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 g_file_query_info_finish() to get the result of the
operation.
an attribute query string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous filesystem info query.
See g_file_query_filesystem_info_async().
Virtualvfunc_Gets the requested information about specified file.
The result is a Gio.FileInfo object 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. In particular this means that if a file
is inaccessible (due to being in a folder with restrictive permissions), for
example, you can expect the returned Gio.FileInfo to have very few
attributes set. You should check whether an attribute is set using
Gio.FileInfo.has_attribute before trying to retrieve its value.
It is guaranteed that if any of the following attributes are listed in
attributes, they will always be set in the returned Gio.FileInfo,
even if the user doesn’t have permissions to access the file:
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 might be "standard::*,owner::user".
The standard attributes are available as defines, like
Gio.FILE_ATTRIBUTE_STANDARD_NAME.
If cancellable is not NULL, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will 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_SYMLINKS
in 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_FOUND error will be returned. Other errors are possible too, and depend on what kind of file system the file is on.
an attribute query string
flags to affect the query operation
Optionalcancellable: Gio.Cancellableoptional cancellable object
Virtualvfunc_Asynchronously gets the requested information about specified file.
The result is a Gio.FileInfo object that contains key-value attributes
(such as type or size for the file).
For more details, see g_file_query_info() which is the synchronous
version of this call.
When the operation is finished, callback will be called. You can
then call g_file_query_info_finish() to get the result of the operation.
an attribute query string
a set of Gio.FileQueryInfoFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file info query.
See g_file_query_info_async().
Virtualvfunc_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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously opens file for reading.
For more details, see g_file_read() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_read_finish() to get the result
of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file read operation started with
g_file_read_async().
Virtualvfunc_Opens a file for reading. The result is a Gio.FileInputStream that can be used to read the contents of the file.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
If the file does not exist, the Gio.IOErrorEnum.NOT_FOUND error will be returned. If the file is a directory, the Gio.IOErrorEnum.IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
Optionalcancellable: Gio.CancellableVirtualvfunc_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.PRIVATE in 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 null, then the operation can be cancelled
by triggering the cancellable object from another thread. If the
operation was cancelled, the error Gio.IOErrorEnum.CANCELLED will be
returned.
If you pass in a non-null etag 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_ETAG error is returned. This
generally means that the file has been changed since you last read
it. You can get the new etag from g_file_output_stream_get_etag()
after you've finished writing and closed the Gio.FileOutputStream. When
you load a new file you can use g_file_input_stream_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_BACKUP error 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_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a Gio.IOErrorEnum.NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an Gio.IOErrorEnum.INVALID_FILENAME error, and if the name is to long Gio.IOErrorEnum.FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
an optional entity tag for the current Gio.File, or NULL to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_finish() to get the result
of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file replace operation started with
g_file_replace_async().
Virtualvfunc_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 g_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.
an optional entity tag for the current Gio.File, or NULL to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first.
For more details, see g_file_replace_readwrite() which is
the synchronous version of this call.
When the operation is finished, callback will be called.
You can then call g_file_replace_readwrite_finish() to get
the result of the operation.
an entity tag for the current Gio.File, or null to ignore
true if a backup should be created
a set of Gio.FileCreateFlags
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file replace operation started with
g_file_replace_readwrite_async().
Virtualvfunc_Virtualvfunc_Sets an attribute in the file with attribute name attribute to value_p.
Some attributes can be unset by setting type to
Gio.FileAttributeType.INVALID and value_p to null.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string containing the attribute's name
The type of the attribute
a pointer to the value (or the pointer itself if the type is a pointer type)
a set of Gio.FileQueryInfoFlags
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously sets the attributes of file with info.
For more details, see g_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 g_file_set_attributes_finish() to get
the result of the operation.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes setting an attribute started in g_file_set_attributes_async().
Virtualvfunc_Tries to set all attributes in the Gio.FileInfo on 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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_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 (G_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 g_file_set_display_name().
On success the resulting converted filename is returned.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
a string
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously sets the display name for a given Gio.File.
For more details, see g_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 g_file_set_display_name_finish() to get
the result of the operation.
a string
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes setting a display name started with
g_file_set_display_name_async().
Virtualvfunc_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 null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_mount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalstart_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Virtualvfunc_Finishes a start operation. See g_file_start_mountable() for details.
Finish an asynchronous start operation that was started
with g_file_start_mountable().
Virtualvfunc_Stops a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_stop_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied, or null
Virtualvfunc_Finishes a stop operation, see g_file_stop_mountable() for details.
Finish an asynchronous stop operation that was started
with g_file_stop_mountable().
Virtualvfunc_Sends file to the "Trashcan", if possible. This is similar to
deleting it, but the user can recover it before emptying the trashcan.
Trashing is disabled for system mounts by default (see
g_unix_mount_entry_is_system_internal()), so this call can return the
Gio.IOErrorEnum.NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix
mount option can be used to disable g_file_trash() support for particular
mounts, the Gio.IOErrorEnum.NOT_SUPPORTED error will be returned in that case.
Since 2.82, the x-gvfs-trash unix mount option can be used to enable
g_file_trash() support for particular system mounts.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Virtualvfunc_Asynchronously sends file to the Trash location, if possible.
the I/O priority of the request
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an asynchronous file trashing operation, started with
g_file_trash_async().
Virtualvfunc_Unmounts a file of type G_FILE_TYPE_MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an unmount operation, see g_file_unmount_mountable() for details.
Finish an asynchronous unmount operation that was started
with g_file_unmount_mountable().
Virtualvfunc_Unmounts a file of type Gio.FileType.MOUNTABLE.
If cancellable is not null, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error Gio.IOErrorEnum.CANCELLED will be returned.
When the operation is finished, callback will be called.
You can then call g_file_unmount_mountable_finish() to get
the result of the operation.
flags affecting the operation
Optionalmount_operation: Gio.MountOperationa Gio.MountOperation, or null to avoid user interaction
Optionalcancellable: Gio.Cancellableoptional Gio.Cancellable object, null to ignore
Optionalcallback: AsyncReadyCallback<Gio.File>a Gio.AsyncReadyCallback to call when the request is satisfied
Virtualvfunc_Finishes an unmount operation,
see g_file_unmount_mountable_with_operation() for details.
Finish an asynchronous unmount operation that was started
with g_file_unmount_mountable_with_operation().
Gio.File is a high level abstraction for manipulating files on a virtual file system. Gio.Files are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that Gio.File objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see Gio.InputStream and Gio.OutputStream).
To construct a Gio.File, you can use:
One way to think of a Gio.File is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as Gio.Files are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.
Gio.Files make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with Gio.File using Gio.File.get_parent to get an identifier for the parent directory, Gio.File.get_child to get a child within a directory, and 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.Files have 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
G_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.File to use to actually access the file, because there is no way to go from a display name to the actual name.Using Gio.File as an identifier has the same weaknesses as using a path in that there may be multiple aliases for the same file. For instance, hard or soft links may cause two different Gio.Files to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two Gio.Files point to the same file you can query for the
G_FILE_ATTRIBUTE_ID_FILEattribute. Note that Gio.File does some trivial canonicalization of pathnames passed in, so that trivial differences in the path string used at creation (duplicated slashes, slash at end of path,.or..path segments, etc) does not create different Gio.Files.Many Gio.File operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have
_async()appended to their function names. The asynchronous I/O functions call a Gio.AsyncReadyCallback which is then used to finalize the operation, producing a Gio.AsyncResult which is then passed to the function’s matching_finish()operation.It is highly recommended to use asynchronous calls when running within a shared main loop, such as in the main thread of an application. This avoids I/O operations blocking other sources on the main loop from being dispatched. Synchronous I/O operations should be performed from worker threads. See the introduction to asynchronous programming section for more.
Some Gio.File operations almost always take a noticeable amount of time, and so do not have synchronous analogs. Notable cases include:
Entity Tags
One notable feature of Gio.Files are entity tags, or ‘etags’ for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP
ETagheaders, which are a very similar concept.