Basics
Guides
API Reference
Basics
Guides
API Reference
[22:7] extends: object
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).
FileMonitor (Handle = null)
Creates a new
FileMonitorby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnChanged (callback Fn, UserData = null)
Emitted when @file has been changed. If using %G_FILE_MONITOR_WATCH_MOVES on a directory monitor, and the information is available (and if supported by the backend), @event_type may be %G_FILE_MONITOR_EVENT_RENAMED, %G_FILE_MONITOR_EVENT_MOVED_IN or %G_FILE_MONITOR_EVENT_MOVED_OUT. In all cases @file will be a child of the monitored directory. For renames, @file will be the old name and
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 %G_FILE_MONITOR_EVENT_MOVED_IN as equivalent to %G_FILE_MONITOR_EVENT_CREATED and %G_FILE_MONITOR_EVENT_MOVED_OUT as equivalent to %G_FILE_MONITOR_EVENT_DELETED, with extra information. %G_FILE_MONITOR_EVENT_RENAMED is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the %G_FILE_MONITOR_WATCH_MOVES flag is not in use. If using the deprecated flag %G_FILE_MONITOR_SEND_MOVED flag and @event_type is %G_FILE_MONITOR_EVENT_MOVED, @file will be set to a #GFile containing the old path, and @other_file will be set to a #GFile containing the new path. In all the other cases, @other_file will be set to #NULL.Fn is the Aussom callback.Fn is called with (FileMonitor Self, File File, File Other_file, string Event_type).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setRatelimit (int Value)
The limit of the monitor to watch for changes, in milliseconds.
Value is the new property value.None.cancel ()
Cancels a file monitor.
emit_event (object child, object other_file, string event_type)
Emits the #GFileMonitor::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 [method@GLib.MainContext.push_thread_default]) of the thread that the monitor was created in.
child is a #GFile..other_file is a #GFile, or %NULL..event_type is a set of #GFileMonitorEvent flags..None.is_cancelled ()
Returns whether the monitor is canceled.
set_rate_limit (int limit_msecs)
Sets the rate limit to which the @monitor will report consecutive change events to the same file.
limit_msecs is a non-negative integer with the limit in milliseconds to poll for changes.None.[330:14] static extends: object
Generated metadata helpers for FileMonitor class surfaces.
properties ()
Returns property metadata for
FileMonitor.
A list.signals ()
Returns signal metadata for
FileMonitor.
A list.[257:7] extends: object
Generated low-level callback wrapper for GIR callback changed.
FileMonitorChangedCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, file, other_file, event_type, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.

Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.