Gtk.DirectoryList¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r/en |
|||
r/w/en |
|||
r |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.DirectoryList(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A list model that wraps [method`Gio`.File.enumerate_children_async].
It presents a
GListModeland fills it asynchronously with the ``GFileInfo``s returned from that function.Enumeration will start automatically when the [property`Gtk`.DirectoryList:file] property is set.
While the
GtkDirectoryListis being filled, the [property`Gtk`.DirectoryList:loading] property will be set toTrue. You can listen to that property if you want to show information like aGtkSpinneror 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 ``GtkDirectoryListhave the “standard::file” attribute set to theGFilethey refer to. This way you can get at the file that is referred to in the same way you would viaGio.FileEnumerator.get_child(). This means you do not need access to theGtkDirectoryList, but can access theGFiledirectly from theGFileInfowhen operating with aGtkListViewor similar.- classmethod new(attributes, file)[source]¶
- Parameters:
- Returns:
a new
GtkDirectoryList- Return type:
Creates a new
GtkDirectoryList.The
GtkDirectoryListis querying the given file with the given attributes.
- get_error()[source]¶
- Returns:
The loading error or
Noneif loading finished successfully- Return type:
GLib.ErrororNone
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.
- get_io_priority()[source]¶
- Returns:
The IO priority.
- Return type:
Gets the IO priority set via
Gtk.DirectoryList.set_io_priority().
- get_monitored()[source]¶
-
Returns whether the directory list is monitoring the directory for changes.
- is_loading()[source]¶
-
Returns
Trueif 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.
- set_attributes(attributes)[source]¶
-
Sets the attributes to be enumerated and starts the enumeration.
If attributes is
None, the list of file infos will still be created, it will just not contain any extra attributes.
- set_file(file)[source]¶
-
Sets the file to be enumerated and starts the enumeration.
If file is
None, the result will be an empty list.
- set_io_priority(io_priority)[source]¶
- Parameters:
io_priority (
int) – IO priority to use
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
GLib.PRIORITY_DEFAULT, which is higher than the GTK redraw priority. If you are loading a lot of directories in parallel, lowering it to something likeGLib.PRIORITY_DEFAULT_IDLEmay increase responsiveness.
- set_monitored(monitored)[source]¶
-
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.
Property Details¶
- Gtk.DirectoryList.props.attributes¶
- Name:
attributes- Type:
- Default Value:
- Flags:
The attributes to query.
- Gtk.DirectoryList.props.error¶
- Name:
error- Type:
- Default Value:
- Flags:
Error encountered while loading files.
- Gtk.DirectoryList.props.file¶
- Name:
file- Type:
- Default Value:
- Flags:
File to query.
- Gtk.DirectoryList.props.io_priority¶
- Name:
io-priority- Type:
- Default Value:
0- Flags:
Priority used when loading.
- Gtk.DirectoryList.props.item_type¶
- Name:
item-type- Type:
- Default Value:
<GType GFileInfo>- Flags:
The type of items. See [method`Gio`.ListModel.get_item_type].
New in version 4.8.
- Gtk.DirectoryList.props.loading¶
- Name:
loading- Type:
- Default Value:
- Flags:
Trueif files are being loaded.