| Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.FileMonitor
Description
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 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).
Synopsis
- newtype FileMonitor = FileMonitor (ManagedPtr FileMonitor)
- class (GObject o, IsDescendantOf FileMonitor 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 :: MonadIO m => FileMonitorChangedCallback -> m (GClosure C_FileMonitorChangedCallback)
- mk_FileMonitorChangedCallback :: C_FileMonitorChangedCallback -> IO (FunPtr C_FileMonitorChangedCallback)
- noFileMonitorChangedCallback :: Maybe FileMonitorChangedCallback
- onFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId
- wrap_FileMonitorChangedCallback :: FileMonitorChangedCallback -> C_FileMonitorChangedCallback
Exported types
newtype FileMonitor Source #
Memory-managed wrapper type.
Constructors
| FileMonitor (ManagedPtr FileMonitor) |
Instances
| Eq FileMonitor Source # | |
Defined in GI.Gio.Objects.FileMonitor | |
| GObject FileMonitor Source # | |
Defined in GI.Gio.Objects.FileMonitor Methods gobjectType :: IO GType # | |
| IsGValue FileMonitor Source # | Convert |
Defined in GI.Gio.Objects.FileMonitor | |
| HasParentTypes FileMonitor Source # | |
Defined in GI.Gio.Objects.FileMonitor | |
| type ParentTypes FileMonitor Source # | |
Defined in GI.Gio.Objects.FileMonitor | |
class (GObject o, IsDescendantOf FileMonitor o) => IsFileMonitor o Source #
Type class for types which can be safely cast to FileMonitor, for instance with toFileMonitor.
Instances
| (GObject o, IsDescendantOf FileMonitor o) => IsFileMonitor o Source # | |
Defined in GI.Gio.Objects.FileMonitor | |
toFileMonitor :: (MonadIO m, IsFileMonitor o) => o -> m FileMonitor Source #
Cast to FileMonitor, for types for which this is known to be safe. For general casts, use castTo.
noFileMonitor :: Maybe FileMonitor Source #
A convenience alias for Nothing :: Maybe FileMonitor.
Methods
Overloaded methods
cancel
Arguments
| :: (HasCallStack, MonadIO m, IsFileMonitor a) | |
| => a |
|
| -> m Bool | Returns: always |
Cancels a file monitor.
emitEvent
Arguments
| :: (HasCallStack, MonadIO m, IsFileMonitor a, IsFile b, IsFile c) | |
| => a |
|
| -> b |
|
| -> c |
|
| -> FileMonitorEvent |
|
| -> m () |
Emits the 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 #
Arguments
| :: (HasCallStack, MonadIO m, IsFileMonitor a) | |
| => a |
|
| -> m Bool |
Returns whether the monitor is canceled.
setRateLimit
fileMonitorSetRateLimit Source #
Arguments
| :: (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
No description available in the introspection data.
getFileMonitorCancelled :: (MonadIO m, IsFileMonitor o) => o -> m Bool Source #
Get the value of the “cancelled” property.
When overloading is enabled, this is equivalent to
get fileMonitor #cancelled
rateLimit
No description available in the introspection data.
constructFileMonitorRateLimit :: IsFileMonitor o => Int32 -> IO (GValueConstruct o) Source #
Construct a GValueConstruct with valid value for the “rate-limit” property. This is rarely needed directly, but it is used by new.
getFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> m Int32 Source #
Get the value of the “rate-limit” property.
When overloading is enabled, this is equivalent to
get fileMonitor #rateLimit
setFileMonitorRateLimit :: (MonadIO m, IsFileMonitor o) => o -> Int32 -> m () Source #
Set the value of the “rate-limit” property.
When overloading is enabled, this is equivalent to
setfileMonitor [ #rateLimit:=value ]
Signals
changed
type C_FileMonitorChangedCallback = Ptr () -> Ptr File -> Ptr File -> CUInt -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type FileMonitorChangedCallback Source #
Arguments
| = File |
|
| -> Maybe File |
|
| -> FileMonitorEvent |
|
| -> IO () |
Emitted when file has been changed.
If using FileMonitorFlagsWatchMoves on a directory monitor, and
the information is available (and if supported by the backend),
eventType may be FileMonitorEventRenamed,
FileMonitorEventMovedIn or FileMonitorEventMovedOut.
In all cases file will be a child of the monitored directory. For
renames, file will be the old name and otherFile is the new
name. For "moved in" events, file is the name of the file that
appeared and otherFile is the old name that it was moved from (in
another directory). For "moved out" events, file is the name of
the file that used to be in this directory and otherFile is the
name of the file at its new location.
It makes sense to treat FileMonitorEventMovedIn as
equivalent to FileMonitorEventCreated and
FileMonitorEventMovedOut as equivalent to
FileMonitorEventDeleted, with extra information.
FileMonitorEventRenamed is equivalent to a delete/create
pair. This is exactly how the events will be reported in the case
that the FileMonitorFlagsWatchMoves flag is not in use.
If using the deprecated flag FileMonitorFlagsSendMoved flag and eventType is
G_FILE_MONITOR_EVENT_MOVED, file will be set to a File containing the
old path, and otherFile will be set to a File containing the new path.
In all the other cases, otherFile will be set to NULL.
afterFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after fileMonitor #changed callback
genClosure_FileMonitorChanged :: MonadIO m => FileMonitorChangedCallback -> m (GClosure C_FileMonitorChangedCallback) Source #
Wrap the callback into a GClosure.
mk_FileMonitorChangedCallback :: C_FileMonitorChangedCallback -> IO (FunPtr C_FileMonitorChangedCallback) Source #
Generate a function pointer callable from C code, from a C_FileMonitorChangedCallback.
noFileMonitorChangedCallback :: Maybe FileMonitorChangedCallback Source #
A convenience synonym for .Nothing :: Maybe FileMonitorChangedCallback
onFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> FileMonitorChangedCallback -> m SignalHandlerId Source #
Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on fileMonitor #changed callback