GIO Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <gio/gio.h> GFileAttributeMatcher; enum GFileType; GFileInfo; #define G_FILE_ATTRIBUTE_STANDARD_TYPE #define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN #define G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP #define G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK #define G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL #define G_FILE_ATTRIBUTE_STANDARD_NAME #define G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME #define G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME #define G_FILE_ATTRIBUTE_STANDARD_COPY_NAME #define G_FILE_ATTRIBUTE_STANDARD_ICON #define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE #define G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE #define G_FILE_ATTRIBUTE_STANDARD_SIZE #define G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET #define G_FILE_ATTRIBUTE_STANDARD_TARGET_URI #define G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER #define G_FILE_ATTRIBUTE_ETAG_VALUE #define G_FILE_ATTRIBUTE_ID_FILE #define G_FILE_ATTRIBUTE_ID_FILESYSTEM #define G_FILE_ATTRIBUTE_ACCESS_CAN_READ #define G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE #define G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE #define G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE #define G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH #define G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME #define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT #define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT #define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT #define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE #define G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI #define G_FILE_ATTRIBUTE_TIME_MODIFIED #define G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC #define G_FILE_ATTRIBUTE_TIME_ACCESS #define G_FILE_ATTRIBUTE_TIME_ACCESS_USEC #define G_FILE_ATTRIBUTE_TIME_CHANGED #define G_FILE_ATTRIBUTE_TIME_CHANGED_USEC #define G_FILE_ATTRIBUTE_TIME_CREATED #define G_FILE_ATTRIBUTE_TIME_CREATED_USEC #define G_FILE_ATTRIBUTE_UNIX_DEVICE #define G_FILE_ATTRIBUTE_UNIX_INODE #define G_FILE_ATTRIBUTE_UNIX_MODE #define G_FILE_ATTRIBUTE_UNIX_NLINK #define G_FILE_ATTRIBUTE_UNIX_UID #define G_FILE_ATTRIBUTE_UNIX_GID #define G_FILE_ATTRIBUTE_UNIX_RDEV #define G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE #define G_FILE_ATTRIBUTE_UNIX_BLOCKS #define G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT #define G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE #define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM #define G_FILE_ATTRIBUTE_OWNER_USER #define G_FILE_ATTRIBUTE_OWNER_USER_REAL #define G_FILE_ATTRIBUTE_OWNER_GROUP #define G_FILE_ATTRIBUTE_THUMBNAIL_PATH #define G_FILE_ATTRIBUTE_THUMBNAILING_FAILED #define G_FILE_ATTRIBUTE_PREVIEW_ICON #define G_FILE_ATTRIBUTE_FILESYSTEM_SIZE #define G_FILE_ATTRIBUTE_FILESYSTEM_FREE #define G_FILE_ATTRIBUTE_FILESYSTEM_TYPE #define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY #define G_FILE_ATTRIBUTE_GVFS_BACKEND #define G_FILE_ATTRIBUTE_SELINUX_CONTEXT #define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT #define G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW #define G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION GFileInfo * g_file_info_new (void); GFileInfo * g_file_info_dup (GFileInfo *other); void g_file_info_copy_into (GFileInfo *src_info, GFileInfo *dest_info); gboolean g_file_info_has_attribute (GFileInfo *info, const char *attribute); char ** g_file_info_list_attributes (GFileInfo *info, const char *name_space); GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info, const char *attribute); void g_file_info_remove_attribute (GFileInfo *info, const char *attribute); char * g_file_info_get_attribute_as_string (GFileInfo *info, const char *attribute); gboolean g_file_info_get_attribute_data (GFileInfo *info, const char *attribute, GFileAttributeType *type, gpointer *value_pp, GFileAttributeStatus *status); GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info, const char *attribute); const char * g_file_info_get_attribute_string (GFileInfo *info, const char *attribute); const char * g_file_info_get_attribute_byte_string (GFileInfo *info, const char *attribute); gboolean g_file_info_get_attribute_boolean (GFileInfo *info, const char *attribute); guint32 g_file_info_get_attribute_uint32 (GFileInfo *info, const char *attribute); gint32 g_file_info_get_attribute_int32 (GFileInfo *info, const char *attribute); guint64 g_file_info_get_attribute_uint64 (GFileInfo *info, const char *attribute); gint64 g_file_info_get_attribute_int64 (GFileInfo *info, const char *attribute); GObject * g_file_info_get_attribute_object (GFileInfo *info, const char *attribute); void g_file_info_set_attribute (GFileInfo *info, const char *attribute, GFileAttributeType type, gpointer value_p); void g_file_info_set_attribute_string (GFileInfo *info, const char *attribute, const char *attr_value); void g_file_info_set_attribute_byte_string (GFileInfo *info, const char *attribute, const char *attr_value); void g_file_info_set_attribute_boolean (GFileInfo *info, const char *attribute, gboolean attr_value); void g_file_info_set_attribute_uint32 (GFileInfo *info, const char *attribute, guint32 attr_value); void g_file_info_set_attribute_int32 (GFileInfo *info, const char *attribute, gint32 attr_value); void g_file_info_set_attribute_uint64 (GFileInfo *info, const char *attribute, guint64 attr_value); void g_file_info_set_attribute_int64 (GFileInfo *info, const char *attribute, gint64 attr_value); void g_file_info_set_attribute_object (GFileInfo *info, const char *attribute, GObject *attr_value); void g_file_info_clear_status (GFileInfo *info); GFileType g_file_info_get_file_type (GFileInfo *info); gboolean g_file_info_get_is_hidden (GFileInfo *info); gboolean g_file_info_get_is_backup (GFileInfo *info); gboolean g_file_info_get_is_symlink (GFileInfo *info); const char * g_file_info_get_name (GFileInfo *info); const char * g_file_info_get_display_name (GFileInfo *info); const char * g_file_info_get_edit_name (GFileInfo *info); GIcon * g_file_info_get_icon (GFileInfo *info); const char * g_file_info_get_content_type (GFileInfo *info); goffset g_file_info_get_size (GFileInfo *info); void g_file_info_get_modification_time (GFileInfo *info, GTimeVal *result); const char * g_file_info_get_symlink_target (GFileInfo *info); const char * g_file_info_get_etag (GFileInfo *info); gint32 g_file_info_get_sort_order (GFileInfo *info); void g_file_info_set_attribute_mask (GFileInfo *info, GFileAttributeMatcher *mask); void g_file_info_unset_attribute_mask (GFileInfo *info); void g_file_info_set_file_type (GFileInfo *info, GFileType type); void g_file_info_set_is_hidden (GFileInfo *info, gboolean is_hidden); void g_file_info_set_is_symlink (GFileInfo *info, gboolean is_symlink); void g_file_info_set_name (GFileInfo *info, const char *name); void g_file_info_set_display_name (GFileInfo *info, const char *display_name); void g_file_info_set_edit_name (GFileInfo *info, const char *edit_name); void g_file_info_set_icon (GFileInfo *info, GIcon *icon); void g_file_info_set_content_type (GFileInfo *info, const char *content_type); void g_file_info_set_size (GFileInfo *info, goffset size); void g_file_info_set_modification_time (GFileInfo *info, GTimeVal *mtime); void g_file_info_set_symlink_target (GFileInfo *info, const char *symlink_target); void g_file_info_set_sort_order (GFileInfo *info, gint32 sort_order); GFileAttributeMatcher * g_file_attribute_matcher_new (const char *attributes); GFileAttributeMatcher * g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher); void g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher); gboolean g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher, const char *attribute); gboolean g_file_attribute_matcher_matches_only (GFileAttributeMatcher *matcher, const char *attribute); gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher, const char *ns); const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher);
Functionality for manipulating basic metadata for files. GFileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.
See GFileAttribute for more information on how GIO handles file attributes.
To obtain a GFileInfo for a GFile, use g_file_query_info()
(or its
async variant). To obtain a GFileInfo for a file input or output
stream, use g_file_input_stream_query_info()
or
g_file_output_stream_query_info()
(or their async variants).
To change the actual attributes of a file, you should then set the
attribute in the GFileInfo and call g_file_set_attributes_from_info()
or g_file_set_attributes_async()
on a GFile.
However, not all attributes can be changed in the file. For instance,
the actual size of a file cannot be changed via g_file_info_set_size()
.
You may call g_file_query_settable_attributes()
and
g_file_query_writable_namespaces()
to discover the settable attributes
of a particular file at runtime.
GFileAttributeMatcher allows for searching through a GFileInfo for attributes.
typedef struct _GFileAttributeMatcher GFileAttributeMatcher;
Determines if a string matches a file attribute.
typedef enum { G_FILE_TYPE_UNKNOWN = 0, G_FILE_TYPE_REGULAR, G_FILE_TYPE_DIRECTORY, G_FILE_TYPE_SYMBOLIC_LINK, G_FILE_TYPE_SPECIAL, /* socket, fifo, blockdev, chardev */ G_FILE_TYPE_SHORTCUT, G_FILE_TYPE_MOUNTABLE } GFileType;
Indicates the file's on-disk type.
File's type is unknown. | |
File handle represents a regular file. | |
File handle represents a directory. | |
File handle represents a symbolic link (Unix systems). | |
File is a "special" file, such as a socket, fifo, block device, or character device. | |
File is a shortcut (Windows systems). | |
File is a mountable location. |
typedef struct _GFileInfo GFileInfo;
Stores information about a file system object referenced by a GFile.
#define G_FILE_ATTRIBUTE_STANDARD_TYPE "standard::type" /* uint32 (GFileType) */
A key in the "standard" namespace for storing file types.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
The value for this key should contain a GFileType.
#define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "standard::is-hidden" /* boolean */
A key in the "standard" namespace for checking if a file is hidden.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP "standard::is-backup" /* boolean */
A key in the "standard" namespace for checking if a file is a backup file.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "standard::is-symlink" /* boolean */
A key in the "standard" namespace for checking if the file is a symlink.
Typically the actual type is something else, if we followed the symlink
to get the type.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL "standard::is-virtual" /* boolean */
A key in the "standard" namespace for checking if a file is virtual.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_STANDARD_NAME "standard::name" /* byte string */
A key in the "standard" namespace for getting the name of the file.
The name is the on-disk filename which may not be in any known encoding,
and can thus not be generally displayed as is.
Use G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the
name in a user interface.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "standard::display-name" /* string */
A key in the "standard" namespace for getting the display name of the file.
A display name is guaranteed to be in UTF8 and can thus be displayed in
the UI.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME "standard::edit-name" /* string */
A key in the "standard" namespace for edit name of the file. An edit name is similar to the display name, but it is meant to be used when you want to rename the file in the UI. The display name might contain information you don't want in the new filename (such as "(invalid unicode)" if the filename was in an invalid encoding).
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_COPY_NAME "standard::copy-name" /* string */
A key in the "standard" namespace for getting the copy name of the file. The copy name is an optional version of the name. If available it's always in UTF8, and corresponds directly to the original filename (only transcoded to UTF8). This is useful if you want to copy the file to another filesystem that might have a different encoding. If the filename is not a valid string in the encoding selected for the filesystem it is in then the copy name will not be set.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_ICON "standard::icon" /* object (GIcon) */
A key in the "standard" namespace for getting the icon for the file.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_OBJECT
.
The value for this key should contain a GIcon.
#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type" /* string */
A key in the "standard" namespace for getting the content type of the file.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
The value for this key should contain a valid content type.
#define G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE "standard::fast-content-type" /* string */
A key in the "standard" namespace for getting the fast content type.
The fast content type isn't as reliable as the regular one, as it
only uses the filename to guess it, but it is faster to calculate than the
regular content type.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_SIZE "standard::size" /* uint64 */
A key in the "standard" namespace for getting the file's size (in bytes).
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64
.
#define G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "standard::symlink-target" /* byte string */
A key in the "standard" namespace for getting the symlink target, if the file
is a symlink. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_BYTE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_TARGET_URI "standard::target-uri" /* string */
A key in the "standard" namespace for getting the target URI for the file, in
the case of G_FILE_TYPE_SHORTCUT
or G_FILE_TYPE_MOUNTABLE
files.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER "standard::sort-order" /* int32 */
A key in the "standard" namespace for setting the sort order of a file.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_INT32
.
An example use would be in file managers, which would use this key
to set the order files are displayed. Files with smaller sort order
should be sorted first, and files without sort order as if sort order
was zero.
#define G_FILE_ATTRIBUTE_ETAG_VALUE "etag::value" /* string */
A key in the "etag" namespace for getting the value of the file's
entity tag. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_ID_FILE "id::file" /* string */
A key in the "id" namespace for getting a file identifier.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
An example use would be during listing files, to avoid recursive
directory scanning.
#define G_FILE_ATTRIBUTE_ID_FILESYSTEM "id::filesystem" /* string */
A key in the "id" namespace for getting the file system identifier.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
An example use would be during drag and drop to see if the source
and target are on the same filesystem (default to move) or not (default
to copy).
#define G_FILE_ATTRIBUTE_ACCESS_CAN_READ "access::can-read" /* boolean */
A key in the "access" namespace for getting read privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to read the file.
#define G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "access::can-write" /* boolean */
A key in the "access" namespace for getting write privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to write to the file.
#define G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE "access::can-execute" /* boolean */
A key in the "access" namespace for getting execution privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to execute the file.
#define G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE "access::can-delete" /* boolean */
A key in the "access" namespace for checking deletion privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to delete the file.
#define G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH "access::can-trash" /* boolean */
A key in the "access" namespace for checking trashing privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to move the file to
the trash.
#define G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME "access::can-rename" /* boolean */
A key in the "access" namespace for checking renaming privileges.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
This attribute will be TRUE
if the user is able to rename the file.
#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT "mountable::can-mount" /* boolean */
A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) is mountable.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT "mountable::can-unmount" /* boolean */
A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) is unmountable.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT "mountable::can-eject" /* boolean */
A key in the "mountable" namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be ejected.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE "mountable::unix-device" /* uint32 */
A key in the "mountable" namespace for getting the unix device.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI "mountable::hal-udi" /* string */
A key in the "mountable" namespace for getting the HAL UDI for the mountable
file. Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_TIME_MODIFIED "time::modified" /* uint64 */
A key in the "time" namespace for getting the time the file was last
modified. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT64
, and contains the UNIX time since the
file was modified.
#define G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC "time::modified-usec" /* uint32 */
A key in the "time" namespace for getting the miliseconds of the time
the file was last modified. This should be used in conjunction with
G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_TIME_ACCESS "time::access" /* uint64 */
A key in the "time" namespace for getting the time the file was last
accessed. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT64
, and contains the UNIX time since the
file was last accessed.
#define G_FILE_ATTRIBUTE_TIME_ACCESS_USEC "time::access-usec" /* uint32 */
A key in the "time" namespace for getting the microseconds of the time
the file was last accessed. This should be used in conjunction with
G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_TIME_CHANGED "time::changed" /* uint64 */
A key in the "time" namespace for getting the time the file was last
changed. Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64
,
and contains the UNIX time since the file was last changed.
This corresponds to the traditional UNIX ctime.
#define G_FILE_ATTRIBUTE_TIME_CHANGED_USEC "time::changed-usec" /* uint32 */
A key in the "time" namespace for getting the microseconds of the time
the file was last changed. This should be used in conjunction with
G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_TIME_CREATED "time::created" /* uint64 */
A key in the "time" namespace for getting the time the file was created.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64
,
and contains the UNIX time since the file was created.
This corresponds to the NTFS ctime.
#define G_FILE_ATTRIBUTE_TIME_CREATED_USEC "time::created-usec" /* uint32 */
A key in the "time" namespace for getting the microseconds of the time
the file was created. This should be used in conjunction with
G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_DEVICE "unix::device" /* uint32 */
A key in the "unix" namespace for getting the device id of the device the
file is located on (see stat()
documentation). This attribute is only
available for UNIX file systems. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_INODE "unix::inode" /* uint64 */
A key in the "unix" namespace for getting the inode of the file.
This attribute is only available for UNIX file systems. Corresponding
GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64
.
#define G_FILE_ATTRIBUTE_UNIX_MODE "unix::mode" /* uint32 */
A key in the "unix" namespace for getting the mode of the file
(e.g. whether the file is a regular file, symlink, etc). See lstat()
documentation. This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_NLINK "unix::nlink" /* uint32 */
A key in the "unix" namespace for getting the number of hard links
for a file. See lstat()
documentation. This attribute is only available
for UNIX file systems. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_UID "unix::uid" /* uint32 */
A key in the "unix" namespace for getting the user ID for the file.
This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_GID "unix::gid" /* uint32 */
A key in the "unix" namespace for getting the group ID for the file.
This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_RDEV "unix::rdev" /* uint32 */
A key in the "unix" namespace for getting the device ID for the file
(if it is a special file). See lstat()
documentation. This attribute
is only available for UNIX file systems. Corresponding GFileAttributeType
is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE "unix::block-size" /* uint32 */
A key in the "unix" namespace for getting the block size for the file
system. This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_UNIX_BLOCKS "unix::blocks" /* uint64 */
A key in the "unix" namespace for getting the number of blocks allocated
for the file. This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64
.
#define G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT "unix::is-mountpoint" /* boolean */
A key in the "unix" namespace for checking if the file represents a
UNIX mount point. This attribute is TRUE
if the file is a UNIX mount
point. This attribute is only available for UNIX file systems.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE "dos::is-archive" /* boolean */
A key in the "dos" namespace for checking if the file's archive flag
is set. This attribute is TRUE
if the archive flag is set. This attribute
is only available for DOS file systems. Corresponding GFileAttributeType
is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM "dos::is-system" /* boolean */
A key in the "dos" namespace for checking if the file's backup flag
is set. This attribute is TRUE
if the backup flag is set. This attribute
is only available for DOS file systems. Corresponding GFileAttributeType
is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_OWNER_USER "owner::user" /* string */
A key in the "owner" namespace for getting the user name of the
file's owner. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_OWNER_USER_REAL "owner::user-real" /* string */
A key in the "owner" namespace for getting the real name of the
user that owns the file. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_OWNER_GROUP "owner::group" /* string */
A key in the "owner" namespace for getting the file owner's group.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_THUMBNAIL_PATH "thumbnail::path" /* bytestring */
A key in the "thumbnail" namespace for getting the path to the thumbnail
image. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_BYTE_STRING
.
#define G_FILE_ATTRIBUTE_THUMBNAILING_FAILED "thumbnail::failed" /* boolean */
A key in the "thumbnail" namespace for checking if thumbnailing failed.
This attribute is TRUE
if thumbnailing failed. Corresponding
GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_PREVIEW_ICON "preview::icon" /* object (GIcon) */
A key in the "preview" namespace for getting a GIcon that can be
used to get preview of the file. For example, it may be a low
resolution thumbnail without metadata. Corresponding
GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_OBJECT
. The value
for this key should contain a GIcon.
Since 2.20
#define G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "filesystem::size" /* uint64 */
A key in the "filesystem" namespace for getting the total size (in bytes) of the file system,
used in g_file_query_filesystem_info()
. Corresponding GFileAttributeType
is G_FILE_ATTRIBUTE_TYPE_UINT64
.
#define G_FILE_ATTRIBUTE_FILESYSTEM_FREE "filesystem::free" /* uint64 */
A key in the "filesystem" namespace for getting the number of bytes of free space left on the
file system. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_UINT64
.
#define G_FILE_ATTRIBUTE_FILESYSTEM_TYPE "filesystem::type" /* string */
A key in the "filesystem" namespace for getting the file system's type.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY "filesystem::readonly" /* boolean */
A key in the "filesystem" namespace for checking if the file system
is read only. Is set to TRUE
if the file system is read only.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN
.
#define G_FILE_ATTRIBUTE_GVFS_BACKEND "gvfs::backend" /* string */
A key in the "gvfs" namespace that gets the name of the current
GVFS backend in use. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_STRING
.
#define G_FILE_ATTRIBUTE_SELINUX_CONTEXT "selinux::context" /* string */
A key in the "selinux" namespace for getting the file's SELinux
context. Corresponding GFileAttributeType is
G_FILE_ATTRIBUTE_TYPE_STRING
. Note that this attribute is only
available if GLib has been built with SELinux support.
#define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT "trash::item-count" /* uint32 */
A key in the "trash" namespace. When requested against
"trash:///" returns the number of (toplevel) items in the trash folder.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32
.
#define G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW "filesystem::use-preview" /* uint32 (GFilesystemPreviewType) */
A key in the "filesystem" namespace for hinting a file manager application whether it should preview (e.g. thumbnail) files on the file system. The value for this key contain a GFilesystemPreviewType.
#define G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION "standard::description" /* string */
A key in the "standard" namespace for getting the description of the file. The description is a utf8 string that describes the file, generally containing the filename, but can also contain furter information. Example descriptions could be "filename (on hostname)" for a remote file or "filename (in trash)" for a file in the trash. This is useful for instance as the window title when displaying a directory or for a bookmarks menu.
Corresponding GFileAttributeType is G_FILE_ATTRIBUTE_TYPE_STRING
.
GFileInfo * g_file_info_new (void);
Creates a new file info structure.
Returns : |
a GFileInfo. |
GFileInfo * g_file_info_dup (GFileInfo *other);
Duplicates a file info structure.
void g_file_info_copy_into (GFileInfo *src_info, GFileInfo *dest_info);
Copies all of the GFileAttributes from src_info
to dest_info
.
|
source to copy attributes from. |
|
destination to copy attributes to. |
gboolean g_file_info_has_attribute (GFileInfo *info, const char *attribute);
Checks if a file info structure has an attribute named attribute
.
char ** g_file_info_list_attributes (GFileInfo *info, const char *name_space);
Lists the file info structure's attributes.
GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info, const char *attribute);
Gets the attribute type for an attribute key.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
a GFileAttributeType for the given attribute , or
G_FILE_ATTRIBUTE_TYPE_INVALID if the key is invalid.
|
void g_file_info_remove_attribute (GFileInfo *info, const char *attribute);
Removes all cases of attribute
from info
if it exists.
|
a GFileInfo. |
|
a file attribute key. |
char * g_file_info_get_attribute_as_string (GFileInfo *info, const char *attribute);
Gets the value of a attribute, formated as a string. This escapes things as needed to make the string valid utf8.
gboolean g_file_info_get_attribute_data (GFileInfo *info, const char *attribute, GFileAttributeType *type, gpointer *value_pp, GFileAttributeStatus *status);
Gets the attribute type, value and status for an attribute key.
GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info, const char *attribute);
Gets the attribute status for an attribute key.
|
a GFileInfo |
|
a file attribute key |
Returns : |
a GFileAttributeStatus for the given attribute , or
G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid.
|
const char * g_file_info_get_attribute_string (GFileInfo *info, const char *attribute);
Gets the value of a string attribute. If the attribute does
not contain a string, NULL
will be returned.
const char * g_file_info_get_attribute_byte_string (GFileInfo *info, const char *attribute);
Gets the value of a byte string attribute. If the attribute does
not contain a byte string, NULL
will be returned.
gboolean g_file_info_get_attribute_boolean (GFileInfo *info, const char *attribute);
Gets the value of a boolean attribute. If the attribute does not
contain a boolean value, FALSE
will be returned.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
the boolean value contained within the attribute. |
guint32 g_file_info_get_attribute_uint32 (GFileInfo *info, const char *attribute);
Gets an unsigned 32-bit integer contained within the attribute. If the attribute does not contain an unsigned 32-bit integer, or is invalid, 0 will be returned.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
an unsigned 32-bit integer from the attribute. |
gint32 g_file_info_get_attribute_int32 (GFileInfo *info, const char *attribute);
Gets a signed 32-bit integer contained within the attribute. If the attribute does not contain a signed 32-bit integer, or is invalid, 0 will be returned.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
a signed 32-bit integer from the attribute. |
guint64 g_file_info_get_attribute_uint64 (GFileInfo *info, const char *attribute);
Gets a unsigned 64-bit integer contained within the attribute. If the attribute does not contain an unsigned 64-bit integer, or is invalid, 0 will be returned.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
a unsigned 64-bit integer from the attribute. |
gint64 g_file_info_get_attribute_int64 (GFileInfo *info, const char *attribute);
Gets a signed 64-bit integer contained within the attribute. If the attribute does not contain an signed 64-bit integer, or is invalid, 0 will be returned.
|
a GFileInfo. |
|
a file attribute key. |
Returns : |
a signed 64-bit integer from the attribute. |
GObject * g_file_info_get_attribute_object (GFileInfo *info, const char *attribute);
Gets the value of a GObject attribute. If the attribute does
not contain a GObject, NULL
will be returned.
void g_file_info_set_attribute (GFileInfo *info, const char *attribute, GFileAttributeType type, gpointer value_p);
Sets the attribute
to contain the given value, if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
a GFileAttributeType |
|
pointer to the value |
void g_file_info_set_attribute_string (GFileInfo *info, const char *attribute, const char *attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
a string. |
void g_file_info_set_attribute_byte_string (GFileInfo *info, const char *attribute, const char *attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
a byte string. |
void g_file_info_set_attribute_boolean (GFileInfo *info, const char *attribute, gboolean attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
a boolean value. |
void g_file_info_set_attribute_uint32 (GFileInfo *info, const char *attribute, guint32 attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
an unsigned 32-bit integer. |
void g_file_info_set_attribute_int32 (GFileInfo *info, const char *attribute, gint32 attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
a signed 32-bit integer |
void g_file_info_set_attribute_uint64 (GFileInfo *info, const char *attribute, guint64 attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
a file attribute key. |
|
an unsigned 64-bit integer. |
void g_file_info_set_attribute_int64 (GFileInfo *info, const char *attribute, gint64 attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
|
a GFileInfo. |
|
attribute name to set. |
|
int64 value to set attribute to. |
void g_file_info_set_attribute_object (GFileInfo *info, const char *attribute, GObject *attr_value);
Sets the attribute
to contain the given attr_value
,
if possible.
void g_file_info_clear_status (GFileInfo *info);
Clears the status information from info
.
|
a GFileInfo. |
GFileType g_file_info_get_file_type (GFileInfo *info);
Gets a file's type (whether it is a regular file, symlink, etc).
This is different from the file's content type, see g_file_info_get_content_type()
.
gboolean g_file_info_get_is_hidden (GFileInfo *info);
Checks if a file is hidden.
gboolean g_file_info_get_is_backup (GFileInfo *info);
Checks if a file is a backup file.
gboolean g_file_info_get_is_symlink (GFileInfo *info);
Checks if a file is a symlink.
const char * g_file_info_get_name (GFileInfo *info);
Gets the name for a file.
|
a GFileInfo. |
Returns : |
a string containing the file name. |
const char * g_file_info_get_display_name (GFileInfo *info);
Gets a display name for a file.
|
a GFileInfo. |
Returns : |
a string containing the display name. |
const char * g_file_info_get_edit_name (GFileInfo *info);
Gets the edit name for a file.
|
a GFileInfo. |
Returns : |
a string containing the edit name. |
const char * g_file_info_get_content_type (GFileInfo *info);
Gets the file's content type.
|
a GFileInfo. |
Returns : |
a string containing the file's content type. |
void g_file_info_get_modification_time (GFileInfo *info, GTimeVal *result);
Gets the modification time of the current info
and sets it
in result
.
const char * g_file_info_get_symlink_target (GFileInfo *info);
Gets the symlink target for a given GFileInfo.
|
a GFileInfo. |
Returns : |
a string containing the symlink target. |
const char * g_file_info_get_etag (GFileInfo *info);
Gets the entity tag for a given
GFileInfo. See G_FILE_ATTRIBUTE_ETAG_VALUE
.
|
a GFileInfo. |
Returns : |
a string containing the value of the "etag:value" attribute. |
gint32 g_file_info_get_sort_order (GFileInfo *info);
Gets the value of the sort_order attribute from the GFileInfo.
See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER
.
void g_file_info_set_attribute_mask (GFileInfo *info, GFileAttributeMatcher *mask);
Sets mask
on info
to match specific attribute types.
|
a GFileInfo. |
|
a GFileAttributeMatcher. |
void g_file_info_unset_attribute_mask (GFileInfo *info);
Unsets a mask set by g_file_info_set_attribute_mask()
, if one
is set.
|
GFileInfo. |
void g_file_info_set_file_type (GFileInfo *info, GFileType type);
Sets the file type in a GFileInfo to type
.
See G_FILE_ATTRIBUTE_STANDARD_TYPE
.
void g_file_info_set_is_hidden (GFileInfo *info, gboolean is_hidden);
Sets the "is_hidden" attribute in a GFileInfo according to is_symlink
.
See G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN
.
void g_file_info_set_is_symlink (GFileInfo *info, gboolean is_symlink);
Sets the "is_symlink" attribute in a GFileInfo according to is_symlink
.
See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK
.
void g_file_info_set_name (GFileInfo *info, const char *name);
Sets the name attribute for the current GFileInfo.
See G_FILE_ATTRIBUTE_STANDARD_NAME
.
|
a GFileInfo. |
|
a string containing a name. |
void g_file_info_set_display_name (GFileInfo *info, const char *display_name);
Sets the display name for the current GFileInfo.
See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
.
|
a GFileInfo. |
|
a string containing a display name. |
void g_file_info_set_edit_name (GFileInfo *info, const char *edit_name);
Sets the edit name for the current file.
See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME
.
|
a GFileInfo. |
|
a string containing an edit name. |
void g_file_info_set_icon (GFileInfo *info, GIcon *icon);
Sets the icon for a given GFileInfo.
See G_FILE_ATTRIBUTE_STANDARD_ICON
.
void g_file_info_set_content_type (GFileInfo *info, const char *content_type);
Sets the content type attribute for a given GFileInfo.
See G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
.
|
a GFileInfo. |
|
a content type. See GContentType. |
void g_file_info_set_size (GFileInfo *info, goffset size);
Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE
attribute in the file info
to the given size.
void g_file_info_set_modification_time (GFileInfo *info, GTimeVal *mtime);
Sets the G_FILE_ATTRIBUTE_TIME_MODIFIED
attribute in the file
info to the given time value.
void g_file_info_set_symlink_target (GFileInfo *info, const char *symlink_target);
Sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET
attribute in the file info
to the given symlink target.
|
a GFileInfo. |
|
a static string containing a path to a symlink target. |
void g_file_info_set_sort_order (GFileInfo *info, gint32 sort_order);
Sets the sort order attribute in the file info structure. See
G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER
.
|
a GFileInfo. |
|
a sort order integer. |
GFileAttributeMatcher * g_file_attribute_matcher_new (const char *attributes);
Creates a new file attribute matcher, which matches attributes against a given string. GFileAttributeMatchers are reference counted structures, and are created with a reference count of 1. If the number of references falls to 0, the GFileAttributeMatcher is automatically destroyed.
The attribute
string should be formatted with specific keys separated
from namespaces with a double colon. Several "namespace::key" strings may be
concatenated with a single comma (e.g. "standard::type,standard::is-hidden").
The wildcard "*" may be used to match all keys and namespaces, or
"namespace::*" will match all keys in a given namespace.
Examples of strings to use:
Table 3. File Attribute Matcher strings and results
Matcher String | Matches |
---|---|
"*" | matches all attributes. |
"standard::is-hidden" | matches only the key is-hidden in the standard namespace. |
"standard::type,unix::*" | matches the type key in the standard namespace and all keys in the unix namespace. |
|
an attribute string to match. |
Returns : |
a GFileAttributeMatcher. |
GFileAttributeMatcher * g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher);
References a file attribute matcher.
|
a GFileAttributeMatcher. |
Returns : |
a GFileAttributeMatcher. |
void g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher);
Unreferences matcher
. If the reference count falls below 1,
the matcher
is automatically freed.
|
a GFileAttributeMatcher. |
gboolean g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher, const char *attribute);
Checks if an attribute will be matched by an attribute matcher. If
the matcher was created with the "*" matching string, this function
will always return TRUE
.
|
a GFileAttributeMatcher. |
|
a file attribute key. |
Returns : |
TRUE if attribute matches matcher . FALSE otherwise.
|
gboolean g_file_attribute_matcher_matches_only (GFileAttributeMatcher *matcher, const char *attribute);
Checks if a attribute matcher only matches a given attribute. Always
returns FALSE
if "*" was used when creating the matcher.
|
a GFileAttributeMatcher. |
|
a file attribute key. |
Returns : |
TRUE if the matcher only matches attribute . FALSE otherwise.
|
gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher, const char *ns);
Checks if the matcher will match all of the keys in a given namespace.
This will always return TRUE
if a wildcard character is in use (e.g. if
matcher was created with "standard::*" and ns
is "standard", or if matcher was created
using "*" and namespace is anything.)
TODO: this is awkwardly worded.
|
a GFileAttributeMatcher. |
|
a string containing a file attribute namespace. |
Returns : |
TRUE if the matcher matches all of the entries
in the given ns , FALSE otherwise.
|
const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher);
Gets the next matched attribute from a GFileAttributeMatcher.
|
a GFileAttributeMatcher. |
Returns : |
a string containing the next attribute or NULL if
no more attribute exist.
|