1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GFileMonitor</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="file_mon.html" title="File System Monitoring">
9 <link rel="prev" href="file_mon.html" title="File System Monitoring">
10 <link rel="next" href="async.html" title="Asynchronous I/O">
11 <meta name="generator" content="GTK-Doc V1.13 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 <link rel="part" href="pt01.html" title="Part I. GIO Overview">
14 <link rel="chapter" href="ch01.html" title="Introduction">
15 <link rel="chapter" href="ch02.html" title="Compiling GIO applications">
16 <link rel="chapter" href="ch03.html" title="Running GIO applications">
17 <link rel="chapter" href="extending-gio.html" title="Extending GIO">
18 <link rel="part" href="pt02.html" title="Part II. API Reference">
19 <link rel="chapter" href="file_ops.html" title="File Operations">
20 <link rel="chapter" href="file_mon.html" title="File System Monitoring">
21 <link rel="chapter" href="async.html" title="Asynchronous I/O">
22 <link rel="chapter" href="conversion.html" title="Data conversion">
23 <link rel="chapter" href="streaming.html" title="Streaming I/O">
24 <link rel="chapter" href="types.html" title="File types and applications">
25 <link rel="chapter" href="volume_mon.html" title="Volumes and Drives">
26 <link rel="chapter" href="icons.html" title="Icons">
27 <link rel="chapter" href="failable_initialization.html" title="Failable Initialization">
28 <link rel="chapter" href="networking.html" title="Lowlevel platform-independent network support">
29 <link rel="chapter" href="resolver.html" title="DNS resolution">
30 <link rel="chapter" href="highlevel-socket.html" title="Highlevel network functionallity">
31 <link rel="chapter" href="utils.html" title="Utilities">
32 <link rel="chapter" href="extending.html" title="Extending GIO">
33 <link rel="part" href="migrating.html" title="Part III. Migrating to GIO">
34 <link rel="chapter" href="ch19.html" title="Migrating from POSIX to GIO">
35 <link rel="chapter" href="ch20.html" title="Migrating from GnomeVFS to GIO">
36 <link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy">
37 <link rel="index" href="api-index-full.html" title="Index">
38 <link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
39 <link rel="index" href="api-index-2-18.html" title="Index of new symbols in 2.18">
40 <link rel="index" href="api-index-2-20.html" title="Index of new symbols in 2.20">
41 <link rel="index" href="api-index-2-22.html" title="Index of new symbols in 2.22">
42 <link rel="index" href="api-index-2-24.html" title="Index of new symbols in 2.24">
44 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
45 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
47 <td><a accesskey="p" href="file_mon.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
48 <td><a accesskey="u" href="file_mon.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
49 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
50 <th width="100%" align="center">GIO Reference Manual</th>
51 <td><a accesskey="n" href="async.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
53 <tr><td colspan="5" class="shortcuts">
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>
65 <div class="refentry" title="GFileMonitor">
66 <a name="GFileMonitor"></a><div class="titlepage"></div>
67 <div class="refnamediv"><table width="100%"><tr>
69 <h2><span class="refentrytitle"><a name="GFileMonitor.top_of_page"></a>GFileMonitor</span></h2>
70 <p>GFileMonitor — File Monitor</p>
72 <td valign="top" align="right"></td>
74 <div class="refsynopsisdiv" title="Synopsis">
75 <a name="GFileMonitor.synopsis"></a><h2>Synopsis</h2>
76 <pre class="synopsis">
77 #include <gio/gio.h>
79 enum <a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent">GFileMonitorEvent</a>;
80 <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);
91 <div class="refsect1" title="Object Hierarchy">
92 <a name="GFileMonitor.object-hierarchy"></a><h2>Object Hierarchy</h2>
93 <pre class="synopsis">
94 <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
98 <div class="refsect1" title="Properties">
99 <a name="GFileMonitor.properties"></a><h2>Properties</h2>
100 <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
105 <div class="refsect1" title="Signals">
106 <a name="GFileMonitor.signals"></a><h2>Signals</h2>
107 <pre class="synopsis">
108 "<a class="link" href="GFileMonitor.html#GFileMonitor-changed" title='The "changed" signal'>changed</a>" : Run Last
111 <div class="refsect1" title="Description">
112 <a name="GFileMonitor.description"></a><h2>Description</h2>
114 Monitors a file or directory for changes.
117 To obtain a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a> for a file or directory, use
118 <a class="link" href="GFile.html#g-file-monitor" title="g_file_monitor ()"><code class="function">g_file_monitor()</code></a>, <a class="link" href="GFile.html#g-file-monitor-file" title="g_file_monitor_file ()"><code class="function">g_file_monitor_file()</code></a>, or
119 <a class="link" href="GFile.html#g-file-monitor-directory" title="g_file_monitor_directory ()"><code class="function">g_file_monitor_directory()</code></a>.
122 To get informed about changes to the file or directory you are
123 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
126 (though if the global default main context is blocked, this may
127 cause notifications to be blocked even if the thread-default
128 context is still running).</p>
130 <div class="refsect1" title="Details">
131 <a name="GFileMonitor.details"></a><h2>Details</h2>
132 <div class="refsect2" title="enum GFileMonitorEvent">
133 <a name="GFileMonitorEvent"></a><h3>enum GFileMonitorEvent</h3>
134 <pre class="programlisting">typedef enum {
135 G_FILE_MONITOR_EVENT_CHANGED,
136 G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT,
137 G_FILE_MONITOR_EVENT_DELETED,
138 G_FILE_MONITOR_EVENT_CREATED,
139 G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED,
140 G_FILE_MONITOR_EVENT_PRE_UNMOUNT,
141 G_FILE_MONITOR_EVENT_UNMOUNTED,
142 G_FILE_MONITOR_EVENT_MOVED
146 Specifies what type of event a monitor event is.</p>
147 <div class="variablelist"><table border="0">
148 <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>
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>
157 <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>
162 <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>
167 <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>
172 <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>
177 <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>
182 <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>
187 <td> the file was moved.
194 <div class="refsect2" title="GFileMonitor">
195 <a name="GFileMonitor-struct"></a><h3>GFileMonitor</h3>
196 <pre class="programlisting">typedef struct _GFileMonitor GFileMonitor;</pre>
198 Watches for changes to a file.</p>
201 <div class="refsect2" title="g_file_monitor_cancel ()">
202 <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>
205 Cancels a file monitor.</p>
206 <div class="variablelist"><table border="0">
207 <col align="left" valign="top">
210 <td><p><span class="term"><em class="parameter"><code>monitor</code></em> :</span></p></td>
211 <td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
215 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
216 <td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if monitor was cancelled.
223 <div class="refsect2" title="g_file_monitor_is_cancelled ()">
224 <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>
227 Returns whether the monitor is canceled.</p>
228 <div class="variablelist"><table border="0">
229 <col align="left" valign="top">
232 <td><p><span class="term"><em class="parameter"><code>monitor</code></em> :</span></p></td>
233 <td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>
237 <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.
245 <div class="refsect2" title="g_file_monitor_set_rate_limit ()">
246 <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>
250 Sets the rate limit to which the <em class="parameter"><code>monitor</code></em> will report
251 consecutive change events to the same file.</p>
252 <div class="variablelist"><table border="0">
253 <col align="left" valign="top">
256 <td><p><span class="term"><em class="parameter"><code>monitor</code></em> :</span></p></td>
257 <td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
261 <td><p><span class="term"><em class="parameter"><code>limit_msecs</code></em> :</span></p></td>
262 <td> a integer with the limit in milliseconds to
270 <div class="refsect2" title="g_file_monitor_emit_event ()">
271 <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>
277 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 has taken place. Should be called from file monitor
279 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>
284 <div class="variablelist"><table border="0">
285 <col align="left" valign="top">
288 <td><p><span class="term"><em class="parameter"><code>monitor</code></em> :</span></p></td>
289 <td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
293 <td><p><span class="term"><em class="parameter"><code>child</code></em> :</span></p></td>
294 <td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
298 <td><p><span class="term"><em class="parameter"><code>other_file</code></em> :</span></p></td>
299 <td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
303 <td><p><span class="term"><em class="parameter"><code>event_type</code></em> :</span></p></td>
304 <td> a set of <a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent"><span class="type">GFileMonitorEvent</span></a> flags.
311 <div class="refsect1" title="Property Details">
312 <a name="GFileMonitor.property-details"></a><h2>Property Details</h2>
313 <div class="refsect2" title='The "cancelled" property'>
314 <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>
316 <p>Whether the monitor has been cancelled.</p>
317 <p>Default value: FALSE</p>
320 <div class="refsect2" title='The "rate-limit" property'>
321 <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>
323 <p>The limit of the monitor to watch for changes, in milliseconds.</p>
324 <p>Allowed values: >= 0</p>
325 <p>Default value: 800</p>
328 <div class="refsect1" title="Signal Details">
329 <a name="GFileMonitor.signal-details"></a><h2>Signal Details</h2>
330 <div class="refsect2" title='The "changed" signal'>
331 <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>
338 Emitted when a file has been changed.</p>
339 <div class="variablelist"><table border="0">
340 <col align="left" valign="top">
343 <td><p><span class="term"><em class="parameter"><code>monitor</code></em> :</span></p></td>
344 <td> a <a class="link" href="GFileMonitor.html" title="GFileMonitor"><span class="type">GFileMonitor</span></a>.
348 <td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td>
349 <td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
353 <td><p><span class="term"><em class="parameter"><code>other_file</code></em> :</span></p></td>
354 <td> a <a class="link" href="GFile.html" title="GFile"><span class="type">GFile</span></a>.
358 <td><p><span class="term"><em class="parameter"><code>event_type</code></em> :</span></p></td>
359 <td> a <a class="link" href="GFileMonitor.html#GFileMonitorEvent" title="enum GFileMonitorEvent"><span class="type">GFileMonitorEvent</span></a>.
363 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
364 <td>user data set when the signal handler was connected.</td>
373 Generated by GTK-Doc V1.13</div>