1.45 <GtkDirectoryList>

Class: <GtkDirectoryList>

It derives from <GObject>.

A list model that wraps 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 the directory-list:file property is set.

While the <GtkDirectoryList> is being filled, the directory-list:loading property will be set to #t. 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 directory-list: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 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.

Properties

Property: directory-list:attributes self

The attributes to query.

Its value is a string, or #f.

Set it with (set! (directory-list:attributes self) value).

Property: directory-list:error self

Error encountered while loading files.

Its value is a <GError>, or #f.

It is read only.

Property: directory-list:file self

File to query.

Its value is a <GFile>, or #f.

Set it with (set! (directory-list:file self) value).

Property: directory-list:io-priority self

Priority used when loading.

Its value is a 32-bit integer.

Set it with (set! (directory-list:io-priority self) value).

Property: directory-list:item-type self

The type of items. See list-model:get-item-type.

Its value is a class, or a GType number.

It is read only.

Property: directory-list:loading self

#t if files are being loaded.

Its value is a boolean.

It is read only.

Property: directory-list:monitored self

#t if the directory is monitored for changed.

Its value is a boolean.

Set it with (set! (directory-list:monitored self) value).

Property: directory-list:n-items self

The number of items. See list-model:get-n-items.

Its value is an unsigned 32-bit integer.

It is read only.

Procedures

Method: directory-list:get-attributes self ⇒ %return
Method: get-attributes self ⇒ %return

Gets the attributes queried on the children.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a string, or #f.

The queried attributes

Method: directory-list:get-error self ⇒ %return
Method: get-error self ⇒ %return

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.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a <GError>, or #f.

The loading error or #f if loading finished successfully

Method: directory-list:get-file self ⇒ %return
Method: get-file self ⇒ %return

Gets the file whose children are currently enumerated.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a <GFile>, or #f.

The file whose children are enumerated

Method: directory-list:get-io-priority self ⇒ %return
Method: get-io-priority self ⇒ %return

Gets the IO priority set via directory-list:set-io-priority.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a 32-bit integer.

The IO priority.

Method: directory-list:get-monitored? self ⇒ %return
Method: get-monitored? self ⇒ %return

Returns whether the directory list is monitoring the directory for changes.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a boolean.

#t if the directory is monitored

Method: directory-list:is-loading? self ⇒ %return
Method: is-loading? self ⇒ %return

Returns #t 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.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

%return

Returned: a boolean.

#t if self is loading

Procedure: directory-list:new [attributes] [file] ⇒ %return

Creates a new <GtkDirectoryList>.

The <GtkDirectoryList> is querying the given file with the given attributes.

attributes

Passed, or left out: a string, or #f.

The attributes to query with

file

Passed, or left out: a <GFile>, or #f.

The file to query

%return

Returned: a <GtkDirectoryList>.

a new <GtkDirectoryList>

Method: directory-list:set-attributes self [attributes]
Method: set-attributes self [attributes]

Sets the attributes to be enumerated and starts the enumeration.

If attributes is #f, the list of file infos will still be created, it will just not contain any extra attributes.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

attributes

Passed, or left out: a string, or #f.

the attributes to enumerate

Method: directory-list:set-file self [file]
Method: set-file self [file]

Sets the file to be enumerated and starts the enumeration.

If file is #f, the result will be an empty list.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

file

Passed, or left out: a <GFile>, or #f.

the <GFile> to be enumerated

Method: directory-list:set-io-priority self io-priority
Method: set-io-priority self 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.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

io-priority

Passed: a 32-bit integer.

IO priority to use

Method: directory-list:set-monitored self monitored
Method: set-monitored self 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.

self

Passed: a <GtkDirectoryList>.

a <GtkDirectoryList>

monitored

Passed: a boolean.

#t to monitor the directory for changes