| 1 | /* gtktreesortable.c |
| 2 | * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <[email protected]> |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public |
| 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | |
| 19 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 20 | #include "gtktreesortable.h"cxx . . $ `<file>/gtk/deprecated/gtktreesortable.h`/ |
| 21 | #include "gtkmarshalers.h"cxx . . $ `<file>/build/gtk/gtkmarshalers.h`/ |
| 22 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 23 | |
| 24 | |
| 25 | G_GNUC_BEGIN_IGNORE_DEPRECATIONScxx . . $ `<external>/12741050725406041920/gmacros.h:771:9`! |
| 26 | |
| 27 | /** |
| 28 | * GtkTreeSortable: |
| 29 | * |
| 30 | * The interface for sortable models used by GtkTreeView |
| 31 | * |
| 32 | * `GtkTreeSortable` is an interface to be implemented by tree models which |
| 33 | * support sorting. The `GtkTreeView` uses the methods provided by this interface |
| 34 | * to sort the model. |
| 35 | * |
| 36 | * Deprecated: 4.10: There is no replacement for this interface. You should |
| 37 | * use [[email protected]] to wrap your list model instead |
| 38 | */ |
| 39 | |
| 40 | |
| 41 | static void gtk_tree_sortable_base_initcxx . . $ gtk_tree_sortable_base_init(5d22bdacc48458e8). (gpointercxx . . $ gpointer# g_class); |
| 42 | |
| 43 | GTypecxx . . $ GType# |
| 44 | gtk_tree_sortable_get_typecxx . . $ gtk_tree_sortable_get_type(f708dce9a8856c70). (void) |
| 45 | { |
| 46 | static GTypecxx . . $ GType# tree_sortable_type = 0; |
| 47 | |
| 48 | if (! tree_sortable_type) |
| 49 | { |
| 50 | const GTypeInfocxx . . $ GTypeInfo# tree_sortable_info = |
| 51 | { |
| 52 | sizeof (GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface#), /* class_size */ |
| 53 | gtk_tree_sortable_base_initcxx . . $ gtk_tree_sortable_base_init(5d22bdacc48458e8)., /* base_init */ |
| 54 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* base_finalize */ |
| 55 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 56 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* class_finalize */ |
| 57 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, /* class_data */ |
| 58 | 0, |
| 59 | 0, |
| 60 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 61 | }; |
| 62 | |
| 63 | tree_sortable_type = |
| 64 | g_type_register_staticcxx . . $ g_type_register_static(805a40cfa272e950). (G_TYPE_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:78:9`!, I_cxx . . $ `gdk/gdkprivate.h:35:9`!("GtkTreeSortable"), |
| 65 | &tree_sortable_info, 0); |
| 66 | |
| 67 | g_type_interface_add_prerequisitecxx . . $ g_type_interface_add_prerequisite(6714b5f2551eea49). (tree_sortable_type, GTK_TYPE_TREE_MODELcxx . . $ `gtk/deprecated/gtktreemodel.h:29:9`!); |
| 68 | } |
| 69 | |
| 70 | return tree_sortable_type; |
| 71 | } |
| 72 | |
| 73 | static void |
| 74 | gtk_tree_sortable_base_initcxx . . $ gtk_tree_sortable_base_init(5d22bdacc48458e8). (gpointercxx . . $ gpointer# g_class) |
| 75 | { |
| 76 | static gbooleancxx . . $ gboolean# initialized = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 77 | |
| 78 | if (! initialized) |
| 79 | { |
| 80 | /** |
| 81 | * GtkTreeSortable::sort-column-changed: |
| 82 | * @sortable: the object on which the signal is emitted |
| 83 | * |
| 84 | * The ::sort-column-changed signal is emitted when the sort column |
| 85 | * or sort order of @sortable is changed. The signal is emitted before |
| 86 | * the contents of @sortable are resorted. |
| 87 | */ |
| 88 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("sort-column-changed"), |
| 89 | GTK_TYPE_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:31:9`!, |
| 90 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 91 | G_STRUCT_OFFSETcxx . . $ `<external>/12741050725406041920/gmacros.h:1005:9`! (GtkTreeSortableIface, sort_column_changed), |
| 92 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 93 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 94 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 0); |
| 95 | initialized = TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * gtk_tree_sortable_sort_column_changed: |
| 101 | * @sortable: A `GtkTreeSortable` |
| 102 | * |
| 103 | * Emits a `GtkTreeSortable::sort-column-changed` signal on @sortable. |
| 104 | * |
| 105 | * Deprecated: 4.10 |
| 106 | */ |
| 107 | void |
| 108 | gtk_tree_sortable_sort_column_changedcxx . . $ gtk_tree_sortable_sort_column_changed(72dac639dde31f62). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable) |
| 109 | { |
| 110 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable)); |
| 111 | |
| 112 | g_signal_emit_by_namecxx . . $ g_signal_emit_by_name(1ac911bdc4e9a14d). (sortable, "sort-column-changed"); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * gtk_tree_sortable_get_sort_column_id: |
| 117 | * @sortable: A `GtkTreeSortable` |
| 118 | * @sort_column_id: (out): The sort column id to be filled in |
| 119 | * @order: (out): The `GtkSortType` to be filled in |
| 120 | * |
| 121 | * Fills in @sort_column_id and @order with the current sort column and the |
| 122 | * order. It returns %TRUE unless the @sort_column_id is |
| 123 | * %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or |
| 124 | * %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID. |
| 125 | * |
| 126 | * Returns: %TRUE if the sort column is not one of the special sort |
| 127 | * column ids. |
| 128 | * |
| 129 | * Deprecated: 4.10 |
| 130 | **/ |
| 131 | gbooleancxx . . $ gboolean# |
| 132 | gtk_tree_sortable_get_sort_column_idcxx . . $ gtk_tree_sortable_get_sort_column_id(5c44120c50b9928e). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable, |
| 133 | int *sort_column_id, |
| 134 | GtkSortTypecxx . . $ GtkSortType# *order) |
| 135 | { |
| 136 | GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface# *iface; |
| 137 | |
| 138 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 139 | |
| 140 | iface = GTK_TREE_SORTABLE_GET_IFACEcxx . . $ `gtk/deprecated/gtktreesortable.h:34:9`! (sortable); |
| 141 | |
| 142 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (iface != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 143 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (iface->get_sort_column_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 144 | |
| 145 | return (* iface->get_sort_column_idcxx . . $ _GtkTreeSortableIface#get_sort_column_id.) (sortable, sort_column_id, order); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * gtk_tree_sortable_set_sort_column_id: |
| 150 | * @sortable: A `GtkTreeSortable` |
| 151 | * @sort_column_id: the sort column id to set |
| 152 | * @order: The sort order of the column |
| 153 | * |
| 154 | * Sets the current sort column to be @sort_column_id. The @sortable will |
| 155 | * resort itself to reflect this change, after emitting a |
| 156 | * `GtkTreeSortable::sort-column-changed` signal. @sort_column_id may either be |
| 157 | * a regular column id, or one of the following special values: |
| 158 | * |
| 159 | * - %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function |
| 160 | * will be used, if it is set |
| 161 | * |
| 162 | * - %GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur |
| 163 | * |
| 164 | * Deprecated: 4.10 |
| 165 | */ |
| 166 | void |
| 167 | gtk_tree_sortable_set_sort_column_idcxx . . $ gtk_tree_sortable_set_sort_column_id(a357a03a8dbf1415). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable, |
| 168 | int sort_column_id, |
| 169 | GtkSortTypecxx . . $ GtkSortType# order) |
| 170 | { |
| 171 | GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface# *iface; |
| 172 | |
| 173 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable)); |
| 174 | |
| 175 | iface = GTK_TREE_SORTABLE_GET_IFACEcxx . . $ `gtk/deprecated/gtktreesortable.h:34:9`! (sortable); |
| 176 | |
| 177 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 178 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface->set_sort_column_id != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 179 | |
| 180 | (* iface->set_sort_column_idcxx . . $ _GtkTreeSortableIface#set_sort_column_id.) (sortable, sort_column_id, order); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * gtk_tree_sortable_set_sort_func: |
| 185 | * @sortable: A `GtkTreeSortable` |
| 186 | * @sort_column_id: the sort column id to set the function for |
| 187 | * @sort_func: (scope notified) (closure user_data) (destroy destroy): The comparison function |
| 188 | * @user_data: User data to pass to @sort_func |
| 189 | * @destroy: (nullable): Destroy notifier of @user_data |
| 190 | * |
| 191 | * Sets the comparison function used when sorting to be @sort_func. If the |
| 192 | * current sort column id of @sortable is the same as @sort_column_id, then |
| 193 | * the model will sort using this function. |
| 194 | * |
| 195 | * Deprecated: 4.10 |
| 196 | */ |
| 197 | void |
| 198 | gtk_tree_sortable_set_sort_funccxx . . $ gtk_tree_sortable_set_sort_func(7d3013e31095ff85). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable, |
| 199 | int sort_column_id, |
| 200 | GtkTreeIterCompareFunccxx . . $ GtkTreeIterCompareFunc# sort_func, |
| 201 | gpointercxx . . $ gpointer# user_data, |
| 202 | GDestroyNotifycxx . . $ GDestroyNotify# destroy) |
| 203 | { |
| 204 | GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface# *iface; |
| 205 | |
| 206 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable)); |
| 207 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (sort_func != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 208 | |
| 209 | iface = GTK_TREE_SORTABLE_GET_IFACEcxx . . $ `gtk/deprecated/gtktreesortable.h:34:9`! (sortable); |
| 210 | |
| 211 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 212 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface->set_sort_func != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 213 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (sort_column_id >= 0); |
| 214 | |
| 215 | (* iface->set_sort_funccxx . . $ _GtkTreeSortableIface#set_sort_func.) (sortable, sort_column_id, sort_func, user_data, destroy); |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * gtk_tree_sortable_set_default_sort_func: |
| 220 | * @sortable: A `GtkTreeSortable` |
| 221 | * @sort_func: (scope notified) (closure user_data) (destroy destroy): The comparison function |
| 222 | * @user_data: User data to pass to @sort_func |
| 223 | * @destroy: (nullable): Destroy notifier of @user_data |
| 224 | * |
| 225 | * Sets the default comparison function used when sorting to be @sort_func. |
| 226 | * If the current sort column id of @sortable is |
| 227 | * %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using |
| 228 | * this function. |
| 229 | * |
| 230 | * If @sort_func is %NULL, then there will be no default comparison function. |
| 231 | * This means that once the model has been sorted, it can’t go back to the |
| 232 | * default state. In this case, when the current sort column id of @sortable |
| 233 | * is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. |
| 234 | * |
| 235 | * Deprecated: 4.10 |
| 236 | */ |
| 237 | void |
| 238 | gtk_tree_sortable_set_default_sort_funccxx . . $ gtk_tree_sortable_set_default_sort_func(fd17765ee1d63cb8). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable, |
| 239 | GtkTreeIterCompareFunccxx . . $ GtkTreeIterCompareFunc# sort_func, |
| 240 | gpointercxx . . $ gpointer# user_data, |
| 241 | GDestroyNotifycxx . . $ GDestroyNotify# destroy) |
| 242 | { |
| 243 | GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface# *iface; |
| 244 | |
| 245 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable)); |
| 246 | |
| 247 | iface = GTK_TREE_SORTABLE_GET_IFACEcxx . . $ `gtk/deprecated/gtktreesortable.h:34:9`! (sortable); |
| 248 | |
| 249 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 250 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (iface->set_default_sort_func != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 251 | |
| 252 | (* iface->set_default_sort_funccxx . . $ _GtkTreeSortableIface#set_default_sort_func.) (sortable, sort_func, user_data, destroy); |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * gtk_tree_sortable_has_default_sort_func: |
| 257 | * @sortable: A `GtkTreeSortable` |
| 258 | * |
| 259 | * Returns %TRUE if the model has a default sort function. This is used |
| 260 | * primarily by GtkTreeViewColumns in order to determine if a model can |
| 261 | * go back to the default state, or not. |
| 262 | * |
| 263 | * Returns: %TRUE, if the model has a default sort function |
| 264 | * |
| 265 | * Deprecated: 4.10 |
| 266 | */ |
| 267 | gbooleancxx . . $ gboolean# |
| 268 | gtk_tree_sortable_has_default_sort_funccxx . . $ gtk_tree_sortable_has_default_sort_func(39f4e87cbcd901ae). (GtkTreeSortablecxx . . $ GtkTreeSortable# *sortable) |
| 269 | { |
| 270 | GtkTreeSortableIfacecxx . . $ GtkTreeSortableIface# *iface; |
| 271 | |
| 272 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_TREE_SORTABLEcxx . . $ `gtk/deprecated/gtktreesortable.h:33:9`! (sortable), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 273 | |
| 274 | iface = GTK_TREE_SORTABLE_GET_IFACEcxx . . $ `gtk/deprecated/gtktreesortable.h:34:9`! (sortable); |
| 275 | |
| 276 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (iface != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 277 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (iface->has_default_sort_func != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 278 | |
| 279 | return (* iface->has_default_sort_funccxx . . $ _GtkTreeSortableIface#has_default_sort_func.) (sortable); |
| 280 | } |