Gio.FileMonitor¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when file has been changed. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.FileMonitor(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
Monitors a file or directory for changes.
To obtain a
GFileMonitor
for a file or directory, use [method`Gio`.File.monitor], [method`Gio`.File.monitor_file], or [method`Gio`.File.monitor_directory].To get informed about changes to the file or directory you are monitoring, connect to the [signal`Gio`.FileMonitor::changed] signal. The signal will be emitted in the thread-default main context (see [method`GLib`.MainContext.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).
- emit_event(child, other_file, event_type)[source]¶
- Parameters:
event_type (
Gio.FileMonitorEvent
) – a set ofGio.FileMonitorEvent
flags.
Emits the
Gio.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
of the thread that the monitor was created in.
- set_rate_limit(limit_msecs)[source]¶
- Parameters:
limit_msecs (
int
) – a non-negative integer with the limit in milliseconds to poll for changes
Sets the rate limit to which the self will report consecutive change events to the same file.
- do_changed(file, other_file, event_type) virtual¶
- Parameters:
file (
Gio.File
) –other_file (
Gio.File
) –event_type (
Gio.FileMonitorEvent
) –
Signal Details¶
- Gio.FileMonitor.signals.changed(file_monitor, file, other_file, event_type)¶
- Signal Name:
changed
- Flags:
- Parameters:
file_monitor (
Gio.FileMonitor
) – The object which received the signalevent_type (
Gio.FileMonitorEvent
) – aGio.FileMonitorEvent
.
Emitted when file has been changed.
If using
Gio.FileMonitorFlags.WATCH_MOVES
on a directory monitor, and the information is available (and if supported by the backend), event_type may beGio.FileMonitorEvent.RENAMED
,Gio.FileMonitorEvent.MOVED_IN
orGio.FileMonitorEvent.MOVED_OUT
.In all cases file will be a child of the monitored directory. For renames, file will be the old name and other_file is the new name. For “moved in” events, file is the name of the file that appeared and other_file 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 other_file is the name of the file at its new location.
It makes sense to treat
Gio.FileMonitorEvent.MOVED_IN
as equivalent toGio.FileMonitorEvent.CREATED
andGio.FileMonitorEvent.MOVED_OUT
as equivalent toGio.FileMonitorEvent.DELETED
, with extra information.Gio.FileMonitorEvent.RENAMED
is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that theGio.FileMonitorFlags.WATCH_MOVES
flag is not in use.If using the deprecated flag
Gio.FileMonitorFlags.SEND_MOVED
flag and event_type isGio.FileMonitorEvent.MOVED
, file will be set to aGio.File
containing the old path, and other_file will be set to aGio.File
containing the new path.In all the other cases, other_file will be set to
None
.
Property Details¶
- Gio.FileMonitor.props.cancelled¶
-
Whether the monitor has been cancelled.
- Gio.FileMonitor.props.rate_limit¶
- Name:
rate-limit
- Type:
- Default Value:
800
- Flags:
The limit of the monitor to watch for changes, in milliseconds.