52
52
<a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="returnvalue">GtkTreePath</span></a> * <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-convert-child-path-to-path" title="gtk_tree_model_sort_convert_child_path_to_path ()">gtk_tree_model_sort_convert_child_path_to_path</a>
53
53
(<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
54
54
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="type">GtkTreePath</span></a> *child_path</code></em>);
55
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-convert-child-iter-to-iter" title="gtk_tree_model_sort_convert_child_iter_to_iter ()">gtk_tree_model_sort_convert_child_iter_to_iter</a>
55
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-convert-child-iter-to-iter" title="gtk_tree_model_sort_convert_child_iter_to_iter ()">gtk_tree_model_sort_convert_child_iter_to_iter</a>
56
56
(<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
57
57
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *sort_iter</code></em>,
58
58
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *child_iter</code></em>);
66
66
<span class="returnvalue">void</span> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-reset-default-sort-func" title="gtk_tree_model_sort_reset_default_sort_func ()">gtk_tree_model_sort_reset_default_sort_func</a>
67
67
(<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>);
68
68
<span class="returnvalue">void</span> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-clear-cache" title="gtk_tree_model_sort_clear_cache ()">gtk_tree_model_sort_clear_cache</a> (<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>);
69
<a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-iter-is-valid" title="gtk_tree_model_sort_iter_is_valid ()">gtk_tree_model_sort_iter_is_valid</a> (<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
69
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> <a class="link" href="GtkTreeModelSort.html#gtk-tree-model-sort-iter-is-valid" title="gtk_tree_model_sort_iter_is_valid ()">gtk_tree_model_sort_iter_is_valid</a> (<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
70
70
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *iter</code></em>);
73
73
<div class="refsect1" title="Object Hierarchy">
74
74
<a name="GtkTreeModelSort.object-hierarchy"></a><h2>Object Hierarchy</h2>
75
75
<pre class="synopsis">
76
<a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
76
<a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
77
77
+----GtkTreeModelSort
114
114
<div class="example">
115
<a name="id891181"></a><p class="title"><b>Example 23. Using a <span class="structname">GtkTreeModelSort</span></b></p>
115
<a name="id767224"></a><p class="title"><b>Example 23. Using a <span class="structname">GtkTreeModelSort</span></b></p>
116
116
<div class="example-contents">
117
117
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
140
140
<td class="listing_code"><pre class="programlisting"><span class="cbracket">{</span>
141
<span class="normal"> <a href="GtkTreeView.html">GtkTreeView</a> </span><span class="symbol">*</span><span class="normal">tree_view1</span><span class="symbol">;</span>
142
<span class="normal"> <a href="GtkTreeView.html">GtkTreeView</a> </span><span class="symbol">*</span><span class="normal">tree_view2</span><span class="symbol">;</span>
143
<span class="normal"> <a href="GtkTreeModel.html">GtkTreeModel</a> </span><span class="symbol">*</span><span class="normal">sort_model1</span><span class="symbol">;</span>
144
<span class="normal"> <a href="GtkTreeModel.html">GtkTreeModel</a> </span><span class="symbol">*</span><span class="normal">sort_model2</span><span class="symbol">;</span>
145
<span class="normal"> <a href="GtkTreeModel.html">GtkTreeModel</a> </span><span class="symbol">*</span><span class="normal">child_model</span><span class="symbol">;</span>
141
<span class="normal"> </span><span class="usertype">GtkTreeView</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">tree_view1</span><span class="symbol">;</span>
142
<span class="normal"> </span><span class="usertype">GtkTreeView</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">tree_view2</span><span class="symbol">;</span>
143
<span class="normal"> </span><span class="usertype">GtkTreeModel</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">sort_model1</span><span class="symbol">;</span>
144
<span class="normal"> </span><span class="usertype">GtkTreeModel</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">sort_model2</span><span class="symbol">;</span>
145
<span class="normal"> </span><span class="usertype">GtkTreeModel</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">child_model</span><span class="symbol">;</span>
146
146
<span class="normal"> </span><span class="comment">/* get the child model */</span>
147
147
<span class="normal"> child_model </span><span class="symbol">=</span><span class="normal"> </span><span class="function">get_my_model</span><span class="normal"> </span><span class="symbol">();</span>
148
148
<span class="normal"> </span><span class="comment">/* Create the first tree */</span>
177
177
<div class="example">
178
<a name="id857120"></a><p class="title"><b>Example 24. Accessing the child model of in a selection changed callback</b></p>
178
<a name="id762067"></a><p class="title"><b>Example 24. Accessing the child model of in a selection changed callback</b></p>
179
179
<div class="example-contents">
180
180
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
219
219
<td class="listing_code"><pre class="programlisting"><span class="type">void</span>
220
<span class="function">selection_changed</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GtkTreeSelection.html">GtkTreeSelection</a> </span><span class="symbol">*</span><span class="normal">selection</span><span class="symbol">,</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> data</span><span class="symbol">)</span>
220
<span class="function">selection_changed</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GtkTreeSelection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">selection</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">gpointer</span><span class="normal"> data</span><span class="symbol">)</span>
221
221
<span class="cbracket">{</span>
222
<span class="normal"> <a href="GtkTreeModel.html">GtkTreeModel</a> </span><span class="symbol">*</span><span class="normal">sort_model </span><span class="symbol">=</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
223
<span class="normal"> <a href="GtkTreeModel.html">GtkTreeModel</a> </span><span class="symbol">*</span><span class="normal">child_model</span><span class="symbol">;</span>
224
<span class="normal"> <a href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> sort_iter</span><span class="symbol">;</span>
225
<span class="normal"> <a href="GtkTreeModel.html#GtkTreeIter">GtkTreeIter</a> child_iter</span><span class="symbol">;</span>
226
<span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">some_data </span><span class="symbol">=</span><span class="normal"> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
222
<span class="normal"> </span><span class="usertype">GtkTreeModel</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">sort_model </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
223
<span class="normal"> </span><span class="usertype">GtkTreeModel</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">child_model</span><span class="symbol">;</span>
224
<span class="normal"> </span><span class="usertype">GtkTreeIter</span><span class="normal"> sort_iter</span><span class="symbol">;</span>
225
<span class="normal"> </span><span class="usertype">GtkTreeIter</span><span class="normal"> child_iter</span><span class="symbol">;</span>
226
<span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">some_data </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
227
227
<span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">modified_data</span><span class="symbol">;</span>
228
228
<span class="normal"> </span><span class="comment">/* Get the current selected row and the model. */</span>
229
229
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(!</span><span class="normal"> </span><span class="function"><a href="GtkTreeSelection.html#gtk-tree-selection-get-selected">gtk_tree_selection_get_selected</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">selection</span><span class="symbol">,</span>
237
237
<span class="normal"> COLUMN_1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">some_data</span><span class="symbol">,</span>
238
238
<span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">);</span>
239
239
<span class="normal"> modified_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function">change_the_data</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">some_data</span><span class="symbol">);</span>
240
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">some_data</span><span class="symbol">);</span>
240
<span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">some_data</span><span class="symbol">);</span>
241
241
<span class="normal"> </span><span class="comment">/* Get an iterator on the child model, instead of the sort model. */</span>
242
242
<span class="normal"> </span><span class="function"><a href="GtkTreeModelSort.html#gtk-tree-model-sort-convert-iter-to-child-iter">gtk_tree_model_sort_convert_iter_to_child_iter</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_TREE_MODEL_SORT</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">sort_model</span><span class="symbol">),</span>
243
243
<span class="normal"> </span><span class="symbol">&</span><span class="normal">child_iter</span><span class="symbol">,</span>
250
250
<span class="normal"> </span><span class="function"><a href="GtkListStore.html#gtk-list-store-set">gtk_list_store_set</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GTK_LIST_STORE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">child_model</span><span class="symbol">),</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">child_iter</span><span class="symbol">,</span>
251
251
<span class="normal"> COLUMN_1</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">modified_data</span><span class="symbol">,</span>
252
252
<span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">);</span>
253
<span class="normal"> </span><span class="function"><a href="/usr/share/gtk-doc/html/glib/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">modified_data</span><span class="symbol">);</span>
253
<span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">modified_data</span><span class="symbol">);</span>
254
254
<span class="cbracket">}</span></pre></td>
326
326
Converts <em class="parameter"><code>child_path</code></em> to a path relative to <em class="parameter"><code>tree_model_sort</code></em>. That is,
327
327
<em class="parameter"><code>child_path</code></em> points to a path in the child model. The returned path will
328
328
point to the same row in the sorted model. If <em class="parameter"><code>child_path</code></em> isn't a valid
329
path on the child model, then <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
329
path on the child model, then <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
331
331
<div class="variablelist"><table border="0">
332
332
<col align="left" valign="top">
345
345
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
346
<td> A newly allocated <a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="type">GtkTreePath</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
346
<td> A newly allocated <a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="type">GtkTreePath</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
353
353
<div class="refsect2" title="gtk_tree_model_sort_convert_child_iter_to_iter ()">
354
354
<a name="gtk-tree-model-sort-convert-child-iter-to-iter"></a><h3>gtk_tree_model_sort_convert_child_iter_to_iter ()</h3>
355
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gtk_tree_model_sort_convert_child_iter_to_iter
355
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gtk_tree_model_sort_convert_child_iter_to_iter
356
356
(<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
357
357
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *sort_iter</code></em>,
358
358
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *child_iter</code></em>);</pre>
360
360
Sets <em class="parameter"><code>sort_iter</code></em> to point to the row in <em class="parameter"><code>tree_model_sort</code></em> that corresponds to
361
the row pointed at by <em class="parameter"><code>child_iter</code></em>. If <em class="parameter"><code>sort_iter</code></em> was not set, <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
361
the row pointed at by <em class="parameter"><code>child_iter</code></em>. If <em class="parameter"><code>sort_iter</code></em> was not set, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>
362
362
is returned. Note: a boolean is only returned since 2.14.
364
364
<div class="variablelist"><table border="0">
383
383
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
384
<td> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>sort_iter</code></em> was set, i.e. if <em class="parameter"><code>sort_iter</code></em> is a
384
<td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>sort_iter</code></em> was set, i.e. if <em class="parameter"><code>sort_iter</code></em> is a
385
385
valid iterator pointer to a visible row in the child model.
399
399
That is, <em class="parameter"><code>sorted_path</code></em> points to a location in <em class="parameter"><code>tree_model_sort</code></em>. The
400
400
returned path will point to the same location in the model not being
401
401
sorted. If <em class="parameter"><code>sorted_path</code></em> does not point to a location in the child model,
402
<a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
402
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned.
404
404
<div class="variablelist"><table border="0">
405
405
<col align="left" valign="top">
418
418
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
419
<td> A newly allocated <a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="type">GtkTreePath</span></a>, or <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
419
<td> A newly allocated <a class="link" href="GtkTreeModel.html#GtkTreePath" title="GtkTreePath"><span class="type">GtkTreePath</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
498
498
<div class="refsect2" title="gtk_tree_model_sort_iter_is_valid ()">
499
499
<a name="gtk-tree-model-sort-iter-is-valid"></a><h3>gtk_tree_model_sort_iter_is_valid ()</h3>
500
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gtk_tree_model_sort_iter_is_valid (<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
500
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a> gtk_tree_model_sort_iter_is_valid (<em class="parameter"><code><a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort"><span class="type">GtkTreeModelSort</span></a> *tree_model_sort</code></em>,
501
501
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreeIter" title="GtkTreeIter"><span class="type">GtkTreeIter</span></a> *iter</code></em>);</pre>
529
529
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
530
<td> <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the iter is valid, <a href="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the iter is invalid.
530
<td> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the iter is valid, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the iter is invalid.