Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GtkDirectoryList
is a list model that wraps fileEnumerateChildrenAsync
.
It presents a GListModel
and fills it asynchronously with the GFileInfo
s
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 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 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
- newtype DirectoryList = DirectoryList (ManagedPtr DirectoryList)
- class (GObject o, IsDescendantOf DirectoryList o) => IsDirectoryList o
- toDirectoryList :: (MonadIO m, IsDirectoryList o) => o -> m DirectoryList
- directoryListGetAttributes :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m (Maybe Text)
- directoryListGetError :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m (Maybe GError)
- directoryListGetFile :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m (Maybe File)
- directoryListGetIoPriority :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m Int32
- directoryListGetMonitored :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m Bool
- directoryListIsLoading :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> m Bool
- directoryListNew :: (HasCallStack, MonadIO m, IsFile a) => Maybe Text -> Maybe a -> m DirectoryList
- directoryListSetAttributes :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> Maybe Text -> m ()
- directoryListSetFile :: (HasCallStack, MonadIO m, IsDirectoryList a, IsFile b) => a -> Maybe b -> m ()
- directoryListSetIoPriority :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> Int32 -> m ()
- directoryListSetMonitored :: (HasCallStack, MonadIO m, IsDirectoryList a) => a -> Bool -> m ()
- clearDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> m ()
- constructDirectoryListAttributes :: (IsDirectoryList o, MonadIO m) => Text -> m (GValueConstruct o)
- getDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe Text)
- setDirectoryListAttributes :: (MonadIO m, IsDirectoryList o) => o -> Text -> m ()
- getDirectoryListError :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe GError)
- clearDirectoryListFile :: (MonadIO m, IsDirectoryList o) => o -> m ()
- constructDirectoryListFile :: (IsDirectoryList o, MonadIO m, IsFile a) => a -> m (GValueConstruct o)
- getDirectoryListFile :: (MonadIO m, IsDirectoryList o) => o -> m (Maybe File)
- setDirectoryListFile :: (MonadIO m, IsDirectoryList o, IsFile a) => o -> a -> m ()
- constructDirectoryListIoPriority :: (IsDirectoryList o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getDirectoryListIoPriority :: (MonadIO m, IsDirectoryList o) => o -> m Int32
- setDirectoryListIoPriority :: (MonadIO m, IsDirectoryList o) => o -> Int32 -> m ()
- getDirectoryListItemType :: (MonadIO m, IsDirectoryList o) => o -> m GType
- getDirectoryListLoading :: (MonadIO m, IsDirectoryList o) => o -> m Bool
- constructDirectoryListMonitored :: (IsDirectoryList o, MonadIO m) => Bool -> m (GValueConstruct o)
- getDirectoryListMonitored :: (MonadIO m, IsDirectoryList o) => o -> m Bool
- setDirectoryListMonitored :: (MonadIO m, IsDirectoryList o) => o -> Bool -> m ()
- getDirectoryListNItems :: (MonadIO m, IsDirectoryList o) => o -> m Word32
Exported types
newtype DirectoryList Source #
Memory-managed wrapper type.
DirectoryList (ManagedPtr DirectoryList) |
Instances
Eq DirectoryList Source # | |
Defined in GI.Gtk.Objects.DirectoryList (==) :: DirectoryList -> DirectoryList -> Bool # (/=) :: DirectoryList -> DirectoryList -> Bool # | |
GObject DirectoryList Source # | |
Defined in GI.Gtk.Objects.DirectoryList | |
ManagedPtrNewtype DirectoryList Source # | |
Defined in GI.Gtk.Objects.DirectoryList toManagedPtr :: DirectoryList -> ManagedPtr DirectoryList | |
TypedObject DirectoryList Source # | |
Defined in GI.Gtk.Objects.DirectoryList | |
HasParentTypes DirectoryList Source # | |
Defined in GI.Gtk.Objects.DirectoryList | |
IsGValue (Maybe DirectoryList) Source # | Convert |
Defined in GI.Gtk.Objects.DirectoryList gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe DirectoryList -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe DirectoryList) | |
type ParentTypes DirectoryList Source # | |
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
(GObject o, IsDescendantOf DirectoryList o) => IsDirectoryList o Source # | |
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
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, isLoading, itemsChanged, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAttributes, getData, getError, getFile, getIoPriority, getItem, getItemType, getMonitored, getNItems, getProperty, getQdata.
Setters
setAttributes, setData, setDataFull, setFile, setIoPriority, setMonitored, setProperty.
getAttributes
directoryListGetAttributes Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m (Maybe Text) | Returns: The queried attributes |
Gets the attributes queried on the children.
getError
directoryListGetError Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m (Maybe GError) | Returns: The loading error or |
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
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m (Maybe File) | Returns: The file whose children are enumerated |
Gets the file whose children are currently enumerated.
getIoPriority
directoryListGetIoPriority Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m Int32 | Returns: The IO priority. |
Gets the IO priority set via directoryListSetIoPriority
.
getMonitored
directoryListGetMonitored Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m Bool | Returns: |
Returns whether the directory list is monitoring the directory for changes.
isLoading
directoryListIsLoading Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsFile a) | |
=> Maybe Text |
|
-> Maybe a |
|
-> m DirectoryList | Returns: a new |
Creates a new GtkDirectoryList
.
The GtkDirectoryList
is querying the given file
with the given attributes
.
setAttributes
directoryListSetAttributes Source #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> Maybe Text |
|
-> m () |
Sets the attributes
to be enumerated and starts the enumeration.
If attributes
is Nothing
, no attributes will be queried, but a list
of GFileInfo
s will still be created.
setFile
:: (HasCallStack, MonadIO m, IsDirectoryList a, IsFile b) | |
=> a |
|
-> Maybe b |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> Int32 |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsDirectoryList a) | |
=> a |
|
-> Bool |
|
-> 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