gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Objects.FileMonitor

Description

Monitors a file or directory for changes.

To obtain a GFileMonitor 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 (see mainContextPushThreadDefault) 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

Exported types

newtype FileMonitor Source #

Memory-managed wrapper type.

Instances

Instances details
Eq FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

GObject FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

ManagedPtrNewtype FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

TypedObject FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

Methods

glibType :: IO GType #

HasParentTypes FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

HasAttributeList FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

(info ~ ResolveFileMonitorMethod t FileMonitor, OverloadedMethod info FileMonitor p, HasField t FileMonitor p) => HasField (t :: Symbol) FileMonitor (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

Methods

getField :: FileMonitor -> p #

(info ~ ResolveFileMonitorMethod t FileMonitor, OverloadedMethodInfo info FileMonitor) => IsLabel t (MethodProxy info FileMonitor) Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

(info ~ ResolveFileMonitorMethod t FileMonitor, OverloadedMethod info FileMonitor p) => IsLabel t (FileMonitor -> p) Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

Methods

fromLabel :: FileMonitor -> p #

IsGValue (Maybe FileMonitor) Source #

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

Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttributeList FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type ParentTypes FileMonitor Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type SignalList FileMonitor Source # 
Instance details

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

Instances details
(GObject o, IsDescendantOf FileMonitor o) => IsFileMonitor o Source # 
Instance details

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.

Methods

type family ResolveFileMonitorMethod (t :: Symbol) o where ... Source #

Equations

ResolveFileMonitorMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveFileMonitorMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveFileMonitorMethod "cancel" o = FileMonitorCancelMethodInfo 
ResolveFileMonitorMethod "emitEvent" o = FileMonitorEmitEventMethodInfo 
ResolveFileMonitorMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveFileMonitorMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveFileMonitorMethod "getv" o = ObjectGetvMethodInfo 
ResolveFileMonitorMethod "isCancelled" o = FileMonitorIsCancelledMethodInfo 
ResolveFileMonitorMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveFileMonitorMethod "notify" o = ObjectNotifyMethodInfo 
ResolveFileMonitorMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveFileMonitorMethod "ref" o = ObjectRefMethodInfo 
ResolveFileMonitorMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveFileMonitorMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveFileMonitorMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveFileMonitorMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveFileMonitorMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveFileMonitorMethod "unref" o = ObjectUnrefMethodInfo 
ResolveFileMonitorMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveFileMonitorMethod "getData" o = ObjectGetDataMethodInfo 
ResolveFileMonitorMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveFileMonitorMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveFileMonitorMethod "setData" o = ObjectSetDataMethodInfo 
ResolveFileMonitorMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveFileMonitorMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveFileMonitorMethod "setRateLimit" o = FileMonitorSetRateLimitMethodInfo 
ResolveFileMonitorMethod l o = MethodResolutionFailed l o :: Type 

cancel

data FileMonitorCancelMethodInfo Source #

Instances

Instances details
(signature ~ m Bool, MonadIO m, IsFileMonitor a) => OverloadedMethod FileMonitorCancelMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo FileMonitorCancelMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

fileMonitorCancel Source #

Arguments

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

monitor: a FileMonitor.

-> m Bool

Returns: always True

Cancels a file monitor.

emitEvent

data FileMonitorEmitEventMethodInfo Source #

Instances

Instances details
(signature ~ (b -> c -> FileMonitorEvent -> m ()), MonadIO m, IsFileMonitor a, IsFile b, IsFile c) => OverloadedMethod FileMonitorEmitEventMethodInfo a signature Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

Methods

overloadedMethod :: a -> signature #

OverloadedMethodInfo FileMonitorEmitEventMethodInfo (a :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

fileMonitorEmitEvent Source #

Arguments

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

monitor: a FileMonitor.

-> b

child: a File.

-> c

otherFile: a File.

-> FileMonitorEvent

eventType: a set of FileMonitorEvent flags.

-> 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 (see mainContextPushThreadDefault) of the thread that the monitor was created in.

isCancelled

fileMonitorIsCancelled Source #

Arguments

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

monitor: a FileMonitor

-> m Bool

Returns: True if monitor is canceled. False otherwise.

Returns whether the monitor is canceled.

setRateLimit

fileMonitorSetRateLimit Source #

Arguments

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

monitor: a FileMonitor.

-> Int32

limitMsecs: a non-negative integer with the limit in milliseconds to poll for changes

-> m () 

Sets the rate limit to which the monitor will report consecutive change events to the same file.

Properties

cancelled

Whether the monitor has been cancelled.

data FileMonitorCancelledPropertyInfo Source #

Instances

Instances details
AttrInfo FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrAllowedOps FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrBaseTypeConstraint FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrGetType FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrLabel FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrOrigin FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrSetTypeConstraint FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrTransferType FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrTransferTypeConstraint FileMonitorCancelledPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

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

The limit of the monitor to watch for changes, in milliseconds.

data FileMonitorRateLimitPropertyInfo Source #

Instances

Instances details
AttrInfo FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrAllowedOps FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrBaseTypeConstraint FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrGetType FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrLabel FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrOrigin FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrSetTypeConstraint FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrTransferType FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

type AttrTransferTypeConstraint FileMonitorRateLimitPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.FileMonitor

constructFileMonitorRateLimit :: (IsFileMonitor o, MonadIO m) => Int32 -> m (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

set fileMonitor [ #rateLimit := value ]

Signals

changed

type FileMonitorChangedCallback Source #

Arguments

 = File

file: a File.

-> Maybe File

otherFile: a File or NULL.

-> FileMonitorEvent

eventType: a 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 FileMonitorEventMoved, 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 -> ((?self :: 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

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onFileMonitorChanged :: (IsFileMonitor a, MonadIO m) => a -> ((?self :: 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