<refentry id="gnome-vfs-20-gnome-vfs-monitor">
<refmeta>
<refentrytitle id="top_of_page">Monitoring</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GNOME-VFS-2.0 Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Monitoring</refname>
<refpurpose>
watch files for changes, and get called back if they do</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="synopsis">
<title id="synopsis.title">Synopsis</title>

<synopsis>



<link linkend="GnomeVFSResult">GnomeVFSResult</link> <link linkend="gnome-vfs-monitor-add">gnome_vfs_monitor_add</link>        (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> **handle,
                                             const <link linkend="gchar">gchar</link> *text_uri,
                                             <link linkend="GnomeVFSMonitorType">GnomeVFSMonitorType</link> monitor_type,
                                             <link linkend="GnomeVFSMonitorCallback">GnomeVFSMonitorCallback</link> callback,
                                             <link linkend="gpointer">gpointer</link> user_data);
<link linkend="GnomeVFSResult">GnomeVFSResult</link> <link linkend="gnome-vfs-monitor-cancel">gnome_vfs_monitor_cancel</link>     (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> *handle);
enum        <link linkend="GnomeVFSMonitorType">GnomeVFSMonitorType</link>;
enum        <link linkend="GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</link>;
<link linkend="void">void</link>        (<link linkend="GnomeVFSMonitorCallback">*GnomeVFSMonitorCallback</link>)      (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> *handle,
                                             const <link linkend="gchar">gchar</link> *monitor_uri,
                                             const <link linkend="gchar">gchar</link> *info_uri,
                                             <link linkend="GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</link> event_type,
                                             <link linkend="gpointer">gpointer</link> user_data);
</synopsis>
</refsynopsisdiv>









<refsect1 id="desc">
<title id="desc.title">Description</title>
<para>

</para>
</refsect1>

<refsect1 id="details">
<title id="details.title">Details</title>
<refsect2>
<title><anchor id="gnome-vfs-monitor-add" role="function"/>gnome_vfs_monitor_add ()</title>
<indexterm><primary>gnome_vfs_monitor_add</primary></indexterm><programlisting><link linkend="GnomeVFSResult">GnomeVFSResult</link> gnome_vfs_monitor_add        (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> **handle,
                                             const <link linkend="gchar">gchar</link> *text_uri,
                                             <link linkend="GnomeVFSMonitorType">GnomeVFSMonitorType</link> monitor_type,
                                             <link linkend="GnomeVFSMonitorCallback">GnomeVFSMonitorCallback</link> callback,
                                             <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Watch the file or directory at <parameter>text_uri</parameter> for changes (or the creation/deletion of the file)
and call <parameter>callback</parameter> when there is a change. If a directory monitor is added, <parameter>callback</parameter> is
notified when any file in the directory changes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>handle</parameter>&nbsp;:</term>
<listitem><simpara> after the call, <parameter>handle</parameter> will be a pointer to an operation handle.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>text_uri</parameter>&nbsp;:</term>
<listitem><simpara> string representing the uri to monitor.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>monitor_type</parameter>&nbsp;:</term>
<listitem><simpara> add a directory or file monitor.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>callback</parameter>&nbsp;:</term>
<listitem><simpara> function to call when the monitor is tripped.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> data to pass to <parameter>callback</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an integer representing the result of the operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gnome-vfs-monitor-cancel" role="function"/>gnome_vfs_monitor_cancel ()</title>
<indexterm><primary>gnome_vfs_monitor_cancel</primary></indexterm><programlisting><link linkend="GnomeVFSResult">GnomeVFSResult</link> gnome_vfs_monitor_cancel     (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> *handle);</programlisting>
<para>
Cancel the monitor pointed to be <parameter>handle</parameter>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>handle</parameter>&nbsp;:</term>
<listitem><simpara> handle of the monitor to cancel.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> an integer representing the result of the operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="GnomeVFSMonitorType" role="enum"/>enum GnomeVFSMonitorType</title>
<indexterm><primary>GnomeVFSMonitorType</primary></indexterm><programlisting>typedef enum {
  GNOME_VFS_MONITOR_FILE,
  GNOME_VFS_MONITOR_DIRECTORY
} GnomeVFSMonitorType;
</programlisting>
<para>
Type of resources that can be monitored.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GnomeVFSMonitorEventType" role="enum"/>enum GnomeVFSMonitorEventType</title>
<indexterm><primary>GnomeVFSMonitorEventType</primary></indexterm><programlisting>typedef enum {
  GNOME_VFS_MONITOR_EVENT_CHANGED,
  GNOME_VFS_MONITOR_EVENT_DELETED,
  GNOME_VFS_MONITOR_EVENT_STARTEXECUTING,
  GNOME_VFS_MONITOR_EVENT_STOPEXECUTING,
  GNOME_VFS_MONITOR_EVENT_CREATED,
  GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED
} GnomeVFSMonitorEventType;
</programlisting>
<para>
Types of events that can be monitored.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_CHANGED</literal></term>
<listitem><simpara> file data changed
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_DELETED</literal></term>
<listitem><simpara> file deleted event
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_STARTEXECUTING</literal></term>
<listitem><simpara>  
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_STOPEXECUTING</literal></term>
<listitem><simpara> 
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_CREATED</literal></term>
<listitem><simpara> file created event
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><literal>GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED</literal></term>
<listitem><simpara> file metadata changed
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="GnomeVFSMonitorCallback" role="function"/>GnomeVFSMonitorCallback ()</title>
<indexterm><primary>GnomeVFSMonitorCallback</primary></indexterm><programlisting><link linkend="void">void</link>        (*GnomeVFSMonitorCallback)      (<link linkend="GnomeVFSMonitorHandle">GnomeVFSMonitorHandle</link> *handle,
                                             const <link linkend="gchar">gchar</link> *monitor_uri,
                                             const <link linkend="gchar">gchar</link> *info_uri,
                                             <link linkend="GnomeVFSMonitorEventType">GnomeVFSMonitorEventType</link> event_type,
                                             <link linkend="gpointer">gpointer</link> user_data);</programlisting>
<para>
Function called when a monitor detects a change.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>handle</parameter>&nbsp;:</term>
<listitem><simpara> the handle of the monitor that created the event
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>monitor_uri</parameter>&nbsp;:</term>
<listitem><simpara> the URI of the monitor that was triggered
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>info_uri</parameter>&nbsp;:</term>
<listitem><simpara> the URI of the actual file this event is concerned with (this can be different
from <parameter>monitor_uri</parameter> if it was a directory monitor)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>event_type</parameter>&nbsp;:</term>
<listitem><simpara> what happened to <parameter>info_uri</parameter>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara> user data passed to <link linkend="gnome-vfs-monitor-add"><function>gnome_vfs_monitor_add()</function></link> when the monitor was created
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
