<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="GFileMonitor">
<refmeta>
<refentrytitle role="top_of_page">GFileMonitor</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GIO Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GFileMonitor</refname>
<refpurpose>File Monitor</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

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

<synopsis>

#include &lt;gio/gio.h&gt;


enum                <link linkend="GFileMonitorEvent">GFileMonitorEvent</link>;
                    <link linkend="GFileMonitor-struct">GFileMonitor</link>;
<link linkend="gboolean">gboolean</link>            <link linkend="g-file-monitor-cancel">g_file_monitor_cancel</link>               (<link linkend="GFileMonitor">GFileMonitor</link> *monitor);
<link linkend="gboolean">gboolean</link>            <link linkend="g-file-monitor-is-cancelled">g_file_monitor_is_cancelled</link>         (<link linkend="GFileMonitor">GFileMonitor</link> *monitor);
<link linkend="void">void</link>                <link linkend="g-file-monitor-set-rate-limit">g_file_monitor_set_rate_limit</link>       (<link linkend="GFileMonitor">GFileMonitor</link> *monitor,
                                                         <link linkend="int">int</link> limit_msecs);
<link linkend="void">void</link>                <link linkend="g-file-monitor-emit-event">g_file_monitor_emit_event</link>           (<link linkend="GFileMonitor">GFileMonitor</link> *monitor,
                                                         <link linkend="GFile">GFile</link> *child,
                                                         <link linkend="GFile">GFile</link> *other_file,
                                                         <link linkend="GFileMonitorEvent">GFileMonitorEvent</link> event_type);


</synopsis>
</refsynopsisdiv>

<refsect1 role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----GFileMonitor
</synopsis>

</refsect1>





<refsect1 role="properties">
<title role="properties.title">Properties</title>
<synopsis>

  &quot;<link linkend="GFileMonitor--cancelled">cancelled</link>&quot;                <link linkend="gboolean">gboolean</link>              : Read
  &quot;<link linkend="GFileMonitor--rate-limit">rate-limit</link>&quot;               <link linkend="gint">gint</link>                  : Read / Write
</synopsis>
</refsect1>

<refsect1 role="signal_proto">
<title role="signal_proto.title">Signals</title>
<synopsis>

  &quot;<link linkend="GFileMonitor-changed">changed</link>&quot;                                        : Run Last
</synopsis>
</refsect1>


<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
Monitors a file or directory for changes.
</para>
<para>
To obtain a <link linkend="GFileMonitor"><type>GFileMonitor</type></link> for a file or directory, use
<link linkend="g-file-monitor-file"><function>g_file_monitor_file()</function></link> or <link linkend="g-file-monitor-directory"><function>g_file_monitor_directory()</function></link>.
</para>
<para>
To get informed about changes to the file or directory you
are monitoring, connect to the <link linkend="GFileMonitor-changed"><type>"changed"</type></link> signal.</para>
<para>

</para>
</refsect1>

<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="GFileMonitorEvent" role="enum"/>enum GFileMonitorEvent</title>
<indexterm><primary>GFileMonitorEvent</primary></indexterm><programlisting>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
} GFileMonitorEvent;
</programlisting>
<para>
Specifies what type of event a monitor event is.</para>
<para>

</para><variablelist role="enum">
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-CHANGED:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_CHANGED</literal></term>
<listitem><simpara> a file changed.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-CHANGES-DONE-HINT:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT</literal></term>
<listitem><simpara> a hint that this was probably the last change in a set of changes.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-DELETED:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_DELETED</literal></term>
<listitem><simpara> a file was deleted.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-CREATED:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_CREATED</literal></term>
<listitem><simpara> a file was created.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-ATTRIBUTE-CHANGED:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED</literal></term>
<listitem><simpara> a file attribute was changed.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-PRE-UNMOUNT:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_PRE_UNMOUNT</literal></term>
<listitem><simpara> the file location will soon be unmounted.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><anchor id="G-FILE-MONITOR-EVENT-UNMOUNTED:CAPS" role="constant"/><literal>G_FILE_MONITOR_EVENT_UNMOUNTED</literal></term>
<listitem><simpara> the file location was unmounted.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="GFileMonitor-struct" role="struct"/>GFileMonitor</title>
<indexterm><primary>GFileMonitor</primary></indexterm><programlisting>typedef struct _GFileMonitor GFileMonitor;</programlisting>
<para>
Watches for changes to a file.</para>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="g-file-monitor-cancel" role="function"/>g_file_monitor_cancel ()</title>
<indexterm><primary>g_file_monitor_cancel</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_file_monitor_cancel               (<link linkend="GFileMonitor">GFileMonitor</link> *monitor);</programlisting>
<para>
Cancels a file monitor.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>monitor</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitor"><type>GFileMonitor</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if monitor was cancelled.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-file-monitor-is-cancelled" role="function"/>g_file_monitor_is_cancelled ()</title>
<indexterm><primary>g_file_monitor_is_cancelled</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            g_file_monitor_is_cancelled         (<link linkend="GFileMonitor">GFileMonitor</link> *monitor);</programlisting>
<para>
Returns whether the monitor is canceled.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>monitor</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitor"><type>GFileMonitor</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if monitor is canceled. <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> otherwise.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-file-monitor-set-rate-limit" role="function"/>g_file_monitor_set_rate_limit ()</title>
<indexterm><primary>g_file_monitor_set_rate_limit</primary></indexterm><programlisting><link linkend="void">void</link>                g_file_monitor_set_rate_limit       (<link linkend="GFileMonitor">GFileMonitor</link> *monitor,
                                                         <link linkend="int">int</link> limit_msecs);</programlisting>
<para>
Sets the rate limit to which the <parameter>monitor</parameter> will report
consecutive change events to the same file.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>monitor</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitor"><type>GFileMonitor</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>limit_msecs</parameter>&nbsp;:</term>
<listitem><simpara> a integer with the limit in milliseconds to 
poll for changes.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="g-file-monitor-emit-event" role="function"/>g_file_monitor_emit_event ()</title>
<indexterm><primary>g_file_monitor_emit_event</primary></indexterm><programlisting><link linkend="void">void</link>                g_file_monitor_emit_event           (<link linkend="GFileMonitor">GFileMonitor</link> *monitor,
                                                         <link linkend="GFile">GFile</link> *child,
                                                         <link linkend="GFile">GFile</link> *other_file,
                                                         <link linkend="GFileMonitorEvent">GFileMonitorEvent</link> event_type);</programlisting>
<para>
Emits the <link linkend="GFileMonitor-changed"><type>"changed"</type></link> signal if a change
has taken place. Should be called from file monitor 
implementations only.
</para>
<para>
The signal will be emitted from an idle handler.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>monitor</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitor"><type>GFileMonitor</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>child</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFile"><type>GFile</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>other_file</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFile"><type>GFile</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>event_type</parameter>&nbsp;:</term>
<listitem><simpara> a set of <link linkend="GFileMonitorEvent"><type>GFileMonitorEvent</type></link> flags.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2><title><anchor id="GFileMonitor--cancelled"/>The <literal>&quot;cancelled&quot;</literal> property</title>
<indexterm><primary>GFileMonitor:cancelled</primary></indexterm><programlisting>  &quot;cancelled&quot;                <link linkend="gboolean">gboolean</link>              : Read</programlisting>
<para>Whether the monitor has been cancelled.</para><para>Default value: FALSE</para>
</refsect2>
<refsect2><title><anchor id="GFileMonitor--rate-limit"/>The <literal>&quot;rate-limit&quot;</literal> property</title>
<indexterm><primary>GFileMonitor:rate-limit</primary></indexterm><programlisting>  &quot;rate-limit&quot;               <link linkend="gint">gint</link>                  : Read / Write</programlisting>
<para>The limit of the monitor to watch for changes, in milliseconds.</para><para>Allowed values: &gt;= 0</para>
<para>Default value: 800</para>
</refsect2>

</refsect1>

<refsect1 role="signals">
<title role="signals.title">Signal Details</title>
<refsect2><title><anchor id="GFileMonitor-changed"/>The <literal>&quot;changed&quot;</literal> signal</title>
<indexterm><primary>GFileMonitor::changed</primary></indexterm><programlisting><link linkend="void">void</link>                user_function                      (<link linkend="GFileMonitor">GFileMonitor</link>     *monitor,
                                                        <link linkend="GFile">GFile</link>            *file,
                                                        <link linkend="GFile">GFile</link>            *other_file,
                                                        <link linkend="GFileMonitorEvent">GFileMonitorEvent</link> event_type,
                                                        <link linkend="gpointer">gpointer</link>          user_data)       : Run Last</programlisting>
<para>
Emitted when a file has been changed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>monitor</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitor"><type>GFileMonitor</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>file</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFile"><type>GFile</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>other_file</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFile"><type>GFile</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>event_type</parameter>&nbsp;:</term>
<listitem><simpara> a <link linkend="GFileMonitorEvent"><type>GFileMonitorEvent</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&nbsp;:</term>
<listitem><simpara>user data set when the signal handler was connected.</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>




<refsect1><refsect2 /><refsect2 /></refsect1>
</refentry>
