Synopsis#include <gio/gio.h> enum GFileAttributeType; enum GFileAttributeInfoFlags; enum GFileAttributeStatus; GFileAttributeInfo; GFileAttributeInfoList; GFileAttributeInfoList* g_file_attribute_info_list_new (void); GFileAttributeInfoList* g_file_attribute_info_list_ref (GFileAttributeInfoList *list); void g_file_attribute_info_list_unref (GFileAttributeInfoList *list); GFileAttributeInfoList* g_file_attribute_info_list_dup (GFileAttributeInfoList *list); const GFileAttributeInfo* g_file_attribute_info_list_lookup (GFileAttributeInfoList *list, const char *name); void g_file_attribute_info_list_add (GFileAttributeInfoList *list, const char *name, GFileAttributeType type, GFileAttributeInfoFlags flags); DescriptionFile 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, e.g. "namespace:keyname". Namespaces are included to sort key-value pairs by namespaces for relevance. Keys can be retrived using wildcards, e.g. "standard::*" will return all of the keys in the "standard" namespace.
Values are stored within the list in GFileAttributeValue structures.
Values can store different types, listed in the enum GFileAttributeType.
Upon creation of a GFileAttributeValue, the type will be set to
The list of possible attributes for a filesystem (pointed to by a GFile) is availible as a GFileAttributeInfoList. This list is queryable by key names as indicated earlier. Classes that implement GFileIface will create a GFileAttributeInfoList and install default keys and values for their given file system, architecture, and other possible implementation details (e.g., on a UNIX system, a file attribute key will be registered for the user id for a given file).
Table 1. GFileAttributes Default Namespaces
Please note that these are not all of the possible namespaces. More namespaces can be added from GIO modules or by individual applications. For more information about writing GIO modules, see GIOModule.
Table 2. GFileAttributes Built-in Keys and Value Types
Note that there are no predefined keys in the "xattr" and "xattr-sys"
namespaces. Keys for the "xattr" namespace are constructed by stripping
away the "user." prefix from the extended user attribute, and prepending
"xattr::". Keys for the "xattr-sys" namespace are constructed by
concatenating "xattr-sys::" with the extended attribute name. All extended
attribute values are returned as hex-encoded strings in which bytes outside
the ASCII range are encoded as hexadecimal escape sequences of the form
\x
Detailsenum GFileAttributeTypetypedef enum { G_FILE_ATTRIBUTE_TYPE_INVALID = 0, G_FILE_ATTRIBUTE_TYPE_STRING, G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, /* zero terminated string of non-zero bytes */ G_FILE_ATTRIBUTE_TYPE_BOOLEAN, G_FILE_ATTRIBUTE_TYPE_UINT32, G_FILE_ATTRIBUTE_TYPE_INT32, G_FILE_ATTRIBUTE_TYPE_UINT64, G_FILE_ATTRIBUTE_TYPE_INT64, G_FILE_ATTRIBUTE_TYPE_OBJECT } GFileAttributeType; The data types for file attributes.
enum GFileAttributeInfoFlagstypedef enum { G_FILE_ATTRIBUTE_INFO_NONE = 0, G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE = (1 << 0), G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED = (1 << 1) } GFileAttributeInfoFlags; Flags specifying the behaviour of an attribute.
enum GFileAttributeStatustypedef enum { G_FILE_ATTRIBUTE_STATUS_UNSET = 0, G_FILE_ATTRIBUTE_STATUS_SET, G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING } GFileAttributeStatus;
Used by
GFileAttributeInfotypedef struct { char *name; GFileAttributeType type; GFileAttributeInfoFlags flags; } GFileAttributeInfo; Information about a specific attribute.
GFileAttributeInfoListtypedef struct { GFileAttributeInfo *infos; int n_infos; } GFileAttributeInfoList; Acts as a lightweight registry for possible valid file attributes. The registry stores Key-Value pair formats as GFileAttributeInfos.
g_file_attribute_info_list_new ()GFileAttributeInfoList* g_file_attribute_info_list_new (void); Creates a new file attribute info list.
g_file_attribute_info_list_ref ()GFileAttributeInfoList* g_file_attribute_info_list_ref (GFileAttributeInfoList *list); References a file attribute info list.
g_file_attribute_info_list_unref ()void g_file_attribute_info_list_unref (GFileAttributeInfoList *list);
Removes a reference from the given
g_file_attribute_info_list_dup ()GFileAttributeInfoList* g_file_attribute_info_list_dup (GFileAttributeInfoList *list); Makes a duplicate of a file attribute info list.
g_file_attribute_info_list_lookup ()const GFileAttributeInfo* g_file_attribute_info_list_lookup (GFileAttributeInfoList *list, const char *name);
Gets the file attribute with the name
g_file_attribute_info_list_add ()void g_file_attribute_info_list_add (GFileAttributeInfoList *list, const char *name, GFileAttributeType type, GFileAttributeInfoFlags flags);
Adds a new attribute with
|