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 GFileInfo
s
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 GFileInfo
s 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
GtkDirectoryList
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
directory_list_ptr
Default implementationTyped pointer to the underlying
GtkDirectoryList
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkDirectoryList
instance.Declaration
Swift
var directory_list_ptr: UnsafeMutablePointer<GtkDirectoryList>! { get }
-
Required Initialiser for types conforming to
DirectoryListProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
DirectoryListPropertyName
source 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 : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a DirectoryList property
Declaration
Swift
@inlinable func get(property: DirectoryListPropertyName) -> GLibObject.Value
Parameters
property
the 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
property
the 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
attributes
to be enumerated and starts the enumeration.If
attributes
isnil
, no attributes will be queried, but a list ofGFileInfo
s 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
self
is 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_IDLE
may 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-changed
signal 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)
-
attributes
Extension methodThe attributes to query.
Declaration
Swift
@inlinable var attributes: String! { get nonmutating set }
-
error
Extension methodError encountered while loading files.
Declaration
Swift
@inlinable var error: GLib.ErrorRef! { get }
-
file
Extension methodFile to query.
Declaration
Swift
@inlinable var file: GIO.FileRef! { get nonmutating set }
-
ioPriority
Extension methodGets the IO priority set via
gtk_directory_list_set_io_priority()
.Declaration
Swift
@inlinable var ioPriority: Int { get nonmutating set }
-
isLoading
Extension methodReturns
true
if the children enumeration is currently in progress.Files will be added to
self
from 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 }
-
monitored
Extension methodtrue
if the directory is monitored for changed.Declaration
Swift
@inlinable var monitored: Bool { get nonmutating set }