Package ch.bailu.gtk.gtk
Class DirectoryList
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gtk.DirectoryList
- All Implemented Interfaces:
PointerInterface
`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
[property@Gtk.DirectoryList:file] property is set.
While the `GtkDirectoryList` is being filled, the
[property@Gtk.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 [property@Gtk.DirectoryList:error]
property will be set to give more indication about the failure.
The `GFileInfo`s returned from a `GtkDirectoryList` have the "standard::file"
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.
It presents a `GListModel` and fills it asynchronously with the `GFileInfo`s
returned from that function.
Enumeration will start automatically when a the
[property@Gtk.DirectoryList:file] property is set.
While the `GtkDirectoryList` is being filled, the
[property@Gtk.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 [property@Gtk.DirectoryList:error]
property will be set to give more indication about the failure.
The `GFileInfo`s returned from a `GtkDirectoryList` have the "standard::file"
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionDirectoryList
(PointerContainer pointer) DirectoryList
(Str attributes, File file) Creates a new `GtkDirectoryList`.DirectoryList
(String attributes, File file) Creates a new `GtkDirectoryList`. -
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceListModel
.Gets the attributes queried on the children.static ClassHandler
getError()
Gets the loading error, if any.getFile()
Gets the file whose children are currently enumerated.static int
int
Gets the IO priority set via gtk_directory_list_set_io_priority().boolean
Returns whether the directory list is monitoring
the directory for changes.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
boolean
Returns %TRUE if the children enumeration is currently in
progress.void
setAttributes
(Str attributes) Sets the @attributes to be enumerated and starts the enumeration.void
setAttributes
(String attributes) Sets the @attributes to be enumerated and starts the enumeration.void
Sets the @file to be enumerated and starts the enumeration.void
setIoPriority
(int io_priority) Sets the IO priority to use while loading directories.void
setMonitored
(boolean monitored) Sets whether the directory list will monitor the directory
for changes.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
DirectoryList
-
DirectoryList
Creates a new `GtkDirectoryList`.
The `GtkDirectoryList` is querying the given @file
with the given @attributes.- Parameters:
attributes
- The attributes to query withfile
- The file to query
-
DirectoryList
Creates a new `GtkDirectoryList`.
The `GtkDirectoryList` is querying the given @file
with the given @attributes.- Parameters:
attributes
- The attributes to query withfile
- The file to query
-
-
Method Details
-
getClassHandler
-
getAttributes
Gets the attributes queried on the children.- Returns:
- The queried attributes
-
getError
Gets 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.- Returns:
- The loading error or %NULL if loading finished successfully
-
getFile
Gets the file whose children are currently enumerated.- Returns:
- The file whose children are enumerated
-
getIoPriority
public int getIoPriority()Gets the IO priority set via gtk_directory_list_set_io_priority().- Returns:
- The IO priority.
-
getMonitored
public boolean getMonitored()Returns whether the directory list is monitoring
the directory for changes.- Returns:
- %TRUE if the directory is monitored
-
isLoading
public boolean isLoading()Returns %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.- Returns:
- %TRUE if @self is loading
-
setAttributes
Sets the @attributes to be enumerated and starts the enumeration.
If @attributes is %NULL, no attributes will be queried, but a list
of `GFileInfo`s will still be created.- Parameters:
attributes
- the attributes to enumerate
-
setAttributes
Sets the @attributes to be enumerated and starts the enumeration.
If @attributes is %NULL, no attributes will be queried, but a list
of `GFileInfo`s will still be created.- Parameters:
attributes
- the attributes to enumerate
-
setFile
Sets the @file to be enumerated and starts the enumeration.
If @file is %NULL, the result will be an empty list.- Parameters:
file
- the `GFile` to be enumerated
-
setIoPriority
public void setIoPriority(int io_priority) 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 like %G_PRIORITY_DEFAULT_IDLE
may increase responsiveness.- Parameters:
io_priority
- IO priority to use
-
setMonitored
public void setMonitored(boolean monitored) 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.- Parameters:
monitored
- %TRUE to monitor the directory for changes
-
asListModel
Implements interfaceListModel
. Call this to get access to interface functions.- Returns:
ListModel
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-