Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

GLib::FileAttribute

module GLib::FileAttribute

File attributes in GIO consist of a list of key-value pairs.

Keys are strings that contain a key namespace and a key name, separated by a colon, for example, “namespace:keyname”. Namespaces are included to sort key-value pairs by namespaces for relevance. Keys can be retrived using wildcards, for example, “standard::*” will return all of the keys in the “standard” namespace.

Values can store different types, listed in the enum GLib::FileAttribute::Type.

The list of possible attributes for a filesystem (pointed to by a GLib::File) is availible as a GLib::FileAttribute::InfoList. This list is queryable by key names as indicated earlier.

Classes that include GLib::File will create a GLib::FileAttribute::InfoList and install default keys and values for their given file system, architecture, and other possible implementation details (for example, on a UNIX system, a file attribute key will be registered for the user id for a given file).

TODO: Add default namespaces table

Constants

ACCESS_CAN_DELETE
A key in the “access” namespace for checking deletion privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to delete the file.
ACCESS_CAN_EXECUTE
A key in the “access” namespace for getting execution privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to execute the file.
ACCESS_CAN_READ
A key in the “access” namespace for getting read privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to read the file.
ACCESS_CAN_RENAME
A key in the “access” namespace for checking renaming privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to rename the file.
ACCESS_CAN_TRASH
A key in the “access” namespace for checking trashing privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to move the file to the trash.
ACCESS_CAN_WRITE
A key in the “access” namespace for getting write privileges. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN. This attribute will be true if the user is able to write to the file.
DOS_IS_ARCHIVE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
DOS_IS_SYSTEM
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
ETAG_VALUE
A key in the “etag” namespace for getting the value of the file’s entity tag. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
FILESYSTEM_FREE
A key in the “filesystem” namespace for getting the number of bytes of free space left on the file system. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.
FILESYSTEM_READONLY
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
FILESYSTEM_SIZE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.
FILESYSTEM_TYPE
A key in the “filesystem” namespace for getting the file system's type. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
FILESYSTEM_USE_PREVIEW
A key in the “filesystem” namespace for hinting a file manager application whether it should preview (for example, thumbnail) files on the file system. The value for this key contain a GFilesystemPreviewType.
GVFS_BACKEND
A key in the “gvfs” namespace that gets the name of the current GVFS backend in use. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
ID_FILE
A key in the “id” namespace for getting a file identifier. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING. An example use would be during listing files, to avoid recursive directory scanning.
ID_FILESYSTEM
A key in the “id” namespace for getting the file system identifier. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::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).
INFO_COPY_WHEN_MOVED
Copy the attribute values when the file is moved
INFO_COPY_WITH_FILE
Copy the attribute values when the file is copied
INFO_NONE
No flags set
MOUNTABLE_CAN_EJECT
A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) can be ejected. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
MOUNTABLE_CAN_MOUNT
A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) is mountable. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
MOUNTABLE_CAN_POLL
A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) can be polled. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
MOUNTABLE_CAN_START

A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) can be started. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.

Since 2.22

MOUNTABLE_CAN_START_DEGRADED

A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) can be started degraded. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.

Since 2.22

MOUNTABLE_CAN_STOP

A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) can be stopped. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.

Since 2.22

MOUNTABLE_CAN_UNMOUNT
A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) is unmountable. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
MOUNTABLE_HAL_UDI
A key in the “mountable” namespace for getting the HAL UDI for the mountable file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC

A key in the “mountable” namespace for checking if a file (of type GLib::File::TYPE_MOUNTABLE) is automatically polled for media. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.

Since 2.22

MOUNTABLE_START_STOP_TYPE

A key in the “mountable” namespace for getting the GLib::Drive::StartStopType. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.

Since 2.22

MOUNTABLE_UNIX_DEVICE
A key in the “mountable” namespace for getting the unix device. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
MOUNTABLE_UNIX_DEVICE_FILE

A key in the “mountable” namespace for getting the unix device file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

Since 2.22

OWNER_GROUP
A key in the “owner” namespace for getting the file owner’s group. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
OWNER_USER
A key in the “owner” namespace for getting the user name of the file’s owner. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
OWNER_USER_REAL
A key in the “owner” namespace for getting the real name of the user that owns the file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
PREVIEW_ICON

A key in the “preview” namespace for getting a GLib::Icon that can be used to get preview of the file. For example, it may be a low resolution thumbnail without metadata. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_OBJECT. The value for this key should contain a GLib::Icon.

Since 2.20

SELINUX_CONTEXT
A key in the “selinux” namespace for getting the file’s SELinux context. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING. Note that this attribute is only available if GLib has been built with SELinux support.
STANDARD_ALLOCATED_SIZE

A key in the “standard” namespace for getting the amount of disk space that is consumed by the file (in bytes). This will generally be larger than the file size (due to block size overhead) but can occasionally be smaller (for example, for sparse files). Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.

Since 2.20

STANDARD_CONTENT_TYPE
A key in the “standard” namespace for getting the content type of the file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING. The value for this key should contain a valid content type.
STANDARD_COPY_NAME

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 UTF-8, and corresponds directly to the original filename (only transcoded to UTF-8). 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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

STANDARD_DESCRIPTION
A key in the “standard” namespace for getting the description of the file. The description is a UTF-8 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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

STANDARD_DISPLAY_NAME
A key in the “standard” namespace for getting the display name of the file. A display name is guaranteed to be in UTF-8 and can thus be displayed in the UI. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
STANDARD_EDIT_NAME

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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

STANDARD_FAST_CONTENT_TYPE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
STANDARD_ICON
A key in the “standard” namespace for getting the icon for the file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_OBJECT. The value for this key should contain a GLib::Icon.
STANDARD_IS_BACKUP
A key in the “standard” namespace for checking if a file is a backup file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
STANDARD_IS_HIDDEN
A key in the “standard” namespace for checking if a file is hidden. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
STANDARD_IS_SYMLINK
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
STANDARD_IS_VIRTUAL
A key in the “standard” namespace for checking if a file is virtual. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
STANDARD_NAME
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BYTE_STRING.
STANDARD_SIZE
A key in the “standard” namespace for getting the file’s size (in bytes). Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.
STANDARD_SORT_ORDER
A key in the “standard” namespace for setting the sort order of a file. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::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.
STANDARD_SYMLINK_TARGET
A key in the “standard” namespace for getting the symlink target, if the file is a symlink. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BYTE_STRING.
STANDARD_TARGET_URI
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.
STANDARD_TYPE
A key in the “standard” namespace for storing file types. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32. The value for this key should contain a GFileType.
STATUS_ERROR_SETTING
Indicates an error in setting the value
STATUS_SET
Attribute value is set
STATUS_UNSET
Attribute value is unset (empty)
THUMBNAILING_FAILED
A key in the “thumbnail” namespace for checking if thumbnailing failed. This attribute is true if thumbnailing failed. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
THUMBNAIL_PATH
A key in the “thumbnail” namespace for getting the path to the thumbnail image. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BYTE_STRING.
TIME_ACCESS
A key in the “time” namespace for getting the time the file was last accessed. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64, and contains the UNIX time since the file was last accessed.
TIME_ACCESS_USEC
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
TIME_CHANGED

A key in the “time” namespace for getting the time the file was last changed. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64, and contains the UNIX time since the file was last changed.

This corresponds to the traditional UNIX ctime.

TIME_CHANGED_USEC
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
TIME_CREATED

A key in the “time” namespace for getting the time the file was created. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64, and contains the UNIX time since the file was created.

This corresponds to the NTFS ctime.

TIME_CREATED_USEC
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
TIME_MODIFIED
A key in the “time” namespace for getting the time the file was last modified. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64, and contains the UNIX time since the file was modified.
TIME_MODIFIED_USEC
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
TRASH_DELETION_DATE

A key in the “trash” namespace. When requested against items in “trash:///”, will return the date and time when the file was trashed. The format of the returned String is YYYY-MM-DDThh:mm:ss. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

Since 2.24.

TRASH_ORIG_PATH

A key in the “trash” namespace. When requested against items in “trash:///”, will return the original path to the file before it was trashed. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_STRING.

Since 2.24.

TRASH_ITEM_COUNT
A key in the “trash” namespace. When requested against “trash:///” returns the number of (toplevel) items in the trash folder. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
TYPE_BOOLEAN
A Boolean
TYPE_BYTE_STRING
A String of non-zero bytes
TYPE_INT32
A Fixnum
TYPE_INT64
A Fixnum or Bignum
TYPE_INVALID
Indicates an invalid or uninitialized type
TYPE_OBJECT
A GLib::Object
TYPE_STRING
A UTF-8-encoded String
TYPE_STRINGV
An Array of Strings
TYPE_UINT32
A Fixnum or Bignum
TYPE_UINT64
A Fixnum or Bignum
UNIX_BLOCKS
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.
UNIX_BLOCK_SIZE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_DEVICE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_GID
A key in the “unix” namespace for getting the group ID for the file. This attribute is only available for UNIX file systems. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_INODE
A key in the “unix” namespace for getting the inode of the file. This attribute is only available for UNIX file systems. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT64.
UNIX_IS_MOUNTPOINT
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_BOOLEAN.
UNIX_MODE
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_NLINK
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_RDEV
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 GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.
UNIX_UID
A key in the “unix” namespace for getting the user ID for the file. This attribute is only available for UNIX file systems. Corresponding GLib::FileAttribute::Type is GLib::FileAttribute::TYPE_UINT32.