<?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="GtkTreeSortable">
<refmeta>
<refentrytitle role="top_of_page" id="GtkTreeSortable.top_of_page">GtkTreeSortable</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkTreeSortable</refname>
<refpurpose>The interface for sortable models used by GtkTreeView</refpurpose>
</refnamediv>

<refsect1 id="GtkTreeSortable.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="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GtkTreeIterCompareFunc">*GtkTreeIterCompareFunc</link><phrase role="c_punctuation">)</phrase>&#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-tree-sortable-sort-column-changed">gtk_tree_sortable_sort_column_changed</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-tree-sortable-get-sort-column-id">gtk_tree_sortable_get_sort_column_id</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-tree-sortable-set-sort-column-id">gtk_tree_sortable_set_sort_column_id</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-tree-sortable-set-sort-func">gtk_tree_sortable_set_sort_func</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-tree-sortable-set-default-sort-func">gtk_tree_sortable_set_default_sort_func</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-tree-sortable-has-default-sort-func">gtk_tree_sortable_has_default_sort_func</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkTreeSortable.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkTreeSortable-sort-column-changed">sort-column-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkTreeSortable.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="GtkTreeSortable-struct">GtkTreeSortable</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GtkTreeSortableIface">GtkTreeSortableIface</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS">GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS">GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="GtkTreeSortable.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GInterface">GInterface</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkTreeSortable
</screen>
</refsect1>
<refsect1 id="GtkTreeSortable.prerequisites" role="prerequisites">
<title role="prerequisites.title">Prerequisites</title>
<para>
GtkTreeSortable requires
 <link linkend="GtkTreeModel">GtkTreeModel</link> and  <link linkend="GObject">GObject</link>.</para>

</refsect1>
<refsect1 id="GtkTreeSortable.implementations" role="implementations">
<title role="implementations.title">Known Implementations</title>
<para>
GtkTreeSortable is implemented by
 <link linkend="GtkListStore">GtkListStore</link>,  <link linkend="GtkTreeModelSort">GtkTreeModelSort</link> and  <link linkend="GtkTreeStore">GtkTreeStore</link>.</para>

</refsect1>

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

<refsect1 id="GtkTreeSortable.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> is an interface to be implemented by tree models which
support sorting. The <link linkend="GtkTreeView"><type>GtkTreeView</type></link> uses the methods provided by this interface
to sort the model.</para>

</refsect1>
<refsect1 id="GtkTreeSortable.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="GtkTreeIterCompareFunc" role="function">
<title>GtkTreeIterCompareFunc&#160;()</title>
<indexterm zone="GtkTreeIterCompareFunc"><primary>GtkTreeIterCompareFunc</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GtkTreeIterCompareFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GtkTreeModel"><type>GtkTreeModel</type></link> *model</parameter>,
                           <parameter><link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> *a</parameter>,
                           <parameter><link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> *b</parameter>,
                           <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<para>A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive
integer if <parameter>a</parameter>
 sorts before <parameter>b</parameter>
, <parameter>a</parameter>
 sorts with <parameter>b</parameter>
, or <parameter>a</parameter>
 sorts after <parameter>b</parameter>

respectively. If two iters compare as equal, their order in the sorted model
is undefined. In order to ensure that the <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> behaves as
expected, the GtkTreeIterCompareFunc must define a partial order on
the model, i.e. it must be reflexive, antisymmetric and transitive.</para>
<para>For example, if <parameter>model</parameter>
 is a product catalogue, then a compare function
for the “price” column could be one which returns
<literal>price_of(@a) - price_of(@b)</literal>.</para>
<refsect3 id="GtkTreeIterCompareFunc.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>model</para></entry>
<entry role="parameter_description"><para>The <link linkend="GtkTreeModel"><type>GtkTreeModel</type></link> the comparison is within</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>a</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> in <parameter>model</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>b</para></entry>
<entry role="parameter_description"><para>Another <link linkend="GtkTreeIter"><type>GtkTreeIter</type></link> in <parameter>model</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>Data passed when the compare func is assigned e.g. by
<link linkend="gtk-tree-sortable-set-sort-func"><function>gtk_tree_sortable_set_sort_func()</function></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkTreeIterCompareFunc.returns" role="returns">
<title>Returns</title>
<para> a negative integer, zero or a positive integer depending on whether
<parameter>a</parameter>
sorts before, with or after <parameter>b</parameter>
</para>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-sort-column-changed" role="function">
<title>gtk_tree_sortable_sort_column_changed&#160;()</title>
<indexterm zone="gtk-tree-sortable-sort-column-changed"><primary>gtk_tree_sortable_sort_column_changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_tree_sortable_sort_column_changed (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>);</programlisting>
<para>Emits a <link linkend="GtkTreeSortable-sort-column-changed"><type>“sort-column-changed”</type></link> signal on <parameter>sortable</parameter>
.</para>
<refsect3 id="gtk-tree-sortable-sort-column-changed.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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-get-sort-column-id" role="function">
<title>gtk_tree_sortable_get_sort_column_id&#160;()</title>
<indexterm zone="gtk-tree-sortable-get-sort-column-id"><primary>gtk_tree_sortable_get_sort_column_id</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_tree_sortable_get_sort_column_id (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>,
                                      <parameter><link linkend="gint"><type>gint</type></link> *sort_column_id</parameter>,
                                      <parameter><link linkend="GtkSortType"><type>GtkSortType</type></link> *order</parameter>);</programlisting>
<para>Fills in <parameter>sort_column_id</parameter>
 and <parameter>order</parameter>
 with the current sort column and the
order. It returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> unless the <parameter>sort_column_id</parameter>
 is 
<link linkend="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal></link> or 
<link linkend="GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</literal></link>.</para>
<refsect3 id="gtk-tree-sortable-get-sort-column-id.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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sort_column_id</para></entry>
<entry role="parameter_description"><para>The sort column id to be filled in. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>order</para></entry>
<entry role="parameter_description"><para>The <link linkend="GtkSortType"><type>GtkSortType</type></link> to be filled in. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-tree-sortable-get-sort-column-id.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the sort column is not one of the special sort
column ids.</para>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-set-sort-column-id" role="function">
<title>gtk_tree_sortable_set_sort_column_id&#160;()</title>
<indexterm zone="gtk-tree-sortable-set-sort-column-id"><primary>gtk_tree_sortable_set_sort_column_id</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_tree_sortable_set_sort_column_id (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>,
                                      <parameter><link linkend="gint"><type>gint</type></link> sort_column_id</parameter>,
                                      <parameter><link linkend="GtkSortType"><type>GtkSortType</type></link> order</parameter>);</programlisting>
<para>Sets the current sort column to be <parameter>sort_column_id</parameter>
. The <parameter>sortable</parameter>
 will
resort itself to reflect this change, after emitting a
<link linkend="GtkTreeSortable-sort-column-changed"><type>“sort-column-changed”</type></link> signal. <parameter>sort_column_id</parameter>
 may either be
a regular column id, or one of the following special values:</para>
<itemizedlist>
<listitem>
<para><link linkend="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal></link>: the default sort function
will be used, if it is set</para>
</listitem>
<listitem><para><link linkend="GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</literal></link>: no sorting will occur</para></listitem>
</itemizedlist>
<refsect3 id="gtk-tree-sortable-set-sort-column-id.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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sort_column_id</para></entry>
<entry role="parameter_description"><para>the sort column id to set</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>order</para></entry>
<entry role="parameter_description"><para>The sort order of the column</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-set-sort-func" role="function">
<title>gtk_tree_sortable_set_sort_func&#160;()</title>
<indexterm zone="gtk-tree-sortable-set-sort-func"><primary>gtk_tree_sortable_set_sort_func</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_tree_sortable_set_sort_func (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>,
                                 <parameter><link linkend="gint"><type>gint</type></link> sort_column_id</parameter>,
                                 <parameter><link linkend="GtkTreeIterCompareFunc"><type>GtkTreeIterCompareFunc</type></link> sort_func</parameter>,
                                 <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                                 <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>);</programlisting>
<para>Sets the comparison function used when sorting to be <parameter>sort_func</parameter>
. If the
current sort column id of <parameter>sortable</parameter>
 is the same as <parameter>sort_column_id</parameter>
, then 
the model will sort using this function.</para>
<refsect3 id="gtk-tree-sortable-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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sort_column_id</para></entry>
<entry role="parameter_description"><para>the sort column id to set the function for</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>sort_func</para></entry>
<entry role="parameter_description"><para>The comparison function</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>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>Destroy notifier of <parameter>user_data</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-set-default-sort-func" role="function">
<title>gtk_tree_sortable_set_default_sort_func&#160;()</title>
<indexterm zone="gtk-tree-sortable-set-default-sort-func"><primary>gtk_tree_sortable_set_default_sort_func</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_tree_sortable_set_default_sort_func
                               (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>,
                                <parameter><link linkend="GtkTreeIterCompareFunc"><type>GtkTreeIterCompareFunc</type></link> sort_func</parameter>,
                                <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>,
                                <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> destroy</parameter>);</programlisting>
<para>Sets the default comparison function used when sorting to be <parameter>sort_func</parameter>
.  
If the current sort column id of <parameter>sortable</parameter>
 is
<link linkend="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal></link>, then the model will sort using 
this function.</para>
<para>If <parameter>sort_func</parameter>
 is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, then there will be no default comparison function.
This means that once the model  has been sorted, it can’t go back to the
default state. In this case, when the current sort column id of <parameter>sortable</parameter>
 
is <link linkend="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS"><literal>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</literal></link>, the model will be unsorted.</para>
<refsect3 id="gtk-tree-sortable-set-default-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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</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>The comparison function</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>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>destroy</para></entry>
<entry role="parameter_description"><para>Destroy notifier of <parameter>user_data</parameter>
, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-tree-sortable-has-default-sort-func" role="function">
<title>gtk_tree_sortable_has_default_sort_func&#160;()</title>
<indexterm zone="gtk-tree-sortable-has-default-sort-func"><primary>gtk_tree_sortable_has_default_sort_func</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_tree_sortable_has_default_sort_func
                               (<parameter><link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable</parameter>);</programlisting>
<para>Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the model has a default sort function. This is used
primarily by GtkTreeViewColumns in order to determine if a model can 
go back to the default state, or not.</para>
<refsect3 id="gtk-tree-sortable-has-default-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>sortable</para></entry>
<entry role="parameter_description"><para>A <link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-tree-sortable-has-default-sort-func.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if the model has a default sort function</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="GtkTreeSortable.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkTreeSortable-struct" role="struct">
<title>GtkTreeSortable</title>
<indexterm zone="GtkTreeSortable-struct"><primary>GtkTreeSortable</primary></indexterm>
<programlisting language="C">typedef struct _GtkTreeSortable GtkTreeSortable;</programlisting>
</refsect2>
<refsect2 id="GtkTreeSortableIface" role="struct">
<title>struct GtkTreeSortableIface</title>
<indexterm zone="GtkTreeSortableIface"><primary>GtkTreeSortableIface</primary></indexterm>
<programlisting language="C">struct GtkTreeSortableIface {
  /* signals */
  void     (* sort_column_changed)   (GtkTreeSortable        *sortable);

  /* virtual table */
  gboolean (* get_sort_column_id)    (GtkTreeSortable        *sortable,
				      gint                   *sort_column_id,
				      GtkSortType            *order);
  void     (* set_sort_column_id)    (GtkTreeSortable        *sortable,
				      gint                    sort_column_id,
				      GtkSortType             order);
  void     (* set_sort_func)         (GtkTreeSortable        *sortable,
				      gint                    sort_column_id,
				      GtkTreeIterCompareFunc  sort_func,
				      gpointer                user_data,
				      GDestroyNotify          destroy);
  void     (* set_default_sort_func) (GtkTreeSortable        *sortable,
				      GtkTreeIterCompareFunc  sort_func,
				      gpointer                user_data,
				      GDestroyNotify          destroy);
  gboolean (* has_default_sort_func) (GtkTreeSortable        *sortable);
};
</programlisting>
<refsect3 id="GtkTreeSortableIface.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><structfield id="GtkTreeSortableIface.sort-column-changed">sort_column_changed</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted when the sort column or sort
order of sortable is changed.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkTreeSortableIface.get-sort-column-id">get_sort_column_id</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Fills in sort_column_id and order with the
current sort column and the order.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkTreeSortableIface.set-sort-column-id">set_sort_column_id</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Sets the current sort column to be
sort_column_id.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkTreeSortableIface.set-sort-func">set_sort_func</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Sets the comparison function used when sorting to
be sort_func.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkTreeSortableIface.set-default-sort-func">set_default_sort_func</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Sets the default comparison function used
when sorting to be sort_func.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkTreeSortableIface.has-default-sort-func">has_default_sort_func</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the model has a default sort
function.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS" role="macro">
<title>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</title>
<indexterm zone="GTK-TREE-SORTABLE-DEFAULT-SORT-COLUMN-ID:CAPS"><primary>GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID</primary></indexterm>
<programlisting language="C">#define GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID (-1)
</programlisting>
<para>The GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID can be used to make a
<link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> use the default sort function.</para>
<para>See also <link linkend="gtk-tree-sortable-set-sort-column-id"><function>gtk_tree_sortable_set_sort_column_id()</function></link></para>
</refsect2>
<refsect2 id="GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS" role="macro">
<title>GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</title>
<indexterm zone="GTK-TREE-SORTABLE-UNSORTED-SORT-COLUMN-ID:CAPS"><primary>GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID</primary></indexterm>
<programlisting language="C">#define GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID (-2)
</programlisting>
<para>The GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID can be used to make a
<link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> use no sorting.</para>
<para>See also <link linkend="gtk-tree-sortable-set-sort-column-id"><function>gtk_tree_sortable_set_sort_column_id()</function></link></para>
</refsect2>

</refsect1>
<refsect1 id="GtkTreeSortable.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkTreeSortable-sort-column-changed" role="signal"><title>The <literal>“sort-column-changed”</literal> signal</title>
<indexterm zone="GtkTreeSortable-sort-column-changed"><primary>GtkTreeSortable::sort-column-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkTreeSortable"><type>GtkTreeSortable</type></link> *sortable,
               <link linkend="gpointer"><type>gpointer</type></link>         user_data)</programlisting>
<para>The ::sort-column-changed signal is emitted when the sort column
or sort order of <parameter>sortable</parameter>
 is changed. The signal is emitted before
the contents of <parameter>sortable</parameter>
 are resorted.</para>
<refsect3 id="GtkTreeSortable-sort-column-changed.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>sortable</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2>
</refsect1>
<refsect1 id="GtkTreeSortable.see-also">
<title>See Also</title>
<para><link linkend="GtkTreeModel"><type>GtkTreeModel</type></link>, <link linkend="GtkTreeView"><type>GtkTreeView</type></link></para>

</refsect1>

</refentry>
