|  |  |  | GIO Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Properties | Signals | ||||
#include <gio/gio.h> enum GFileMonitorEvent; GFileMonitor; gboolean g_file_monitor_cancel (GFileMonitor *monitor); gboolean g_file_monitor_is_cancelled (GFileMonitor *monitor); void g_file_monitor_set_rate_limit (GFileMonitor *monitor,gint limit_msecs); void g_file_monitor_emit_event (GFileMonitor *monitor,GFile *child,GFile *other_file,GFileMonitorEvent event_type);
Monitors a file or directory for changes.
To obtain a GFileMonitor for a file or directory, use
g_file_monitor(), g_file_monitor_file(), or
g_file_monitor_directory().
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 
typedef enum {
  G_FILE_MONITOR_EVENT_CHANGED,
  G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT,
  G_FILE_MONITOR_EVENT_DELETED,
  G_FILE_MONITOR_EVENT_CREATED,
  G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED,
  G_FILE_MONITOR_EVENT_PRE_UNMOUNT,
  G_FILE_MONITOR_EVENT_UNMOUNTED,
  G_FILE_MONITOR_EVENT_MOVED
} GFileMonitorEvent;
Specifies what type of event a monitor event is.
| a file changed. | |
| a hint that this was probably the last change in a set of changes. | |
| a file was deleted. | |
| a file was created. | |
| a file attribute was changed. | |
| the file location will soon be unmounted. | |
| the file location was unmounted. | |
| the file was moved. | 
gboolean            g_file_monitor_cancel               (GFileMonitor *monitor);
Cancels a file monitor.
| 
 | a GFileMonitor. | 
| Returns : | TRUEif monitor was cancelled. | 
gboolean            g_file_monitor_is_cancelled         (GFileMonitor *monitor);
Returns whether the monitor is canceled.
| 
 | a GFileMonitor | 
| Returns : | TRUEif monitor is canceled.FALSEotherwise. | 
void g_file_monitor_set_rate_limit (GFileMonitor *monitor,gint limit_msecs);
Sets the rate limit to which the monitor will report
consecutive change events to the same file.
| 
 | a GFileMonitor. | 
| 
 | a non-negative integer with the limit in milliseconds to poll for changes | 
void g_file_monitor_emit_event (GFileMonitor *monitor,GFile *child,GFile *other_file,GFileMonitorEvent event_type);
Emits the "changed" signal if a change has taken place. Should be called from file monitor implementations only.
The signal will be emitted from an idle handler (in the 
| 
 | a GFileMonitor. | 
| 
 | a GFile. | 
| 
 | a GFile. | 
| 
 | a set of GFileMonitorEvent flags. | 
"cancelled" property"cancelled" gboolean : Read
Whether the monitor has been cancelled.
Default value: FALSE
"rate-limit" property"rate-limit" gint : Read / Write
The limit of the monitor to watch for changes, in milliseconds.
Allowed values: >= 0
Default value: 800
"changed" signalvoid                user_function                      (GFileMonitor     *monitor,
                                                        GFile            *file,
                                                        GFile            *other_file,
                                                        GFileMonitorEvent event_type,
                                                        gpointer          user_data)       : Run Last
Emitted when file has been changed.
If using G_FILE_MONITOR_SEND_MOVED flag and event_type is
G_FILE_MONITOR_SEND_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.
| 
 | a GFileMonitor. | 
| 
 | a GFile. | 
| 
 | a GFile or NULL. | 
| 
 | a GFileMonitorEvent. | 
| 
 | user data set when the signal handler was connected. |