DirectoryListProtocol
public protocol DirectoryListProtocol : ListModelProtocol, ObjectProtocol
GtkDirectoryList is a list model that wraps g_file_enumerate_children_async().
It presents a GListModel and fills it asynchronously with the GFileInfos
returned from that function.
Enumeration will start automatically when a the
[propertyGtk.DirectoryList:file] property is set.
While the GtkDirectoryList is being filled, the
[propertyGtk.DirectoryList:loading] property will be set to true. You can
listen to that property if you want to show information like a GtkSpinner
or a “Loading…” text.
If loading fails at any point, the [propertyGtk.DirectoryList:error]
property will be set to give more indication about the failure.
The GFileInfos returned from a GtkDirectoryList have the “standardfile”
attribute set to the GFile they refer to. This way you can get at the file
that is referred to in the same way you would via g_file_enumerator_get_child().
This means you do not need access to the GtkDirectoryList, but can access
the GFile directly from the GFileInfo when operating with a GtkListView
or similar.
The DirectoryListProtocol protocol exposes the methods and properties of an underlying GtkDirectoryList instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see DirectoryList.
Alternatively, use DirectoryListRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkDirectoryListinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
directory_list_ptrDefault implementationTyped pointer to the underlying
GtkDirectoryListinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkDirectoryListinstance.Declaration
Swift
var directory_list_ptr: UnsafeMutablePointer<GtkDirectoryList>! { get } -
Required Initialiser for types conforming to
DirectoryListProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DirectoryListPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: DirectoryListPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a DirectoryList property
Declaration
Swift
@inlinable func get(property: DirectoryListPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a DirectoryList property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: DirectoryListPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getAttributes()Extension methodGets the attributes queried on the children.
Declaration
Swift
@inlinable func getAttributes() -> String! -
getError()Extension methodGets the loading error, if any.
If an error occurs during the loading process, the loading process will finish and this property allows querying the error that happened. This error will persist until a file is loaded again.
An error being set does not mean that no files were loaded, and all successfully queried files will remain in the list.
Declaration
Swift
@inlinable func getError() -> GLib.ErrorRef! -
getFile()Extension methodGets the file whose children are currently enumerated.
Declaration
Swift
@inlinable func getFile() -> GIO.FileRef! -
getIoPriority()Extension methodGets the IO priority set via
gtk_directory_list_set_io_priority().Declaration
Swift
@inlinable func getIoPriority() -> Int -
getMonitored()Extension methodReturns whether the directory list is monitoring the directory for changes.
Declaration
Swift
@inlinable func getMonitored() -> Bool -
set(attributes:Extension method) Sets the
attributesto be enumerated and starts the enumeration.If
attributesisnil, no attributes will be queried, but a list ofGFileInfos will still be created.Declaration
Swift
@inlinable func set(attributes: UnsafePointer<CChar>? = nil) -
set(file:Extension method) -
set(file:Extension method) -
set(ioPriority:Extension method) Sets the IO priority to use while loading directories.
Setting the priority while
selfis loading will reprioritize the ongoing load as soon as possible.The default IO priority is
G_PRIORITY_DEFAULT, which is higher than the GTK redraw priority. If you are loading a lot of directories in parallel, lowering it to something likeG_PRIORITY_DEFAULT_IDLEmay increase responsiveness.Declaration
Swift
@inlinable func set(ioPriority: Int) -
set(monitored:Extension method) Sets whether the directory list will monitor the directory for changes.
If monitoring is enabled, the
items-changedsignal will be emitted when the directory contents change.When monitoring is turned on after the initial creation of the directory list, the directory is reloaded to avoid missing files that appeared between the initial loading and when monitoring was turned on.
Declaration
Swift
@inlinable func set(monitored: Bool) -
attributesExtension methodThe attributes to query.
Declaration
Swift
@inlinable var attributes: String! { get nonmutating set } -
errorExtension methodError encountered while loading files.
Declaration
Swift
@inlinable var error: GLib.ErrorRef! { get } -
fileExtension methodFile to query.
Declaration
Swift
@inlinable var file: GIO.FileRef! { get nonmutating set } -
ioPriorityExtension methodGets the IO priority set via
gtk_directory_list_set_io_priority().Declaration
Swift
@inlinable var ioPriority: Int { get nonmutating set } -
isLoadingExtension methodReturns
trueif the children enumeration is currently in progress.Files will be added to
selffrom time to time while loading is going on. The order in which are added is undefined and may change in between runs.Declaration
Swift
@inlinable var isLoading: Bool { get } -
monitoredExtension methodtrueif the directory is monitored for changed.Declaration
Swift
@inlinable var monitored: Bool { get nonmutating set }
View on GitHub
Install in Dash
DirectoryListProtocol Protocol Reference