Maintainer | gtk2hs-devel@lists.sourceforge.net |
---|---|
Stability | alpha |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
- newtype FileEnumerator = FileEnumerator (ForeignPtr FileEnumerator)
- class GObjectClass o => FileEnumeratorClass o
- fileEnumeratorNextFile :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO (Maybe FileInfo)
- fileEnumeratorClose :: FileEnumeratorClass enumerator => enumerator -> Maybe Cancellable -> IO ()
- fileEnumeratorNextFilesAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- fileEnumeratorNextFilesFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO [FileInfo]
- fileEnumeratorCloseAsync :: FileEnumeratorClass enumerator => enumerator -> Int -> Maybe Cancellable -> AsyncReadyCallback -> IO ()
- fileEnumeratorCloseFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO ()
- fileEnumeratorIsClosed :: FileEnumeratorClass enumerator => enumerator -> IO Bool
- fileEnumeratorHasPending :: FileEnumeratorClass enumerator => enumerator -> IO Bool
- fileEnumeratorSetPending :: FileEnumeratorClass enumerator => enumerator -> Bool -> IO ()
- fileEnumeratorGetContainer :: FileEnumeratorClass enumerator => enumerator -> IO File
Details
FileEnumerator
allows you to operate on a set of File
s, returning a FileInfo
structure for each
file enumerated (e.g. fileEnumerateChildren
will return a FileEnumerator
for each of the
children within a directory).
To get the next file's information from a FileEnumerator
, use fileEnumeratorNextFile
or its
asynchronous version, fileEnumeratorNextFilesAsync
. Note that the asynchronous version will
return a list of FileInfo
, whereas the synchronous will only return the next file in the
enumerator.
To close a FileEnumerator
, use fileEnumeratorClose
, or its asynchronous version,
fileEnumeratorCloseAsync
.
- Types
newtype FileEnumerator Source
Methods
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> Maybe Cancellable |
|
-> IO (Maybe FileInfo) | returns A |
Returns information for the next file in the enumerated object. Will block until the information is
available. The FileInfo
returned from this function will contain attributes that match the
attribute string that was passed when the FileEnumerator
was created.
On error, a GError
is thrown. If the enumerator is at the end, Nothing
will be
returned.
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> Maybe Cancellable |
|
-> IO () |
Releases all resources used by this enumerator, making the enumerator return GIoErrorClosed on all calls.
This will be automatically called when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.
Throws a GError
if an error occurs.
fileEnumeratorNextFilesAsync Source
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> Int |
|
-> Int |
|
-> Maybe Cancellable |
|
-> AsyncReadyCallback |
|
-> IO () |
Request information for a number of files from the enumerator asynchronously. When all i/o for the operation is finished the callback will be called with the requested information.
The callback can be called with less than numFiles
files in case of error or at the end of the
enumerator. In case of a partial error the callback will be called with any succeeding items and no
error, and on the next request the error will be reported. If a request is cancelled the callback
will be called with IoErrorCancelled
.
During an async request no other sync and async calls are allowed, and will result in
IoErrorPending
errors.
Any outstanding i/o request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority. Default priority is GPriorityDefault.
fileEnumeratorNextFilesFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO [FileInfo] Source
Finishes the asynchronous operation started with fileEnumeratorNextFilesAsync
.
fileEnumeratorCloseAsync Source
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> Int |
|
-> Maybe Cancellable |
|
-> AsyncReadyCallback |
|
-> IO () |
Asynchronously closes the file enumerator.
If cancellable is not Nothing
, then the operation can be cancelled by triggering the cancellable object
from another thread. If the operation was cancelled, the error IoErrorCancelled
will be returned
in fileEnumeratorCloseFinish
.
fileEnumeratorCloseFinish :: FileEnumeratorClass enumerator => enumerator -> AsyncResult -> IO () Source
Finishes closing a file enumerator, started from fileEnumeratorCloseAsync
.
If the file enumerator was already closed when fileEnumeratorCloseAsync
was called, then this
function will report GIoErrorClosed in error, and return False
. If the file enumerator had
pending operation when the close operation was started, then this function will report
IoErrorPending
, and return False
. If cancellable was not Nothing
, then the operation may have been
cancelled by triggering the cancellable object from another thread. If the operation was cancelled,
the GError
IoErrorCancelled
will be thrown.
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> IO Bool | returns |
Checks if the file enumerator has been closed.
fileEnumeratorHasPending Source
:: FileEnumeratorClass enumerator | |
=> enumerator | |
-> IO Bool | returns |
Checks if the file enumerator has pending operations.
fileEnumeratorSetPending :: FileEnumeratorClass enumerator => enumerator -> Bool -> IO () Source
Sets the file enumerator as having pending operations.
fileEnumeratorGetContainer :: FileEnumeratorClass enumerator => enumerator -> IO File Source
Get the File
container which is being enumerated.