<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="GtkFileFilter">
<refmeta>
<refentrytitle role="top_of_page" id="GtkFileFilter.top_of_page">GtkFileFilter</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkFileFilter</refname>
<refpurpose>A filter for selecting a file subset</refpurpose>
</refnamediv>

<refsect1 id="GtkFileFilter.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GtkFileFilterFunc">*GtkFileFilterFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkFileFilter"><returnvalue>GtkFileFilter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-file-filter-new">gtk_file_filter_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-set-name">gtk_file_filter_set_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-file-filter-get-name">gtk_file_filter_get_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-add-mime-type">gtk_file_filter_add_mime_type</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-add-pattern">gtk_file_filter_add_pattern</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-add-pixbuf-formats">gtk_file_filter_add_pixbuf_formats</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-add-custom">gtk_file_filter_add_custom</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkFileFilterFlags"><returnvalue>GtkFileFilterFlags</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-get-needed">gtk_file_filter_get_needed</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-file-filter-filter">gtk_file_filter_filter</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GtkFileFilter"><returnvalue>GtkFileFilter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-file-filter-new-from-gvariant">gtk_file_filter_new_from_gvariant</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-file-filter-to-gvariant">gtk_file_filter_to_gvariant</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFileFilter.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkFileFilter--name">name</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFileFilter.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkFileFilter-struct">GtkFileFilter</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GtkFileFilterInfo">GtkFileFilterInfo</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GtkFileFilterFlags">GtkFileFilterFlags</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkFileFilter.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> <link linkend="GInitiallyUnowned">GInitiallyUnowned</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkFileFilter
</screen>
</refsect1>
<refsect1 id="GtkFileFilter.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkFileFilter implements
 <link linkend="GtkBuildable">GtkBuildable</link>.</para>

</refsect1>

<refsect1 id="GtkFileFilter.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="GtkFileFilter.description" role="desc">
<title role="desc.title">Description</title>
<para>A GtkFileFilter can be used to restrict the files being shown in a
<link linkend="GtkFileChooser"><type>GtkFileChooser</type></link>. Files can be filtered based on their name (with
<link linkend="gtk-file-filter-add-pattern"><function>gtk_file_filter_add_pattern()</function></link>), on their mime type (with
<link linkend="gtk-file-filter-add-mime-type"><function>gtk_file_filter_add_mime_type()</function></link>), or by a custom filter function
(with <link linkend="gtk-file-filter-add-custom"><function>gtk_file_filter_add_custom()</function></link>).</para>
<para>Filtering by mime types handles aliasing and subclassing of mime
types; e.g. a filter for text/plain also matches a file with mime
type application/rtf, since application/rtf is a subclass of
text/plain. Note that <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> allows wildcards for the
subtype of a mime type, so you can e.g. filter for image/*.</para>
<para>Normally, filters are used by adding them to a <link linkend="GtkFileChooser"><type>GtkFileChooser</type></link>,
see <link linkend="gtk-file-chooser-add-filter"><function>gtk_file_chooser_add_filter()</function></link>, but it is also possible
to manually use a filter on a file with <link linkend="gtk-file-filter-filter"><function>gtk_file_filter_filter()</function></link>.</para>
<refsect2><title>GtkFileFilter as GtkBuildable</title><para>The GtkFileFilter implementation of the GtkBuildable interface
supports adding rules using the &lt;mime-types>, &lt;patterns> and
&lt;applications> elements and listing the rules within. Specifying
a &lt;mime-type> or &lt;pattern> has the same effect as as calling
<link linkend="gtk-file-filter-add-mime-type"><function>gtk_file_filter_add_mime_type()</function></link> or <link linkend="gtk-file-filter-add-pattern"><function>gtk_file_filter_add_pattern()</function></link>.</para>
<para>An example of a UI definition fragment specifying GtkFileFilter
rules:</para>
<informalexample><programlisting role="example"><![CDATA[
<object class="GtkFileFilter">
  <property name="name" translatable="yes">Text and Images</property>
  <mime-types>
    <mime-type>text/plain</mime-type>
    <mime-type>image/ *</mime-type>
  </mime-types>
  <patterns>
    <pattern>*.txt</pattern>
    <pattern>*.png</pattern>
  </patterns>
</object>
]]></programlisting></informalexample>
<para></para>
</refsect2>

</refsect1>
<refsect1 id="GtkFileFilter.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="GtkFileFilterFunc" role="function">
<title>GtkFileFilterFunc&#160;()</title>
<indexterm zone="GtkFileFilterFunc"><primary>GtkFileFilterFunc</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GtkFileFilterFunc<phrase role="c_punctuation">)</phrase> (<parameter>const <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> *filter_info</parameter>,
                      <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>The type of function that is used with custom filters, see
<link linkend="gtk-file-filter-add-custom"><function>gtk_file_filter_add_custom()</function></link>.</para>
<refsect3 id="GtkFileFilterFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter_info</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> that is filled according
to the <parameter>needed</parameter>
flags passed to <link linkend="gtk-file-filter-add-custom"><function>gtk_file_filter_add_custom()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>user data passed to <link linkend="gtk-file-filter-add-custom"><function>gtk_file_filter_add_custom()</function></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkFileFilterFunc.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file should be displayed</para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-new" role="function">
<title>gtk_file_filter_new&#160;()</title>
<indexterm zone="gtk-file-filter-new"><primary>gtk_file_filter_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkFileFilter"><returnvalue>GtkFileFilter</returnvalue></link>&#160;*
gtk_file_filter_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> with no rules added to it.
Such a filter doesn’t accept any files, so is not
particularly useful until you add rules with
<link linkend="gtk-file-filter-add-mime-type"><function>gtk_file_filter_add_mime_type()</function></link>, <link linkend="gtk-file-filter-add-pattern"><function>gtk_file_filter_add_pattern()</function></link>,
or <link linkend="gtk-file-filter-add-custom"><function>gtk_file_filter_add_custom()</function></link>. To create a filter
that accepts any file, use:</para>
<informalexample><programlisting role="example"><![CDATA[
GtkFileFilter *filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (filter, "*");
]]></programlisting></informalexample>
<para></para>
<refsect3 id="gtk-file-filter-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-set-name" role="function">
<title>gtk_file_filter_set_name&#160;()</title>
<indexterm zone="gtk-file-filter-set-name"><primary>gtk_file_filter_set_name</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_file_filter_set_name (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>,
                          <parameter>const <link linkend="gchar"><type>gchar</type></link> *name</parameter>);</programlisting>
<para>Sets the human-readable name of the filter; this is the string
that will be displayed in the file selector user interface if
there is a selectable list of filters.</para>
<refsect3 id="gtk-file-filter-set-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>name</para></entry>
<entry role="parameter_description"><para>the human-readable-name for the filter, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
to remove any existing name. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-get-name" role="function">
<title>gtk_file_filter_get_name&#160;()</title>
<indexterm zone="gtk-file-filter-get-name"><primary>gtk_file_filter_get_name</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gtk_file_filter_get_name (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>);</programlisting>
<para>Gets the human-readable name for the filter. See <link linkend="gtk-file-filter-set-name"><function>gtk_file_filter_set_name()</function></link>.</para>
<refsect3 id="gtk-file-filter-get-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-file-filter-get-name.returns" role="returns">
<title>Returns</title>
<para>The human-readable name of the filter,
or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. This value is owned by GTK+ and must not
be modified or freed. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-add-mime-type" role="function">
<title>gtk_file_filter_add_mime_type&#160;()</title>
<indexterm zone="gtk-file-filter-add-mime-type"><primary>gtk_file_filter_add_mime_type</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_file_filter_add_mime_type (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>,
                               <parameter>const <link linkend="gchar"><type>gchar</type></link> *mime_type</parameter>);</programlisting>
<para>Adds a rule allowing a given mime type to <parameter>filter</parameter>
.</para>
<refsect3 id="gtk-file-filter-add-mime-type.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>mime_type</para></entry>
<entry role="parameter_description"><para>name of a MIME type</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-add-pattern" role="function">
<title>gtk_file_filter_add_pattern&#160;()</title>
<indexterm zone="gtk-file-filter-add-pattern"><primary>gtk_file_filter_add_pattern</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_file_filter_add_pattern (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>,
                             <parameter>const <link linkend="gchar"><type>gchar</type></link> *pattern</parameter>);</programlisting>
<para>Adds a rule allowing a shell style glob to a filter.</para>
<refsect3 id="gtk-file-filter-add-pattern.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>pattern</para></entry>
<entry role="parameter_description"><para>a shell style glob</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-add-pixbuf-formats" role="function">
<title>gtk_file_filter_add_pixbuf_formats&#160;()</title>
<indexterm zone="gtk-file-filter-add-pixbuf-formats"><primary>gtk_file_filter_add_pixbuf_formats</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_file_filter_add_pixbuf_formats (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>);</programlisting>
<para>Adds a rule allowing image files in the formats supported
by GdkPixbuf.</para>
<refsect3 id="gtk-file-filter-add-pixbuf-formats.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-add-custom" role="function">
<title>gtk_file_filter_add_custom&#160;()</title>
<indexterm zone="gtk-file-filter-add-custom"><primary>gtk_file_filter_add_custom</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_file_filter_add_custom (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>,
                            <parameter><link linkend="GtkFileFilterFlags"><type>GtkFileFilterFlags</type></link> needed</parameter>,
                            <parameter><link linkend="GtkFileFilterFunc"><type>GtkFileFilterFunc</type></link> func</parameter>,
                            <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                            <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> notify</parameter>);</programlisting>
<para>Adds rule to a filter that allows files based on a custom callback
function. The bitfield <parameter>needed</parameter>
 which is passed in provides information
about what sorts of information that the filter function needs;
this allows GTK+ to avoid retrieving expensive information when
it isn’t needed by the filter.</para>
<refsect3 id="gtk-file-filter-add-custom.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>needed</para></entry>
<entry role="parameter_description"><para>bitfield of flags indicating the information that the custom
filter function needs.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>callback function; if the function returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, then
the file will be displayed.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>data to pass to <parameter>func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>function to call to free <parameter>data</parameter>
when it is no longer needed.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-get-needed" role="function">
<title>gtk_file_filter_get_needed&#160;()</title>
<indexterm zone="gtk-file-filter-get-needed"><primary>gtk_file_filter_get_needed</primary></indexterm>
<programlisting language="C"><link linkend="GtkFileFilterFlags"><returnvalue>GtkFileFilterFlags</returnvalue></link>
gtk_file_filter_get_needed (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>);</programlisting>
<para>Gets the fields that need to be filled in for the <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link>
passed to <link linkend="gtk-file-filter-filter"><function>gtk_file_filter_filter()</function></link></para>
<para>This function will not typically be used by applications; it
is intended principally for use in the implementation of
<link linkend="GtkFileChooser"><type>GtkFileChooser</type></link>.</para>
<refsect3 id="gtk-file-filter-get-needed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-file-filter-get-needed.returns" role="returns">
<title>Returns</title>
<para> bitfield of flags indicating needed fields when
calling <link linkend="gtk-file-filter-filter"><function>gtk_file_filter_filter()</function></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-filter" role="function">
<title>gtk_file_filter_filter&#160;()</title>
<indexterm zone="gtk-file-filter-filter"><primary>gtk_file_filter_filter</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_file_filter_filter (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>,
                        <parameter>const <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> *filter_info</parameter>);</programlisting>
<para>Tests whether a file should be displayed according to <parameter>filter</parameter>
.
The <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> <parameter>filter_info</parameter>
 should include
the fields returned from <link linkend="gtk-file-filter-get-needed"><function>gtk_file_filter_get_needed()</function></link>.</para>
<para>This function will not typically be used by applications; it
is intended principally for use in the implementation of
<link linkend="GtkFileChooser"><type>GtkFileChooser</type></link>.</para>
<refsect3 id="gtk-file-filter-filter.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>filter_info</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> containing information
about a file.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-file-filter-filter.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the file should be displayed</para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-new-from-gvariant" role="function">
<title>gtk_file_filter_new_from_gvariant&#160;()</title>
<indexterm zone="gtk-file-filter-new-from-gvariant"><primary>gtk_file_filter_new_from_gvariant</primary></indexterm>
<programlisting language="C"><link linkend="GtkFileFilter"><returnvalue>GtkFileFilter</returnvalue></link>&#160;*
gtk_file_filter_new_from_gvariant (<parameter><link linkend="GVariant"><type>GVariant</type></link> *variant</parameter>);</programlisting>
<para>Deserialize a file filter from an a{sv} variant in
the format produced by <link linkend="gtk-file-filter-to-gvariant"><function>gtk_file_filter_to_gvariant()</function></link>.</para>
<refsect3 id="gtk-file-filter-new-from-gvariant.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>variant</para></entry>
<entry role="parameter_description"><para>an a{sv} <link linkend="GVariant"><type>GVariant</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-file-filter-new-from-gvariant.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> object. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-file-filter-to-gvariant" role="function">
<title>gtk_file_filter_to_gvariant&#160;()</title>
<indexterm zone="gtk-file-filter-to-gvariant"><primary>gtk_file_filter_to_gvariant</primary></indexterm>
<programlisting language="C"><link linkend="GVariant"><returnvalue>GVariant</returnvalue></link>&#160;*
gtk_file_filter_to_gvariant (<parameter><link linkend="GtkFileFilter"><type>GtkFileFilter</type></link> *filter</parameter>);</programlisting>
<para>Serialize a file filter to an a{sv} variant.</para>
<refsect3 id="gtk-file-filter-to-gvariant.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>filter</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkFileFilter"><type>GtkFileFilter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-file-filter-to-gvariant.returns" role="returns">
<title>Returns</title>
<para>a new, floating, <link linkend="GVariant"><type>GVariant</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkFileFilter.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkFileFilter-struct" role="struct">
<title>GtkFileFilter</title>
<indexterm zone="GtkFileFilter-struct"><primary>GtkFileFilter</primary></indexterm>
<programlisting language="C">typedef struct _GtkFileFilter GtkFileFilter;</programlisting>
</refsect2>
<refsect2 id="GtkFileFilterInfo" role="struct">
<title>struct GtkFileFilterInfo</title>
<indexterm zone="GtkFileFilterInfo"><primary>GtkFileFilterInfo</primary></indexterm>
<programlisting language="C">struct GtkFileFilterInfo {
  GtkFileFilterFlags contains;

  const gchar *filename;
  const gchar *uri;
  const gchar *display_name;
  const gchar *mime_type;
};
</programlisting>
<para>A <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> is used to pass information about the
tested file to <link linkend="gtk-file-filter-filter"><function>gtk_file_filter_filter()</function></link>.</para>
<refsect3 id="GtkFileFilterInfo.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><link linkend="GtkFileFilterFlags"><type>GtkFileFilterFlags</type></link>&#160;<structfield id="GtkFileFilterInfo.contains">contains</structfield>;</para></entry>
<entry role="struct_member_description"><para>Flags indicating which of the following fields need
are filled</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para>const&#160;<link linkend="gchar"><type>gchar</type></link>&#160;*<structfield id="GtkFileFilterInfo.filename">filename</structfield>;</para></entry>
<entry role="struct_member_description"><para>the filename of the file being tested</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para>const&#160;<link linkend="gchar"><type>gchar</type></link>&#160;*<structfield id="GtkFileFilterInfo.uri">uri</structfield>;</para></entry>
<entry role="struct_member_description"><para>the URI for the file being tested</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para>const&#160;<link linkend="gchar"><type>gchar</type></link>&#160;*<structfield id="GtkFileFilterInfo.display-name">display_name</structfield>;</para></entry>
<entry role="struct_member_description"><para>the string that will be used to display the file
in the file chooser</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para>const&#160;<link linkend="gchar"><type>gchar</type></link>&#160;*<structfield id="GtkFileFilterInfo.mime-type">mime_type</structfield>;</para></entry>
<entry role="struct_member_description"><para>the mime type of the file</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GtkFileFilterFlags" role="enum">
<title>enum GtkFileFilterFlags</title>
<indexterm zone="GtkFileFilterFlags"><primary>GtkFileFilterFlags</primary></indexterm>
<para>These flags indicate what parts of a <link linkend="GtkFileFilterInfo"><type>GtkFileFilterInfo</type></link> struct
are filled or need to be filled.</para>
<refsect3 id="GtkFileFilterFlags.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GTK-FILE-FILTER-FILENAME:CAPS">GTK_FILE_FILTER_FILENAME</para></entry>
<entry role="enum_member_description"><para>the filename of the file being tested</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-FILE-FILTER-URI:CAPS">GTK_FILE_FILTER_URI</para></entry>
<entry role="enum_member_description"><para>the URI for the file being tested</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-FILE-FILTER-DISPLAY-NAME:CAPS">GTK_FILE_FILTER_DISPLAY_NAME</para></entry>
<entry role="enum_member_description"><para>the string that will be used to

display the file in the file chooser</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-FILE-FILTER-MIME-TYPE:CAPS">GTK_FILE_FILTER_MIME_TYPE</para></entry>
<entry role="enum_member_description"><para>the mime type of the file</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkFileFilter.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkFileFilter--name" role="property"><title>The <literal>“name”</literal> property</title>
<indexterm zone="GtkFileFilter--name"><primary>GtkFileFilter:name</primary></indexterm>
<programlisting>  “name”                     <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>The human-readable name of the filter.</para>
<para>This is the string that will be displayed in the file selector user
interface if there is a selectable list of filters.</para>
<para>Owner: GtkFileFilter</para>
<para>Flags: Read / Write</para>
<para>Default value: NULL</para>
</refsect2>

</refsect1>
<refsect1 id="GtkFileFilter.see-also">
<title>See Also</title>
<para><link linkend="GtkFileChooser"><type>GtkFileChooser</type></link></para>

</refsect1>

</refentry>
