Sets our main struct and passes it to the parent class
Creates a GFile with the given argument from the command line. The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.
Creates a GFile with the given argument from the command line. This function is similar to g_file_new_for_commandline_arg() except that it allows for passing the current working directory as an argument instead of using the current working directory of the process. This is useful if the commandline argument was given in a context other than the invocation of the current process. See also g_application_command_line_create_file_for_arg(). Since 2.36
Opens a file in the preferred directory for temporary files (as returned by g_get_tmp_dir()) and returns a GFile and GFileIOStream pointing to it. tmpl should be a string in the GLib file name encoding containing a sequence of six 'X' characters, and containing no directory components. If it is NULL, a default template is used. Unlike the other GFile constructors, this will return NULL if a temporary file could not be created. Since 2.32
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 G_FILE_CREATE_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 G_IO_ERROR_CANCELLED will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
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.
Finishes an asynchronous file append operation started with g_file_append_to_async().
Copies the file source to the location specified by destination. Can not handle recursive copies of directories. If the flag G_FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. If the flag G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. 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 G_IO_ERROR_CANCELLED will be returned. If progress_callback is not NULL, then the operation can be monitored by setting this to a GFileProgressCallback 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 G_IO_ERROR_NOT_FOUND error is returned, independent on the status of the destination. If G_FILE_COPY_OVERWRITE is not specified and the target exists, then the error G_IO_ERROR_EXISTS is returned. If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the G_IO_ERROR_WOULD_MERGE error is returned. If the source is a directory and the target does not exist, or G_FILE_COPY_OVERWRITE is specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error is returned. If you are interested in copying the GFile object itself (not the on-disk file), see g_file_dup().
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(), however the callback will run in the main loop, not in the thread that is doing the I/O operation. When the operation is finished, callback will be called. You can then call g_file_copy_finish() to get the result of the operation.
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 G_FILE_COPY_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.
Finishes copying the file started with g_file_copy_async().
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 G_FILE_CREATE_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 G_IO_ERROR_CANCELLED will be returned. If a file or directory with this name already exists the G_IO_ERROR_EXISTS error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error, and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
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.
Finishes an asynchronous file create operation started with g_file_create_async().
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 G_FILE_CREATE_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 G_IO_ERROR_CANCELLED will be returned. If a file or directory with this name already exists, the G_IO_ERROR_EXISTS error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error, and if the name is too long, G_IO_ERROR_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. Since 2.22
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. Since 2.22
Finishes an asynchronous file create operation started with g_file_create_readwrite_async(). Since 2.22
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 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 G_IO_ERROR_CANCELLED will be returned. Virtual: delete_file
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(). Virtual: delete_file_async Since 2.34
Finishes deleting a file started with g_file_delete_async(). Virtual: delete_file_finish Since 2.34
Duplicates a GFile handle. This operation does not duplicate the actual file or directory represented by the GFile; see g_file_copy() if attempting to copy a file. This call does no blocking I/O.
Warning g_file_eject_mountable has been deprecated since version 2.22 and should not be used in newly-written code. Use g_file_eject_mountable_with_operation() instead. 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 G_IO_ERROR_CANCELLED will be returned.
Warning g_file_eject_mountable_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_file_eject_mountable_with_operation_finish() instead. Finishes an asynchronous eject operation started by g_file_eject_mountable().
Starts an asynchronous eject on a mountable. When this operation has completed, callback will be called with user_user data, and the operation can be finalized with g_file_eject_mountable_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 G_IO_ERROR_CANCELLED will be returned. Since 2.22
Finishes an asynchronous eject operation started by g_file_eject_mountable_with_operation(). Since 2.22
Gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory. 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. 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 G_IO_ERROR_CANCELLED will be returned. If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is not a directory, the G_IO_ERROR_NOT_DIRECTORY error will be returned. Other errors are possible too.
Asynchronously gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory. 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.
Finishes an async enumerate children operation. See g_file_enumerate_children_async().
Checks equality of two given GFiles. 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.
Gets a GMount for the GFile. If the GFileIface for file does not have a mount (e.g. possibly a remote share), error will be set to G_IO_ERROR_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 G_IO_ERROR_CANCELLED will be returned.
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.
Finishes an asynchronous find mount request. See g_file_find_enclosing_mount_async().
Gets the base name (the last component of the path) for a given GFile. 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.
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 GFile that points to it. You can use this for instance to create that file. This call does no blocking I/O.
Gets the child of file for a given display_name (i.e. a UTF-8 version of the name). If this function fails, it returns NULL and error will be set. This is very useful when constructing a GFile for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector. This call does no blocking I/O.
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.
Gets the parse name of the file. A parse name is a UTF-8 string that describes the file such that one can get the GFile back using g_file_parse_name(). This is generally used to show the GFile 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.
Gets the local pathname for GFile, if one exists. This call does no blocking I/O.
Gets the path for descendant relative to parent. This call does no blocking I/O.
the main Gtk struct as a void*
Gets the URI for the file. This call does no blocking I/O.
Gets the URI scheme for a GFile.
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 a child of parent. Since 2.24
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. 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. Virtual: prefix_matches
Checks to see if a GFile has a given URI scheme. This call does no blocking I/O.
Checks to see if a file is native to the platform. A native file s 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.
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 content 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 G_IO_ERROR_CANCELLED will be returned.
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 GAsyncResult 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 G_IO_ERROR_CANCELLED will be returned.
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 content 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.
Reads the partial contents of a file. A GFileReadMoreCallback should be used to stop reading from the file when appropriate, else this function will behave exactly as g_file_load_contents_async(). This operation can be finished by g_file_load_partial_contents_finish(). Users of this function should be aware that user_data is passed to both the read_more_callback and 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 G_IO_ERROR_CANCELLED will be returned.
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 content should be freed with g_free() when no longer needed.
Creates a directory. Note that this will only create a child directory of the immediate parent directory of the path or URI given by the GFile. To recursively create directories, see g_file_make_directory_with_parents(). This function will fail if the parent directory does not exist, setting error to G_IO_ERROR_NOT_FOUND. If the file system doesn't support creating directories, this function will fail, setting error to G_IO_ERROR_NOT_SUPPORTED. For a local GFile 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 G_IO_ERROR_CANCELLED will be returned.
Asynchronously creates a directory. Virtual: make_directory_async Since 2.38
Finishes an asynchronous directory creation, started with g_file_make_directory_async(). Virtual: make_directory_finish Since 2.38
Creates a directory and any parent directories that may not exist similar to 'mkdir -p'. If the file system does not support creating directories, this function will fail, setting error to G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, this function will fail setting error to G_IO_ERROR_EXISTS, unlike the similar g_mkdir_with_parents(). For a local GFile 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 G_IO_ERROR_CANCELLED will be returned. Since 2.18
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 G_IO_ERROR_CANCELLED will be returned.
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 G_FILE_DISK_USAGE_REPORT_ALL_ERRORS 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 GFileMeasureProgressCallback for information about when and how the callback will be invoked. Since 2.38
Recursively measures the disk usage of file. This is the asynchronous version of g_file_measure_disk_usage(). See there for more information. Since 2.38
Collects the results from an earlier call to g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more information. Since 2.38
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 G_IO_ERROR_CANCELLED will be returned. Since 2.18
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 G_IO_ERROR_CANCELLED will be returned. It does not make sense for flags to contain G_FILE_MONITOR_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(). Virtual: monitor_dir
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 G_IO_ERROR_CANCELLED will be returned. If flags contains G_FILE_MONITOR_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 GFileMonitor backend and/or filesystem type.
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 G_IO_ERROR_CANCELLED will be returned.
Finishes a mount operation started by g_file_mount_enclosing_volume().
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 G_IO_ERROR_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.
Finishes a mount operation. See g_file_mount_mountable() for details. Finish an asynchronous mount operation that was started with g_file_mount_mountable().
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 G_FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. If the flag G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. 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 G_IO_ERROR_CANCELLED will be returned. If progress_callback is not NULL, then the operation can be monitored by setting this to a GFileProgressCallback 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 G_IO_ERROR_NOT_FOUND error is returned, independent on the status of the destination. If G_FILE_COPY_OVERWRITE is not specified and the target exists, then the error G_IO_ERROR_EXISTS is returned. If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the G_IO_ERROR_WOULD_MERGE error is returned. If the source is a directory and the target does not exist, or G_FILE_COPY_OVERWRITE is specified and the target is a file, then the G_IO_ERROR_WOULD_RECURSE error may be returned (if the native move operation isn't available).
Opens an existing file for reading and writing. The result is a GFileIOStream that can be used to read and write the contents of the file. 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 G_IO_ERROR_CANCELLED will be returned. If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is a directory, the G_IO_ERROR_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. Since 2.22
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. Since 2.22
Finishes an asynchronous file read operation started with g_file_open_readwrite_async(). Since 2.22
Polls 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 G_IO_ERROR_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. Since 2.22
Finishes a poll operation. See g_file_poll_mountable() for details. Finish an asynchronous poll operation that was polled with g_file_poll_mountable(). Since 2.22
Returns the GAppInfo 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 G_IO_ERROR_CANCELLED will be returned.
Utility function to check if a particular file exists. This is implemented using g_file_query_info() and as such does blocking I/O. Note that in many cases it is racy to first check for file existence and then execute something based on the outcome of that, because the file might have been created or removed in between the operations. The general approach to handling that is to not check, but just do the operation and handle the errors as they come. As an example of race-free checking, take the case of reading a file, and if it doesn't exist, creating it. There are two racy versions: read it, and on error create it; and: check if it exists, if not create it. These can both result in two processes creating the file (with perhaps a partially written file as the result). The correct approach is to always try to create the file with g_file_create() which will either atomically create the file or fail with a G_IO_ERROR_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.
Utility function to inspect the GFileType 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. Since 2.18
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 G_IO_ERROR_CANCELLED will be returned. If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
Asynchronously gets the requested information about the filesystem that the specified file is on. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file). 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.
Finishes an asynchronous filesystem info query. See g_file_query_filesystem_info_async().
Gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as the type or size of the file). 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. 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 G_IO_ERROR_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 G_FILE_QUERY_INFO_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 G_IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
Asynchronously gets the requested information about specified file. The result is a GFileInfo object that contains key-value attributes (such as type or size for the file). 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.
Finishes an asynchronous file info query. See g_file_query_info_async().
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 G_IO_ERROR_CANCELLED will be returned.
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 G_IO_ERROR_CANCELLED will be returned.
Opens a file for reading. The result is a GFileInputStream 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 G_IO_ERROR_CANCELLED will be returned. If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on. Virtual: read_fn
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.
Finishes an asynchronous file read operation started with g_file_read_async().
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 G_FILE_CREATE_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 G_IO_ERROR_CANCELLED will be returned. If you pass in a non-NULL etag value, then this value is compared to the current entity tag of the file, and if they differ an G_IO_ERROR_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 GFileOutputStream. 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 G_IO_ERROR_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 G_IO_ERROR_IS_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error, and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
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.
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 G_IO_ERROR_WRONG_ETAG will be returned. If make_backup is TRUE, this function will attempt to make a backup of 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 G_IO_ERROR_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.
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 G_IO_ERROR_CANCELLED will be returned. If make_backup is TRUE, this function will attempt to make a backup of file.
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.
Finishes an asynchronous file replace operation started with g_file_replace_async().
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. Since 2.22
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. Since 2.22
Finishes an asynchronous file replace operation started with g_file_replace_readwrite_async(). Since 2.22
Resolves a relative path for file to an absolute path. This call does no blocking I/O.
Sets an attribute in the file with attribute name attribute to value. Some attributes can be unset by setting attribute to G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. If attribute is of a different type, this operation will fail, returning FALSE. 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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
Sets attribute of type G_FILE_ATTRIBUTE_TYPE_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 G_IO_ERROR_CANCELLED will be returned.
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.
Finishes setting an attribute started in g_file_set_attributes_async().
Tries to set all attributes in the GFileInfo 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 G_FILE_ATTRIBUTE_STATUS_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 G_IO_ERROR_CANCELLED will be returned.
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 G_IO_ERROR_CANCELLED will be returned.
Asynchronously sets the display name for a given GFile. 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.
Finishes setting a display name started with g_file_set_display_name_async().
Starts a file of type G_FILE_TYPE_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 G_IO_ERROR_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. Since 2.22
Finishes a start operation. See g_file_start_mountable() for details. Finish an asynchronous start operation that was started with g_file_start_mountable(). Since 2.22
Stops 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 G_IO_ERROR_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. Since 2.22
Finishes an stop operation, see g_file_stop_mountable() for details. Finish an asynchronous stop operation that was started with g_file_stop_mountable(). Since 2.22
Checks if file supports thread-default contexts. If this returns FALSE, you cannot perform asynchronous operations on file in a thread that has a thread-default context. Since 2.22
Sends file to the "Trashcan", if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all file systems support trashing, so this call can return the G_IO_ERROR_NOT_SUPPORTED error. 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 G_IO_ERROR_CANCELLED will be returned. Virtual: trash
Asynchronously sends file to the Trash location, if possible. Virtual: trash_async Since 2.38
Finishes an asynchronous file trashing operation, started with g_file_trash_async(). Virtual: trash_finish Since 2.38
Warning g_file_unmount_mountable has been deprecated since version 2.22 and should not be used in newly-written code. Use g_file_unmount_mountable_with_operation() instead. 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 G_IO_ERROR_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.
Warning g_file_unmount_mountable_finish has been deprecated since version 2.22 and should not be used in newly-written code. Use g_file_unmount_mountable_with_operation_finish() instead. Finishes an unmount operation, see g_file_unmount_mountable() for details. Finish an asynchronous unmount operation that was started with g_file_unmount_mountable().
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 G_IO_ERROR_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. Since 2.22
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(). Since 2.22
Creates a hash value for a GFile. This call does no blocking I/O. Virtual: hash
Constructs a GFile with the given parse_name (i.e. something given by g_file_get_parse_name()). This operation never fails, but the returned object might not support any I/O operation if the parse_name cannot be parsed.
the main Gtk struct
the main Gtk struct
the main Gtk struct as a void*
Gets a D Object from the objects table of associations.
The notify signal is emitted on an object when one of its properties has been changed. Note that getting this signal doesn't guarantee that the value of the property has actually changed, it may also be emitted when the setter for the property is called to reinstate the previous value.
Installs a new property. This is usually done in the class initializer. Note that it is possible to redefine a property in a derived class, by installing a property with the same name. This can be useful at times, e.g. to change the range of allowed values or the default value.
Installs new properties from an array of GParamSpecs. This is usually done in the class initializer. The property id of each property is the index of each GParamSpec in the pspecs array. The property id of 0 is treated specially by GObject and it should not be used to store a GParamSpec. This function should be used if you plan to use a static array of GParamSpecs and g_object_notify_by_pspec(). For instance, this Since 2.26
Looks up the GParamSpec for a property of a class.
Get an array of GParamSpec* for all properties of a class.
Registers property_id as referring to a property with the name name in a parent class or in an interface implemented by oclass. This allows this class to override a property implementation in a parent class or to provide the implementation of a property from an interface. Note Internally, overriding is implemented by creating a property of type GParamSpecOverride; generally operations that query the properties of the object class, such as g_object_class_find_property() or g_object_class_list_properties() will return the overridden property. However, in one case, the construct_properties argument of the constructor virtual function, the GParamSpecOverride is passed instead, so that the param_id field of the GParamSpec will be correct. For virtually all uses, this makes no difference. If you need to get the overridden property, you can call g_param_spec_get_redirect_target(). Since 2.4
Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property. This function is meant to be called from the interface's default vtable initialization function (the class_init member of GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface. Since 2.4
Find the GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4
Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4
Increases the reference count of object.
Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).
Increase the reference count of object, and possibly remove the floating 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 2.10
Clears a reference to a GObject. object_ptr must not be NULL. If the reference is NULL then this function does nothing. Otherwise, the reference count of the object is decreased and the pointer is set to NULL. This function is threadsafe and modifies the pointer atomically, using memory barriers where needed. A macro is also included that allows this function to be used without pointer casts. Since 2.28
Checks whether object has a floating reference. Since 2.10
This function is intended for GObject implementations to re-enforce a floating 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(). Since 2.10
Adds a weak reference callback to an object. Weak references are used for notification when an object is finalized. They are called "weak references" because they allow you to safely hold a pointer to an object without calling g_object_ref() (g_object_ref() adds a strong reference, that is, forces the object to stay alive). Note that the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.
Removes a weak reference callback to an object.
Adds a weak reference from weak_pointer to object to indicate that the pointer located at weak_pointer_location is only valid during the lifetime of object. When the object is finalized, weak_pointer will be set to NULL. Note that as with g_object_weak_ref(), the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.
Removes a weak reference from object that was previously added using g_object_add_weak_pointer(). The weak_pointer_location has to match the one used with g_object_add_weak_pointer().
Increases the reference count of the object by one and sets a callback to be called when all other references to the object are dropped, or when this is already the last reference to the object and another reference is established. This functionality is intended for binding object to a proxy object managed by another memory manager. This is done with two paired references: the strong reference added by g_object_add_toggle_ref() and a reverse reference to the proxy object which is either a strong reference or weak reference. The setup is that when there are no other references to object, only a weak reference is held in the reverse direction from object to the proxy object, but when there are other references held to object, a strong reference is held. The notify callback is called when the reference from object to the proxy object should be toggled from strong to weak (is_last_ref true) or weak to strong (is_last_ref false). Since a (normal) reference must be held to the object before calling g_object_add_toggle_ref(), the initial state of the reverse link is always strong. Multiple toggle references may be added to the same gobject, however if there are multiple toggle references to an object, none of them will ever be notified until all but one are removed. For this reason, you should only ever use a toggle reference if there is important state in the proxy object. Since 2.8
Removes a reference added with g_object_add_toggle_ref(). The reference count of the object is decreased by one. Since 2.8
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.
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 Since 2.26
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 "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.
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 "notify" signal is emitted for each property. It is an error to call this function when the freeze count is zero.
Gets a named field from the objects table of associations (see g_object_set_data()).
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.
Like g_object_set_data() except it adds notification for when the association is destroyed, either by setting it to a different value or when the object is destroyed. Note that the destroy callback is not called if data is NULL.
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
This is a variant of g_object_get_data() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the key is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34
Compares the user data for the key key on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for key was replaced by newval, FALSE otherwise. Since 2.34
This function gets back user data pointers stored via g_object_set_qdata().
This sets an opaque, named pointer on an object. The name is specified through a GQuark (retrived e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the object with g_object_get_qdata() until the object is finalized. Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as pointer essentially removes the data stored.
This function works like g_object_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the object is finalized, or the data is being overwritten by a call to g_object_set_qdata() with the same quark.
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
This is a variant of g_object_get_qdata() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the quark is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34
Compares the user data for the key quark on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for quark was replaced by newval, FALSE otherwise. Since 2.34
Sets a property on an object.
Gets a property of an object. value must have been initialized to the expected type of the property (or a type to which the expected type can be transformed) using g_value_init(). In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset(). Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.
Sets properties on an object.
Gets properties of an object. In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref(). See g_object_get().
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.
Releases all references to other objects. This can be used to break reference cycles. This functions should only be called from object system implementations.
GFile is a high level abstraction for manipulating files on a virtual file system. GFiles are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that GFile objects do not represent files, merely an identifier for a file. All file content I/O is implemented as streaming operations (see GInputStream and GOutputStream).
To construct a GFile, you can use:
g_file_new_for_path() if you have a path.
g_file_new_for_uri() if you have a URI.
g_file_new_for_commandline_arg() for a command line argument.
g_file_new_tmp() to create a temporary file from a template.
g_file_parse_name() from a UTF-8 string gotten from g_file_get_parse_name().
One way to think of a GFile is as an abstraction of a pathname. For normal files the system pathname is what is stored internally, but as GFiles are extensible it could also be something else that corresponds to a pathname in a userspace implementation of a filesystem.
GFiles make up hierarchies of directories and files that correspond to the files on a filesystem. You can move through the file system with GFile using g_file_get_parent() to get an identifier for the parent directory, g_file_get_child() to get a child within a directory, g_file_resolve_relative_path() to resolve a relative path between two GFiles. There can be multiple hierarchies, so you may not end up at the same root if you repeatedly call g_file_get_parent() on two different files.
All GFiles have a basename (get with g_file_get_basename()). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the GFile to use to actually access the file, because there is no way to go from a display name to the actual name.
Using GFile as an identifier has the same weaknesses as using a path in that there may be multiple aliases for the same file. For instance, hard or soft links may cause two different GFiles to refer to the same file. Other possible causes for aliases are: case insensitive filesystems, short and long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two GFiles point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE attribute. Note that GFile does some trivial canonicalization of pathnames passed in, so that trivial differences in the path string used at creation (duplicated slashes, slash at end of path, "." or ".." path segments, etc) does not create different GFiles.
Many GFile operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a GAsyncReadyCallback which is then used to finalize the operation, producing a GAsyncResult which is then passed to the function's matching _finish() operation.
Some GFile operations do not have synchronous analogs, as they may take a very long time to finish, and blocking may leave an application unusable. Notable cases include:
g_file_mount_mountable() to mount a mountable file.
g_file_unmount_mountable_with_operation() to unmount a mountable file.
g_file_eject_mountable_with_operation() to eject a mountable file.
One notable feature of GFiles are entity tags, or "etags" for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag headers, which are a very similar concept.