Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
Monitors a file or directory for changes.
To obtain a FileMonitor
for a file or directory, use
fileMonitor
, fileMonitorFile
, or
fileMonitorDirectory
.
To get informed about changes to the file or directory you are
monitoring, connect to the FileMonitor
::changed
signal. The
signal will be emitted in the
[thread-default main context][g-main-context-push-thread-default]
of the thread that the monitor was created in
(though if the global default main context is blocked, this may
cause notifications to be blocked even if the thread-default
context is still running).
- newtype FileMonitor = FileMonitor (ManagedPtr FileMonitor)
- class GObject o => IsFileMonitor o
- toFileMonitor :: (MonadIO m, IsFileMonitor o) => o -> m FileMonitor
- noFileMonitor :: Maybe FileMonitor
- fileMonitorCancel :: (HasCallStack, MonadIO m, IsFileMonitor a) => a -> m Bool
- fileMonitorEmitEvent :: (HasCallStack, MonadIO m, IsFileMonitor a, IsFile b, IsFile c) => a -> b -> c -> FileMonitorEvent -> m ()
- fileMonitorIsCancelled :: (HasCallStack, MonadIO m, IsFileMonitor a) => a -> m Bool
- fileMonitorSetRateLimit :: (HasCallStack, MonadIO m, IsFileMonitor a) => a -> Int32 -> m ()
- getFileMonitorCancelled :: (MonadIO m, IsFileMonitor o) => o -> m Bool
- constructFileMonitorRateLimit :: IsFileMonitor o => Int32 -> IO (GValueConstruct o)
- getFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> m Int32
- setFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> Int32 -> m ()
- type C_FileMonitorChangedCallback = Ptr () -> Ptr File -> Ptr File -> CUInt -> Ptr () -> IO ()
- type FileMonitorChangedCallback = File -> Maybe File -> FileMonitorEvent -> IO ()
- afterFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId
- genClosure_FileMonitorChanged :: FileMonitorChangedCallback -> IO Closure
- mk_FileMonitorChangedCallback :: C_FileMonitorChangedCallback -> IO (FunPtr C_FileMonitorChangedCallback)
- noFileMonitorChangedCallback :: Maybe FileMonitorChangedCallback
- onFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId
- wrap_FileMonitorChangedCallback :: FileMonitorChangedCallback -> Ptr () -> Ptr File -> Ptr File -> CUInt -> Ptr () -> IO ()
Exported types
newtype FileMonitor Source #
class GObject o => IsFileMonitor o Source #
toFileMonitor :: (MonadIO m, IsFileMonitor o) => o -> m FileMonitor Source #
Methods
cancel
:: (HasCallStack, MonadIO m, IsFileMonitor a) | |
=> a |
|
-> m Bool | Returns: always |
Cancels a file monitor.
emitEvent
:: (HasCallStack, MonadIO m, IsFileMonitor a, IsFile b, IsFile c) | |
=> a |
|
-> b |
|
-> c |
|
-> FileMonitorEvent |
|
-> m () |
Emits the FileMonitor
::changed
signal if a change
has taken place. Should be called from file monitor
implementations only.
Implementations are responsible to call this method from the [thread-default main context][g-main-context-push-thread-default] of the thread that the monitor was created in.
isCancelled
fileMonitorIsCancelled Source #
:: (HasCallStack, MonadIO m, IsFileMonitor a) | |
=> a |
|
-> m Bool |
Returns whether the monitor is canceled.
setRateLimit
fileMonitorSetRateLimit Source #
:: (HasCallStack, MonadIO m, IsFileMonitor a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sets the rate limit to which the monitor
will report
consecutive change events to the same file.
Properties
cancelled
getFileMonitorCancelled :: (MonadIO m, IsFileMonitor o) => o -> m Bool Source #
rateLimit
constructFileMonitorRateLimit :: IsFileMonitor o => Int32 -> IO (GValueConstruct o) Source #
getFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> m Int32 Source #
setFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> Int32 -> m () Source #
Signals
changed
type C_FileMonitorChangedCallback = Ptr () -> Ptr File -> Ptr File -> CUInt -> Ptr () -> IO () Source #
type FileMonitorChangedCallback = File -> Maybe File -> FileMonitorEvent -> IO () Source #
afterFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId Source #
mk_FileMonitorChangedCallback :: C_FileMonitorChangedCallback -> IO (FunPtr C_FileMonitorChangedCallback) Source #
onFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId Source #