<?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="GtkCustomSorter">
<refmeta>
<refentrytitle role="top_of_page" id="GtkCustomSorter.top_of_page">GtkCustomSorter</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkCustomSorter</refname>
<refpurpose>Sorting with a callbacks</refpurpose>
</refnamediv>

<refsect1 id="GtkCustomSorter.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="GtkCustomSorter"><returnvalue>GtkCustomSorter</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-custom-sorter-new">gtk_custom_sorter_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-custom-sorter-set-sort-func">gtk_custom_sorter_set_sort_func</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCustomSorter.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="GtkCustomSorter-struct">GtkCustomSorter</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkCustomSorter.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="GtkSorter">GtkSorter</link>
        <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkCustomSorter
</screen>
</refsect1>

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

<refsect1 id="GtkCustomSorter.description" role="desc">
<title role="desc.title">Description</title>
<para>GtkCustomSorter is a <link linkend="GtkSorter"><type>GtkSorter</type></link> implementation that sorts
via a traditional <link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> callback.</para>

</refsect1>
<refsect1 id="GtkCustomSorter.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-custom-sorter-new" role="function">
<title>gtk_custom_sorter_new&#160;()</title>
<indexterm zone="gtk-custom-sorter-new"><primary>gtk_custom_sorter_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkCustomSorter"><returnvalue>GtkCustomSorter</returnvalue></link>&#160;*
gtk_custom_sorter_new (<parameter><link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> sort_func</parameter>,
                       <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                       <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> user_destroy</parameter>);</programlisting>
<para>Creates a new <link linkend="GtkSorter"><type>GtkSorter</type></link> that works by calling
<parameter>sort_func</parameter>
 to compare items.</para>
<para>If <parameter>sort_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, all items are considered equal.</para>
<refsect3 id="gtk-custom-sorter-new.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>sort_func</para></entry>
<entry role="parameter_description"><para>the <link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> to use for sorting</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>sort_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for <parameter>user_data</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-custom-sorter-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkCustomSorter"><type>GtkCustomSorter</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-custom-sorter-set-sort-func" role="function">
<title>gtk_custom_sorter_set_sort_func&#160;()</title>
<indexterm zone="gtk-custom-sorter-set-sort-func"><primary>gtk_custom_sorter_set_sort_func</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_custom_sorter_set_sort_func (<parameter><link linkend="GtkCustomSorter"><type>GtkCustomSorter</type></link> *self</parameter>,
                                 <parameter><link linkend="GCompareDataFunc"><type>GCompareDataFunc</type></link> sort_func</parameter>,
                                 <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                                 <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> user_destroy</parameter>);</programlisting>
<para>Sets (or unsets) the function used for sorting items.</para>
<para>If <parameter>sort_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, all items are considered equal.</para>
<para>If the sort func changes its sorting behavior,
<link linkend="gtk-sorter-changed"><function>gtk_sorter_changed()</function></link> needs to be called.</para>
<para>If a previous function was set, its <parameter>user_destroy</parameter>
 will be
called now.</para>
<refsect3 id="gtk-custom-sorter-set-sort-func.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>self</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkCustomSorter"><type>GtkCustomSorter</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sort_func</para></entry>
<entry role="parameter_description"><para>function to sort items. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>match_func</parameter>
. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>user_destroy</para></entry>
<entry role="parameter_description"><para>destroy notify for <parameter>user_data</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkCustomSorter.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkCustomSorter-struct" role="struct">
<title>GtkCustomSorter</title>
<indexterm zone="GtkCustomSorter-struct"><primary>GtkCustomSorter</primary></indexterm>
<programlisting language="C">typedef struct _GtkCustomSorter GtkCustomSorter;</programlisting>
</refsect2>

</refsect1>

</refentry>
