Monitors a file or directory for changes.
To obtain a Glib.File_Monitors.Gfile_Monitor for a file or directory, use Glib.GFile.Monitor, Glib.GFile.Monitor_File, or Glib.GFile.Monitor_Directory.
To get informed about changes to the file or directory you are monitoring, connect to the Glib.File_Monitors.Gfile_Monitor::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).
function Cancel
(Self : not null access Gfile_Monitor_Record) return Boolean
Cancels a file monitor.
always True
Cancelled_Property : constant Glib.Properties.Property_Boolean;
type Cb_Gfile_Monitor_Gfile_Gfile_Or_Null_GFile_Monitor_Event_Void is not null access procedure
(Self : access Gfile_Monitor_Record'Class;
File : Glib.GFile.Gfile;
Other_File : Glib.GFile.Gfile;
Event_Type : Glib.GEnums.GFile_Monitor_Event);
type Cb_GObject_Gfile_Gfile_Or_Null_GFile_Monitor_Event_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
File : Glib.GFile.Gfile;
Other_File : Glib.GFile.Gfile;
Event_Type : Glib.GEnums.GFile_Monitor_Event);
procedure Emit_Event
(Self : not null access Gfile_Monitor_Record;
Child : Glib.GFile.Gfile;
Other_File : Glib.GFile.Gfile;
Event_Type : Glib.GEnums.GFile_Monitor_Event)
Emits the Glib.File_Monitors.Gfile_Monitor::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.
a Glib.GFile.Gfile.
a Glib.GFile.Gfile.
a set of Glib.GEnums.GFile_Monitor_Event flags.
function Get_Type return Glib.GType
type Gfile_Monitor is access all Gfile_Monitor_Record'Class;
type Gfile_Monitor_Record is new GObject_Record with null record;
function Is_Cancelled
(Self : not null access Gfile_Monitor_Record) return Boolean
Returns whether the monitor is canceled.
True if monitor is canceled. False otherwise.
procedure On_Changed
(Self : not null access Gfile_Monitor_Record;
Call : Cb_Gfile_Monitor_Gfile_Gfile_Or_Null_GFile_Monitor_Event_Void;
After : Boolean := False)
Emitted when File has been changed.
If using Glib.GEnums.G_File_Monitor_Watch_Moves on a directory monitor, and the information is available (and if supported by the backend), Event_Type may be Glib.GEnums.Renamed, Glib.GEnums.Moved_In or Glib.GEnums.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 Glib.GEnums.Moved_In as equivalent to Glib.GEnums.Created and Glib.GEnums.Moved_Out as equivalent to Glib.GEnums.Deleted, with extra information. Glib.GEnums.Renamed is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the Glib.GEnums.G_File_Monitor_Watch_Moves flag is not in use.
If using the deprecated flag Glib.GEnums.G_File_Monitor_Send_Moved flag and Event_Type is Glib.GEnums.Moved, File will be set to a Glib.GFile.Gfile containing the old path, and Other_File will be set to a Glib.GFile.Gfile containing the new path.
In all the other cases, Other_File will be set to NULL.
Callback parameters: -- @param File a Glib.GFile.Gfile. -- @param Other_File a Glib.GFile.Gfile or NULL. -- @param Event_Type a Glib.GEnums.GFile_Monitor_Event.
procedure On_Changed
(Self : not null access Gfile_Monitor_Record;
Call : Cb_GObject_Gfile_Gfile_Or_Null_GFile_Monitor_Event_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when File has been changed.
If using Glib.GEnums.G_File_Monitor_Watch_Moves on a directory monitor, and the information is available (and if supported by the backend), Event_Type may be Glib.GEnums.Renamed, Glib.GEnums.Moved_In or Glib.GEnums.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 Glib.GEnums.Moved_In as equivalent to Glib.GEnums.Created and Glib.GEnums.Moved_Out as equivalent to Glib.GEnums.Deleted, with extra information. Glib.GEnums.Renamed is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the Glib.GEnums.G_File_Monitor_Watch_Moves flag is not in use.
If using the deprecated flag Glib.GEnums.G_File_Monitor_Send_Moved flag and Event_Type is Glib.GEnums.Moved, File will be set to a Glib.GFile.Gfile containing the old path, and Other_File will be set to a Glib.GFile.Gfile containing the new path.
In all the other cases, Other_File will be set to NULL.
Callback parameters: -- @param File a Glib.GFile.Gfile. -- @param Other_File a Glib.GFile.Gfile or NULL. -- @param Event_Type a Glib.GEnums.GFile_Monitor_Event.
Rate_Limit_Property : constant Glib.Properties.Property_Int;
procedure Set_Rate_Limit
(Self : not null access Gfile_Monitor_Record;
Limit_Msecs : Glib.Gint)
Sets the rate limit to which the Monitor will report consecutive change events to the same file.
a non-negative integer with the limit in milliseconds to poll for changes
Signal_Changed : constant Glib.Signal_Name := "changed";
Emitted when File has been changed.
If using Glib.GEnums.G_File_Monitor_Watch_Moves on a directory monitor, and the information is available (and if supported by the backend), Event_Type may be Glib.GEnums.Renamed, Glib.GEnums.Moved_In or Glib.GEnums.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 Glib.GEnums.Moved_In as equivalent to Glib.GEnums.Created and Glib.GEnums.Moved_Out as equivalent to Glib.GEnums.Deleted, with extra information. Glib.GEnums.Renamed is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that the Glib.GEnums.G_File_Monitor_Watch_Moves flag is not in use.
If using the deprecated flag Glib.GEnums.G_File_Monitor_Send_Moved flag and Event_Type is Glib.GEnums.Moved, File will be set to a Glib.GFile.Gfile containing the old path, and Other_File will be set to a Glib.GFile.Gfile containing the new path.
In all the other cases, Other_File will be set to NULL.
Callback parameters: -- @param File a Glib.GFile.Gfile. -- @param Other_File a Glib.GFile.Gfile or NULL. -- @param Event_Type a Glib.GEnums.GFile_Monitor_Event.