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>Monitoring</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
7
<link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
8
<link rel="up" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
9
<link rel="prev" href="gnome-vfs-2.0-gnome-vfs-xfer.html" title="File Transfers">
10
<link rel="next" href="gnome-vfs-2.0-gnome-vfs-file-advanced-ops.html" title="Backend-Specific Operations">
11
<meta name="generator" content="GTK-Doc V1.12 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="about.html" title="Introduction to GnomeVFS">
14
<link rel="chapter" href="data-types.html" title="Basic Data Types">
15
<link rel="chapter" href="gnome-vfs-basic-file-ops.html" title="File Operations">
16
<link rel="chapter" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
17
<link rel="chapter" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
18
<link rel="chapter" href="gnome-vfs-file-async-ops.html" title="Asynchronous Operations">
19
<link rel="chapter" href="volumes.html" title="Volumes and Drives Handling">
20
<link rel="chapter" href="networking.html" title="Networking">
21
<link rel="chapter" href="mime-registry.html" title="MIME Registry">
22
<link rel="chapter" href="modules.html" title="Filesystem Modules">
24
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
27
<td><a accesskey="p" href="gnome-vfs-2.0-gnome-vfs-xfer.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
28
<td><a accesskey="u" href="gnome-vfs-file-and-dirs-ops.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
29
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
30
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
31
<td><a accesskey="n" href="gnome-vfs-2.0-gnome-vfs-file-advanced-ops.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
33
<tr><td colspan="5" class="shortcuts">
34
<a href="#gnome-vfs-2.0-gnome-vfs-monitor.synopsis" class="shortcut">Top</a>
36
<a href="#gnome-vfs-2.0-gnome-vfs-monitor.description" class="shortcut">Description</a>
39
<div class="refentry" lang="en">
40
<a name="gnome-vfs-2.0-gnome-vfs-monitor"></a><div class="titlepage"></div>
41
<div class="refnamediv"><table width="100%"><tr>
43
<h2><span class="refentrytitle"><a name="gnome-vfs-2.0-gnome-vfs-monitor.top_of_page"></a>Monitoring</span></h2>
44
<p>Monitoring — watch files for changes, and get called back if they do</p>
46
<td valign="top" align="right"></td>
48
<div class="refsynopsisdiv">
49
<a name="gnome-vfs-2.0-gnome-vfs-monitor.synopsis"></a><h2>Synopsis</h2>
50
<pre class="synopsis">
51
typedef <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a>;
52
enum <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorType" title="enum GnomeVFSMonitorType">GnomeVFSMonitorType</a>;
53
enum <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorEventType" title="enum GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</a>;
54
void (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorCallback" title="GnomeVFSMonitorCallback ()">*GnomeVFSMonitorCallback</a>) (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> *handle,
55
const gchar *monitor_uri,
56
const gchar *info_uri,
57
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorEventType" title="enum GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</a> event_type,
59
<a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-add" title="gnome_vfs_monitor_add ()">gnome_vfs_monitor_add</a> (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> **handle,
60
const gchar *text_uri,
61
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorType" title="enum GnomeVFSMonitorType">GnomeVFSMonitorType</a> monitor_type,
62
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorCallback" title="GnomeVFSMonitorCallback ()">GnomeVFSMonitorCallback</a> callback,
64
<a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-cancel" title="gnome_vfs_monitor_cancel ()">gnome_vfs_monitor_cancel</a> (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> *handle);
65
void <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-callback" title="gnome_vfs_monitor_callback ()">gnome_vfs_monitor_callback</a> (GnomeVFSMethodHandle *method_handle,
66
<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> *info_uri,
67
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorEventType" title="enum GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</a> event_type);
70
<div class="refsect1" lang="en">
71
<a name="gnome-vfs-2.0-gnome-vfs-monitor.description"></a><h2>Description</h2>
75
<div class="refsect1" lang="en">
76
<a name="gnome-vfs-2.0-gnome-vfs-monitor.details"></a><h2>Details</h2>
77
<div class="refsect2" lang="en">
78
<a name="GnomeVFSMonitorHandle"></a><h3>GnomeVFSMonitorHandle</h3>
79
<pre class="programlisting">typedef struct GnomeVFSMonitorHandle GnomeVFSMonitorHandle;
82
a handle representing a file or directory monitor that
83
was registered using <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-add" title="gnome_vfs_monitor_add ()"><code class="function">gnome_vfs_monitor_add()</code></a> and that
84
can be cancelled using <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-cancel" title="gnome_vfs_monitor_cancel ()"><code class="function">gnome_vfs_monitor_cancel()</code></a>.</p>
89
<div class="refsect2" lang="en">
90
<a name="GnomeVFSMonitorType"></a><h3>enum GnomeVFSMonitorType</h3>
91
<pre class="programlisting">typedef enum {
92
GNOME_VFS_MONITOR_FILE,
93
GNOME_VFS_MONITOR_DIRECTORY
94
} GnomeVFSMonitorType;
97
Type of resources that can be monitored.</p>
100
<div class="variablelist"><table border="0">
101
<col align="left" valign="top">
104
<td><p><a name="GNOME-VFS-MONITOR-FILE:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_FILE</code></span></p></td>
105
<td> the monitor is registered for a single file.
109
<td><p><a name="GNOME-VFS-MONITOR-DIRECTORY:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_DIRECTORY</code></span></p></td>
110
<td> the monitor is registered for all files in a directory,
111
and the directory itself.
118
<div class="refsect2" lang="en">
119
<a name="GnomeVFSMonitorEventType"></a><h3>enum GnomeVFSMonitorEventType</h3>
120
<pre class="programlisting">typedef enum {
121
GNOME_VFS_MONITOR_EVENT_CHANGED,
122
GNOME_VFS_MONITOR_EVENT_DELETED,
123
GNOME_VFS_MONITOR_EVENT_STARTEXECUTING,
124
GNOME_VFS_MONITOR_EVENT_STOPEXECUTING,
125
GNOME_VFS_MONITOR_EVENT_CREATED,
126
GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED
127
} GnomeVFSMonitorEventType;
130
Types of events that can be monitored.</p>
133
<div class="variablelist"><table border="0">
134
<col align="left" valign="top">
137
<td><p><a name="GNOME-VFS-MONITOR-EVENT-CHANGED:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_CHANGED</code></span></p></td>
138
<td> file data changed (FAM, inotify).
142
<td><p><a name="GNOME-VFS-MONITOR-EVENT-DELETED:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_DELETED</code></span></p></td>
143
<td> file deleted event (FAM, inotify).
147
<td><p><a name="GNOME-VFS-MONITOR-EVENT-STARTEXECUTING:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_STARTEXECUTING</code></span></p></td>
148
<td> file was executed (FAM only).
152
<td><p><a name="GNOME-VFS-MONITOR-EVENT-STOPEXECUTING:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_STOPEXECUTING</code></span></p></td>
153
<td> executed file isn't executed anymore (FAM only).
157
<td><p><a name="GNOME-VFS-MONITOR-EVENT-CREATED:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_CREATED</code></span></p></td>
158
<td> file created event (FAM, inotify).
162
<td><p><a name="GNOME-VFS-MONITOR-EVENT-METADATA-CHANGED:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED</code></span></p></td>
163
<td> file metadata changed (inotify only).
170
<div class="refsect2" lang="en">
171
<a name="GnomeVFSMonitorCallback"></a><h3>GnomeVFSMonitorCallback ()</h3>
172
<pre class="programlisting">void (*GnomeVFSMonitorCallback) (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> *handle,
173
const gchar *monitor_uri,
174
const gchar *info_uri,
175
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorEventType" title="enum GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</a> event_type,
176
gpointer user_data);</pre>
178
Function called when a monitor detects a change.</p>
181
<div class="variablelist"><table border="0">
182
<col align="left" valign="top">
185
<td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
186
<td> the handle of the monitor that created the event
190
<td><p><span class="term"><em class="parameter"><code>monitor_uri</code></em> :</span></p></td>
191
<td> the URI of the monitor that was triggered
195
<td><p><span class="term"><em class="parameter"><code>info_uri</code></em> :</span></p></td>
196
<td> the URI of the actual file this event is concerned with (this can be different
197
from <em class="parameter"><code>monitor_uri</code></em> if it was a directory monitor)
201
<td><p><span class="term"><em class="parameter"><code>event_type</code></em> :</span></p></td>
202
<td> what happened to <em class="parameter"><code>info_uri</code></em>
206
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
207
<td> user data passed to <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-add" title="gnome_vfs_monitor_add ()"><code class="function">gnome_vfs_monitor_add()</code></a> when the monitor was created
214
<div class="refsect2" lang="en">
215
<a name="gnome-vfs-monitor-add"></a><h3>gnome_vfs_monitor_add ()</h3>
216
<pre class="programlisting"><a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_monitor_add (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> **handle,
217
const gchar *text_uri,
218
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorType" title="enum GnomeVFSMonitorType">GnomeVFSMonitorType</a> monitor_type,
219
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorCallback" title="GnomeVFSMonitorCallback ()">GnomeVFSMonitorCallback</a> callback,
220
gpointer user_data);</pre>
222
Watch the file or directory at <em class="parameter"><code>text_uri</code></em> for changes (or the creation/deletion of the file)
223
and call <em class="parameter"><code>callback</code></em> when there is a change. If a directory monitor is added, <em class="parameter"><code>callback</code></em> is
224
notified when any file in the directory changes.</p>
227
<div class="variablelist"><table border="0">
228
<col align="left" valign="top">
231
<td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
232
<td> after the call, <em class="parameter"><code>handle</code></em> will be a pointer to an operation handle.
236
<td><p><span class="term"><em class="parameter"><code>text_uri</code></em> :</span></p></td>
237
<td> string representing the uri to monitor.
241
<td><p><span class="term"><em class="parameter"><code>monitor_type</code></em> :</span></p></td>
242
<td> add a directory or file monitor.
246
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
247
<td> function to call when the monitor is tripped.
251
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
252
<td> data to pass to <em class="parameter"><code>callback</code></em>.
256
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
257
<td> an integer representing the result of the operation.
264
<div class="refsect2" lang="en">
265
<a name="gnome-vfs-monitor-cancel"></a><h3>gnome_vfs_monitor_cancel ()</h3>
266
<pre class="programlisting"><a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_monitor_cancel (<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorHandle" title="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</a> *handle);</pre>
268
Cancel the monitor pointed to be <em class="parameter"><code>handle</code></em>.</p>
271
<div class="variablelist"><table border="0">
272
<col align="left" valign="top">
275
<td><p><span class="term"><em class="parameter"><code>handle</code></em> :</span></p></td>
276
<td> handle of the monitor to cancel.
280
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
281
<td> an integer representing the result of the operation.
288
<div class="refsect2" lang="en">
289
<a name="gnome-vfs-monitor-callback"></a><h3>gnome_vfs_monitor_callback ()</h3>
290
<pre class="programlisting">void gnome_vfs_monitor_callback (GnomeVFSMethodHandle *method_handle,
291
<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> *info_uri,
292
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorEventType" title="enum GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</a> event_type);</pre>
294
<a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-callback" title="gnome_vfs_monitor_callback ()"><code class="function">gnome_vfs_monitor_callback()</code></a> is used by <span class="type">GnomeVFSMethods</span> to indicate that a particular
295
resource changed, and will issue the emission of the <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#GnomeVFSMonitorCallback" title="GnomeVFSMonitorCallback ()"><span class="type">GnomeVFSMonitorCallback</span></a> registered
296
using <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-add" title="gnome_vfs_monitor_add ()"><code class="function">gnome_vfs_monitor_add()</code></a>.</p>
299
<div class="variablelist"><table border="0">
300
<col align="left" valign="top">
303
<td><p><span class="term"><em class="parameter"><code>method_handle</code></em> :</span></p></td>
304
<td> Method-specific monitor handle obtained through <a class="link" href="gnome-vfs-2.0-gnome-vfs-monitor.html#gnome-vfs-monitor-add" title="gnome_vfs_monitor_add ()"><code class="function">gnome_vfs_monitor_add()</code></a>.
308
<td><p><span class="term"><em class="parameter"><code>info_uri</code></em> :</span></p></td>
309
<td> URI that triggered the callback.
313
<td><p><span class="term"><em class="parameter"><code>event_type</code></em> :</span></p></td>
314
<td> The event obtained for <em class="parameter"><code>info_uri</code></em>.
324
Generated by GTK-Doc V1.12</div>