gi-gtk-4.0.6: Gtk bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gtk.Objects.DirectoryList

Description

GtkDirectoryList is a list model that wraps fileEnumerateChildrenAsync.

It presents a GListModel and fills it asynchronously with the GFileInfos returned from that function.

Enumeration will start automatically when a the DirectoryList:file property is set.

While the GtkDirectoryList is being filled, the 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 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 fileEnumeratorGetChild. 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.

Synopsis

Exported types

newtype DirectoryList Source #

Memory-managed wrapper type.

Constructors

DirectoryList (ManagedPtr DirectoryList) 

Instances

Instances details
Eq DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

GObject DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

ManagedPtrNewtype DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

Methods

toManagedPtr :: DirectoryList -> ManagedPtr DirectoryList

TypedObject DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

Methods

glibType :: IO GType

HasParentTypes DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

IsGValue (Maybe DirectoryList) Source #

Convert DirectoryList to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.DirectoryList

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe DirectoryList -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe DirectoryList)

type ParentTypes DirectoryList Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

type ParentTypes DirectoryList = '[Object, ListModel]

class (GObject o, IsDescendantOf DirectoryList o) => IsDirectoryList o Source #

Type class for types which can be safely cast to DirectoryList, for instance with toDirectoryList.

Instances

Instances details
(GObject o, IsDescendantOf DirectoryList o) => IsDirectoryList o Source # 
Instance details

Defined in GI.Gtk.Objects.DirectoryList

toDirectoryList :: (MonadIO m, IsDirectoryList o) => o -> m DirectoryList Source #

Cast to DirectoryList, for types for which this is known to be safe. For general casts, use castTo.

Methods

getAttributes

directoryListGetAttributes Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m (Maybe Text)

Returns: The queried attributes

Gets the attributes queried on the children.

getError

directoryListGetError Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m (Maybe GError)

Returns: The loading error or Nothing if loading finished successfully

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.

getFile

directoryListGetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m (Maybe File)

Returns: The file whose children are enumerated

Gets the file whose children are currently enumerated.

getIoPriority

directoryListGetIoPriority Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m Int32

Returns: The IO priority.

Gets the IO priority set via directoryListSetIoPriority.

getMonitored

directoryListGetMonitored Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m Bool

Returns: True if the directory is monitored

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

isLoading

directoryListIsLoading Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> m Bool

Returns: True if self is loading

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.

new

directoryListNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) 
=> Maybe Text

attributes: The attributes to query with

-> Maybe a

file: The file to query

-> m DirectoryList

Returns: a new GtkDirectoryList

Creates a new GtkDirectoryList.

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

setAttributes

directoryListSetAttributes Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> Maybe Text

attributes: the attributes to enumerate

-> m () 

Sets the attributes to be enumerated and starts the enumeration.

If attributes is Nothing, no attributes will be queried, but a list of GFileInfos will still be created.

setFile

directoryListSetFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a, IsFile b) 
=> a

self: a GtkDirectoryList

-> Maybe b

file: the GFile to be enumerated

-> m () 

Sets the file to be enumerated and starts the enumeration.

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

setIoPriority

directoryListSetIoPriority Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> Int32

ioPriority: IO priority to use

-> m () 

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 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 PRIORITY_DEFAULT_IDLE may increase responsiveness.

setMonitored

directoryListSetMonitored Source #

Arguments

:: (HasCallStack, MonadIO m, IsDirectoryList a) 
=> a

self: a GtkDirectoryList

-> Bool

monitored: True to monitor the directory for changes

-> m () 

Sets whether the directory list will monitor the directory for changes.

If monitoring is enabled, the itemsChanged 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.

Properties

attributes

The attributes to query.

clearDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> m () Source #

Set the value of the “attributes” property to Nothing. When overloading is enabled, this is equivalent to

clear #attributes

constructDirectoryListAttributes :: (IsDirectoryList o, MonadIO m) => Text -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “attributes” property. This is rarely needed directly, but it is used by new.

getDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe Text) Source #

Get the value of the “attributes” property. When overloading is enabled, this is equivalent to

get directoryList #attributes

setDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> Text -> m () Source #

Set the value of the “attributes” property. When overloading is enabled, this is equivalent to

set directoryList [ #attributes := value ]

error

Error encountered while loading files.

getDirectoryListError :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe GError) Source #

Get the value of the “error” property. When overloading is enabled, this is equivalent to

get directoryList #error

file

File to query.

clearDirectoryListFile :: (MonadIO m, IsDirectoryList o) => o -> m () Source #

Set the value of the “file” property to Nothing. When overloading is enabled, this is equivalent to

clear #file

constructDirectoryListFile :: (IsDirectoryList o, MonadIO m, IsFile a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “file” property. This is rarely needed directly, but it is used by new.

getDirectoryListFile :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe File) Source #

Get the value of the “file” property. When overloading is enabled, this is equivalent to

get directoryList #file

setDirectoryListFile :: (MonadIO m, IsDirectoryList o, IsFile a) => o -> a -> m () Source #

Set the value of the “file” property. When overloading is enabled, this is equivalent to

set directoryList [ #file := value ]

ioPriority

Priority used when loading.

constructDirectoryListIoPriority :: (IsDirectoryList o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “io-priority” property. This is rarely needed directly, but it is used by new.

getDirectoryListIoPriority :: (MonadIO m, IsDirectoryList o) => o -> m Int32 Source #

Get the value of the “io-priority” property. When overloading is enabled, this is equivalent to

get directoryList #ioPriority

setDirectoryListIoPriority :: (MonadIO m, IsDirectoryList o) => o -> Int32 -> m () Source #

Set the value of the “io-priority” property. When overloading is enabled, this is equivalent to

set directoryList [ #ioPriority := value ]

itemType

The type of items. See listModelGetItemType.

Since: 4.8

getDirectoryListItemType :: (MonadIO m, IsDirectoryList o) => o -> m GType Source #

Get the value of the “item-type” property. When overloading is enabled, this is equivalent to

get directoryList #itemType

loading

True if files are being loaded.

getDirectoryListLoading :: (MonadIO m, IsDirectoryList o) => o -> m Bool Source #

Get the value of the “loading” property. When overloading is enabled, this is equivalent to

get directoryList #loading

monitored

True if the directory is monitored for changed.

constructDirectoryListMonitored :: (IsDirectoryList o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “monitored” property. This is rarely needed directly, but it is used by new.

getDirectoryListMonitored :: (MonadIO m, IsDirectoryList o) => o -> m Bool Source #

Get the value of the “monitored” property. When overloading is enabled, this is equivalent to

get directoryList #monitored

setDirectoryListMonitored :: (MonadIO m, IsDirectoryList o) => o -> Bool -> m () Source #

Set the value of the “monitored” property. When overloading is enabled, this is equivalent to

set directoryList [ #monitored := value ]

nItems

The number of items. See listModelGetNItems.

Since: 4.8

getDirectoryListNItems :: (MonadIO m, IsDirectoryList o) => o -> m Word32 Source #

Get the value of the “n-items” property. When overloading is enabled, this is equivalent to

get directoryList #nItems