4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GFileMonitor</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
6
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
7
7
<link rel="home" href="index.html" title="GIO Reference Manual">
8
8
<link rel="up" href="file_mon.html" title="File System Monitoring">
9
9
<link rel="prev" href="file_mon.html" title="File System Monitoring">
10
10
<link rel="next" href="async.html" title="Asynchronous I/O">
11
<meta name="generator" content="GTK-Doc V1.13 (XML mode)">
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="part" href="pt01.html" title="Part I. GIO Overview">
14
14
<link rel="chapter" href="ch01.html" title="Introduction">
53
53
<tr><td colspan="5" class="shortcuts">
54
54
<a href="#GFileMonitor.synopsis" class="shortcut">Top</a>
56
<a href="#GFileMonitor.description" class="shortcut">Description</a>
58
<a href="#GFileMonitor.object-hierarchy" class="shortcut">Object Hierarchy</a>
60
<a href="#GFileMonitor.properties" class="shortcut">Properties</a>
62
<a href="#GFileMonitor.signals" class="shortcut">Signals</a>
56
<a href="#GFileMonitor.description" class="shortcut">Description</a>
58
<a href="#GFileMonitor.object-hierarchy" class="shortcut">Object Hierarchy</a>
60
<a href="#GFileMonitor.properties" class="shortcut">Properties</a>
62
<a href="#GFileMonitor.signals" class="shortcut">Signals</a>
65
65
<div class="refentry" title="GFileMonitor">
74
74
<div class="refsynopsisdiv" title="Synopsis">
75
75
<a name="GFileMonitor.synopsis"></a><h2>Synopsis</h2>
76
76
<pre class="synopsis">
77
78
#include <gio/gio.h>
79
80
enum <a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent">GFileMonitorEvent</a>;
80
81
<a class="link" href="GFileMonitor.html#GFileMonitor-struct" title="GFileMonitor">GFileMonitor</a>;
81
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GFileMonitor.html#g-file-monitor-cancel" title="g_file_monitor_cancel ()">g_file_monitor_cancel</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor);
82
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GFileMonitor.html#g-file-monitor-is-cancelled" title="g_file_monitor_is_cancelled ()">g_file_monitor_is_cancelled</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor);
83
<span class="returnvalue">void</span> <a class="link" href="GFileMonitor.html#g-file-monitor-set-rate-limit" title="g_file_monitor_set_rate_limit ()">g_file_monitor_set_rate_limit</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor,
84
<span class="returnvalue">int</span> limit_msecs);
85
<span class="returnvalue">void</span> <a class="link" href="GFileMonitor.html#g-file-monitor-emit-event" title="g_file_monitor_emit_event ()">g_file_monitor_emit_event</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor,
86
<a class="link" href="GFile.html" title="GFile"><span class="returnvalue">GFile</span></a> *child,
87
<a class="link" href="GFile.html" title="GFile"><span class="returnvalue">GFile</span></a> *other_file,
88
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent"><span class="returnvalue">GFileMonitorEvent</span></a> event_type);
83
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
84
>gboolean</a> <a class="link" href="GFileMonitor.html#g-file-monitor-cancel" title="g_file_monitor_cancel ()">g_file_monitor_cancel</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);
86
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
87
>gboolean</a> <a class="link" href="GFileMonitor.html#g-file-monitor-is-cancelled" title="g_file_monitor_is_cancelled ()">g_file_monitor_is_cancelled</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);
88
void <a class="link" href="GFileMonitor.html#g-file-monitor-set-rate-limit" title="g_file_monitor_set_rate_limit ()">g_file_monitor_set_rate_limit</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
90
void <a class="link" href="GFileMonitor.html#g-file-monitor-emit-event" title="g_file_monitor_emit_event ()">g_file_monitor_emit_event</a> (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
91
<a class="link" href="GFile.html" title="GFile">GFile</a> *child,
92
<a class="link" href="GFile.html" title="GFile">GFile</a> *other_file,
93
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent">GFileMonitorEvent</a> event_type);
91
96
<div class="refsect1" title="Object Hierarchy">
92
97
<a name="GFileMonitor.object-hierarchy"></a><h2>Object Hierarchy</h2>
93
98
<pre class="synopsis">
94
<a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
98
103
<div class="refsect1" title="Properties">
99
104
<a name="GFileMonitor.properties"></a><h2>Properties</h2>
100
105
<pre class="synopsis">
101
"<a class="link" href="GFileMonitor.html#GFileMonitor--cancelled" title='The "cancelled" property'>cancelled</a>" <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read
102
"<a class="link" href="GFileMonitor.html#GFileMonitor--rate-limit" title='The "rate-limit" property'>rate-limit</a>" <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> : Read / Write
106
"<a class="link" href="GFileMonitor.html#GFileMonitor--cancelled" title='The "cancelled" property'>cancelled</a>" <a
107
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
109
"<a class="link" href="GFileMonitor.html#GFileMonitor--rate-limit" title='The "rate-limit" property'>rate-limit</a>" <a
110
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
111
>gint</a> : Read / Write
105
114
<div class="refsect1" title="Signals">
122
131
To get informed about changes to the file or directory you are
123
132
monitoring, connect to the <a class="link" href="GFileMonitor.html#GFileMonitor-changed" title='The "changed" signal'><span class="type">"changed"</span></a> signal. The
124
signal will be emitted in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
125
context</GTKDOCLINK> of the thread that the monitor was created in
133
signal will be emitted in the <a
134
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default"
136
context</a> of the thread that the monitor was created in
126
137
(though if the global default main context is blocked, this may
127
138
cause notifications to be blocked even if the thread-default
128
139
context is still running).</p>
130
143
<div class="refsect1" title="Details">
131
144
<a name="GFileMonitor.details"></a><h2>Details</h2>
146
159
Specifies what type of event a monitor event is.</p>
147
162
<div class="variablelist"><table border="0">
148
163
<col align="left" valign="top">
151
<td><p><a name="G-FILE-MONITOR-EVENT-CHANGED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CHANGED</code></span></p></td>
166
<td><p><a name="G-FILE-MONITOR-EVENT-CHANGED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CHANGED</code></span></p></td>
152
167
<td> a file changed.
156
<td><p><a name="G-FILE-MONITOR-EVENT-CHANGES-DONE-HINT:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT</code></span></p></td>
171
<td><p><a name="G-FILE-MONITOR-EVENT-CHANGES-DONE-HINT--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT</code></span></p></td>
157
172
<td> a hint that this was probably the last change in a set of changes.
161
<td><p><a name="G-FILE-MONITOR-EVENT-DELETED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_DELETED</code></span></p></td>
176
<td><p><a name="G-FILE-MONITOR-EVENT-DELETED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_DELETED</code></span></p></td>
162
177
<td> a file was deleted.
166
<td><p><a name="G-FILE-MONITOR-EVENT-CREATED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CREATED</code></span></p></td>
181
<td><p><a name="G-FILE-MONITOR-EVENT-CREATED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_CREATED</code></span></p></td>
167
182
<td> a file was created.
171
<td><p><a name="G-FILE-MONITOR-EVENT-ATTRIBUTE-CHANGED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED</code></span></p></td>
186
<td><p><a name="G-FILE-MONITOR-EVENT-ATTRIBUTE-CHANGED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED</code></span></p></td>
172
187
<td> a file attribute was changed.
176
<td><p><a name="G-FILE-MONITOR-EVENT-PRE-UNMOUNT:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_PRE_UNMOUNT</code></span></p></td>
191
<td><p><a name="G-FILE-MONITOR-EVENT-PRE-UNMOUNT--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_PRE_UNMOUNT</code></span></p></td>
177
192
<td> the file location will soon be unmounted.
181
<td><p><a name="G-FILE-MONITOR-EVENT-UNMOUNTED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_UNMOUNTED</code></span></p></td>
196
<td><p><a name="G-FILE-MONITOR-EVENT-UNMOUNTED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_UNMOUNTED</code></span></p></td>
182
197
<td> the file location was unmounted.
186
<td><p><a name="G-FILE-MONITOR-EVENT-MOVED:CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_MOVED</code></span></p></td>
201
<td><p><a name="G-FILE-MONITOR-EVENT-MOVED--CAPS"></a><span class="term"><code class="literal">G_FILE_MONITOR_EVENT_MOVED</code></span></p></td>
187
202
<td> the file was moved.
196
211
<pre class="programlisting">typedef struct _GFileMonitor GFileMonitor;</pre>
198
213
Watches for changes to a file.</p>
201
218
<div class="refsect2" title="g_file_monitor_cancel ()">
202
219
<a name="g-file-monitor-cancel"></a><h3>g_file_monitor_cancel ()</h3>
203
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_file_monitor_cancel (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor);</pre>
220
<pre class="programlisting"><a
221
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
222
>gboolean</a> g_file_monitor_cancel (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);</pre>
205
224
Cancels a file monitor.</p>
206
227
<div class="variablelist"><table border="0">
207
228
<col align="left" valign="top">
223
246
<div class="refsect2" title="g_file_monitor_is_cancelled ()">
224
247
<a name="g-file-monitor-is-cancelled"></a><h3>g_file_monitor_is_cancelled ()</h3>
225
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> g_file_monitor_is_cancelled (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor);</pre>
248
<pre class="programlisting"><a
249
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
250
>gboolean</a> g_file_monitor_is_cancelled (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor);</pre>
227
252
Returns whether the monitor is canceled.</p>
228
255
<div class="variablelist"><table border="0">
229
256
<col align="left" valign="top">
237
264
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
238
<td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if monitor is canceled. <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.
266
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE--CAPS"
267
><code class="literal">TRUE</code></a> if monitor is canceled. <a
268
href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE--CAPS"
269
><code class="literal">FALSE</code></a> otherwise.
245
276
<div class="refsect2" title="g_file_monitor_set_rate_limit ()">
246
277
<a name="g-file-monitor-set-rate-limit"></a><h3>g_file_monitor_set_rate_limit ()</h3>
247
<pre class="programlisting"><span class="returnvalue">void</span> g_file_monitor_set_rate_limit (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor,
248
<span class="returnvalue">int</span> limit_msecs);</pre>
278
<pre class="programlisting">void g_file_monitor_set_rate_limit (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
279
int limit_msecs);</pre>
250
281
Sets the rate limit to which the <em class="parameter"><code>monitor</code></em> will report
251
282
consecutive change events to the same file.</p>
252
285
<div class="variablelist"><table border="0">
253
286
<col align="left" valign="top">
270
303
<div class="refsect2" title="g_file_monitor_emit_event ()">
271
304
<a name="g-file-monitor-emit-event"></a><h3>g_file_monitor_emit_event ()</h3>
272
<pre class="programlisting"><span class="returnvalue">void</span> g_file_monitor_emit_event (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="returnvalue">GFileMonitor</span></a> *monitor,
273
<a class="link" href="GFile.html" title="GFile"><span class="returnvalue">GFile</span></a> *child,
274
<a class="link" href="GFile.html" title="GFile"><span class="returnvalue">GFile</span></a> *other_file,
275
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent"><span class="returnvalue">GFileMonitorEvent</span></a> event_type);</pre>
305
<pre class="programlisting">void g_file_monitor_emit_event (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
306
<a class="link" href="GFile.html" title="GFile">GFile</a> *child,
307
<a class="link" href="GFile.html" title="GFile">GFile</a> *other_file,
308
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent">GFileMonitorEvent</a> event_type);</pre>
277
310
Emits the <a class="link" href="GFileMonitor.html#GFileMonitor-changed" title='The "changed" signal'><span class="type">"changed"</span></a> signal if a change
278
311
has taken place. Should be called from file monitor
279
312
implementations only.
282
The signal will be emitted from an idle handler (in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
283
context</GTKDOCLINK>).</p>
315
The signal will be emitted from an idle handler (in the <a
316
href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default"
284
321
<div class="variablelist"><table border="0">
285
322
<col align="left" valign="top">
312
349
<a name="GFileMonitor.property-details"></a><h2>Property Details</h2>
313
350
<div class="refsect2" title='The "cancelled" property'>
314
351
<a name="GFileMonitor--cancelled"></a><h3>The <code class="literal">"cancelled"</code> property</h3>
315
<pre class="programlisting"> "cancelled" <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> : Read</pre>
352
<pre class="programlisting"> "cancelled" <a
353
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
354
>gboolean</a> : Read</pre>
316
355
<p>Whether the monitor has been cancelled.</p>
317
356
<p>Default value: FALSE</p>
320
359
<div class="refsect2" title='The "rate-limit" property'>
321
360
<a name="GFileMonitor--rate-limit"></a><h3>The <code class="literal">"rate-limit"</code> property</h3>
322
<pre class="programlisting"> "rate-limit" <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> : Read / Write</pre>
361
<pre class="programlisting"> "rate-limit" <a
362
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"
363
>gint</a> : Read / Write</pre>
323
364
<p>The limit of the monitor to watch for changes, in milliseconds.</p>
324
365
<p>Allowed values: >= 0</p>
325
366
<p>Default value: 800</p>
329
370
<a name="GFileMonitor.signal-details"></a><h2>Signal Details</h2>
330
371
<div class="refsect2" title='The "changed" signal'>
331
372
<a name="GFileMonitor-changed"></a><h3>The <code class="literal">"changed"</code> signal</h3>
332
<pre class="programlisting"><span class="returnvalue">void</span> user_function (<a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a> *monitor,
333
<a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> *file,
334
<a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a> *other_file,
335
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent"><span class="type">GFileMonitorEvent</span></a> event_type,
336
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data) : Run Last</pre>
373
<pre class="programlisting">void user_function (<a class="link" href="GFileMonitor.html" title="GFileMonitor">GFileMonitor</a> *monitor,
374
<a class="link" href="GFile.html" title="GFile">GFile</a> *file,
375
<a class="link" href="GFile.html" title="GFile">GFile</a> *other_file,
376
<a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent">GFileMonitorEvent</a> event_type,
378
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
379
>gpointer</a> user_data) : Run Last</pre>
338
381
Emitted when a file has been changed.</p>
339
384
<div class="variablelist"><table border="0">
340
385
<col align="left" valign="top">