FileAttributeMatcher

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.

Constructors

this
this(GFileAttributeMatcher* gFileAttributeMatcher)

Sets our main struct and passes it to the parent class

this
this(string 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.

Members

Functions

doref
FileAttributeMatcher doref()

References a file attribute matcher.

enumerateNamespace
int enumerateNamespace(string 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.

enumerateNext
string enumerateNext()

Gets the next matched attribute from a GFileAttributeMatcher.

getFileAttributeMatcherStruct
GFileAttributeMatcher* getFileAttributeMatcherStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

matches
int matches(string 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.

matchesOnly
int matchesOnly(string attribute)

Checks if a attribute matcher only matches a given attribute. Always returns FALSE if "*" was used when creating the matcher.

subtract
FileAttributeMatcher subtract(FileAttributeMatcher subtract)

Subtracts all attributes of subtract from matcher and returns a matcher that supports those attributes. Note that currently it is not possible to remove a single attribute when the matcher matches the whole namespace - or remove a namespace or attribute when the matcher matches everything. This is a limitation of the current implementation, but may be fixed in the future.

toString
string toString()

Prints what the matcher is matching against. The format will be equal to the format passed to g_file_attribute_matcher_new(). The output however, might not be identical, as the matcher may decide to use a different order or omit needless parts. Since 2.32

unref
void unref()

Unreferences matcher. If the reference count falls below 1, the matcher is automatically freed.

Variables

gFileAttributeMatcher
GFileAttributeMatcher* gFileAttributeMatcher;

the main Gtk struct

Inherited Members

From Boxed

boxedCopy
void* boxedCopy(GType boxedType, void* srcBoxed)

Provide a copy of a boxed structure src_boxed which is of type boxed_type.

boxedFree
void boxedFree(GType boxedType, void* boxed)

Free the boxed structure boxed which is of type boxed_type.

boxedTypeRegisterStatic
GType boxedTypeRegisterStatic(string name, GBoxedCopyFunc boxedCopy, GBoxedFreeFunc boxedFree)

This function creates a new G_TYPE_BOXED derived type id for a new boxed type with name name. Boxed type handling functions have to be provided to copy and free opaque boxed structures of this type.

pointerTypeRegisterStatic
GType pointerTypeRegisterStatic(string name)

Creates a new G_TYPE_POINTER derived type id for a new pointer type with name name.

Meta