| 1 | /* |
| 2 | * Copyright © 2019 Matthias Clasen |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 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 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * Authors: Matthias Clasen <[email protected]> |
| 18 | */ |
| 19 | |
| 20 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 21 | |
| 22 | #include "gtksorterprivate.h"cxx . . $ `<file>/gtk/gtksorterprivate.h`/ |
| 23 | |
| 24 | #include <glib/gi18n-lib.h> |
| 25 | #include "gtktypebuiltins.h"cxx . . $ `<file>/build/gtk/gtktypebuiltins.h`/ |
| 26 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 27 | |
| 28 | /** |
| 29 | * GtkSorter: |
| 30 | * |
| 31 | * Describes sorting criteria for a [[email protected]]. |
| 32 | * |
| 33 | * Its primary user is [[email protected]] |
| 34 | * |
| 35 | * The model will use a sorter to determine the order in which |
| 36 | * its items should appear by calling [[email protected]] |
| 37 | * for pairs of items. |
| 38 | * |
| 39 | * Sorters may change their sorting behavior through their lifetime. |
| 40 | * In that case, they will emit the [[email protected]::changed] signal |
| 41 | * to notify that the sort order is no longer valid and should be updated |
| 42 | * by calling gtk_sorter_compare() again. |
| 43 | * |
| 44 | * GTK provides various pre-made sorter implementations for common sorting |
| 45 | * operations. [[email protected]] has built-in support for sorting lists |
| 46 | * via the [[email protected]:sorter] property, where the user can |
| 47 | * change the sorting by clicking on list headers. |
| 48 | * |
| 49 | * Of course, in particular for large lists, it is also possible to subclass |
| 50 | * `GtkSorter` and provide one's own sorter. |
| 51 | */ |
| 52 | |
| 53 | typedef struct _GtkSorterPrivatecxx . . $ _GtkSorterPrivate# GtkSorterPrivatecxx . . $ GtkSorterPrivate#; |
| 54 | typedef struct _GtkDefaultSortKeyscxx . . $ _GtkDefaultSortKeys# GtkDefaultSortKeyscxx . . $ GtkDefaultSortKeys#; |
| 55 | |
| 56 | struct _GtkSorterPrivatecxx . . $ _GtkSorterPrivate# |
| 57 | { |
| 58 | GtkSortKeyscxx . . $ GtkSortKeys# *keyscxx . . $ _GtkSorterPrivate#keys.; |
| 59 | }; |
| 60 | |
| 61 | struct _GtkDefaultSortKeyscxx . . $ _GtkDefaultSortKeys# |
| 62 | { |
| 63 | GtkSortKeyscxx . . $ GtkSortKeys# keyscxx . . $ _GtkDefaultSortKeys#keys.; |
| 64 | GtkSortercxx . . $ GtkSorter# *sortercxx . . $ _GtkDefaultSortKeys#sorter.; |
| 65 | }; |
| 66 | |
| 67 | enumcxx . . $ $anonymous_type_cb1c1a018cf00b3c_0# { |
| 68 | CHANGEDcxx . . $ CHANGED., |
| 69 | LAST_SIGNALcxx . . $ LAST_SIGNAL. |
| 70 | }; |
| 71 | |
| 72 | G_DEFINE_TYPE_WITH_PRIVATEcxx . . $ `<external>/9567554376676449156/gtype.h:1876:9`! (GtkSorter, gtk_sorter, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!) |
| 73 | |
| 74 | static guintcxx . . $ guint# signalscxx . . $ signals.[LAST_SIGNALcxx . . $ LAST_SIGNAL.] = { 0 }; |
| 75 | |
| 76 | static GtkOrderingcxx . . $ GtkOrdering# |
| 77 | gtk_sorter_default_comparecxx . . $ gtk_sorter_default_compare(ae33962cdb89a5a3). (GtkSortercxx . . $ GtkSorter# *self, |
| 78 | gpointercxx . . $ gpointer# item1, |
| 79 | gpointercxx . . $ gpointer# item2) |
| 80 | { |
| 81 | g_criticalcxx . . $ `<external>/5169755362661750954/gmessages.h:337:9`! ("Sorter of type '%s' does not implement GtkSorter::compare", G_OBJECT_TYPE_NAMEcxx . . $ `<external>/1341695927569185362/gobject.h:108:9`! (self)); |
| 82 | |
| 83 | return GTK_ORDERING_EQUALcxx . . $ GTK_ORDERING_EQUAL.; |
| 84 | } |
| 85 | |
| 86 | static GtkSorterOrdercxx . . $ GtkSorterOrder# |
| 87 | gtk_sorter_default_get_ordercxx . . $ gtk_sorter_default_get_order(4b53baa32927438b). (GtkSortercxx . . $ GtkSorter# *self) |
| 88 | { |
| 89 | return GTK_SORTER_ORDER_PARTIALcxx . . $ GTK_SORTER_ORDER_PARTIAL.; |
| 90 | } |
| 91 | |
| 92 | static void |
| 93 | gtk_sorter_disposecxx . . $ gtk_sorter_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 94 | { |
| 95 | GtkSortercxx . . $ GtkSorter# *self = GTK_SORTERcxx . . $ GTK_SORTER(cf32dcc2d2e89335). (object); |
| 96 | GtkSorterPrivatecxx . . $ GtkSorterPrivate# *priv = gtk_sorter_get_instance_privatecxx . . $ gtk_sorter_get_instance_private(df87a86ed0a12d20). (self); |
| 97 | |
| 98 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&priv->keys, gtk_sort_keys_unref); |
| 99 | |
| 100 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_sorter_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 101 | } |
| 102 | |
| 103 | static void |
| 104 | gtk_sorter_class_initcxx . . $ gtk_sorter_class_init(4f364ec82dc996db). (GtkSorterClasscxx . . $ GtkSorterClass# *class) |
| 105 | { |
| 106 | GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (class); |
| 107 | |
| 108 | object_class->disposecxx . . $ _GObjectClass#dispose. = gtk_sorter_disposecxx . . $ gtk_sorter_dispose(6087475fa43034d3).; |
| 109 | |
| 110 | class->comparecxx . . $ _GtkSorterClass#compare. = gtk_sorter_default_comparecxx . . $ gtk_sorter_default_compare(ae33962cdb89a5a3).; |
| 111 | class->get_ordercxx . . $ _GtkSorterClass#get_order. = gtk_sorter_default_get_ordercxx . . $ gtk_sorter_default_get_order(4b53baa32927438b).; |
| 112 | |
| 113 | /** |
| 114 | * GtkSorter::changed: |
| 115 | * @self: The `GtkSorter` |
| 116 | * @change: how the sorter changed |
| 117 | * |
| 118 | * Emitted whenever the sorter changed. |
| 119 | * |
| 120 | * Users of the sorter should then update the sort order |
| 121 | * again via gtk_sorter_compare(). |
| 122 | * |
| 123 | * [[email protected]] handles this signal automatically. |
| 124 | * |
| 125 | * Depending on the @change parameter, it may be possible to update |
| 126 | * the sort order without a full resorting. Refer to the |
| 127 | * [[email protected]] documentation for details. |
| 128 | */ |
| 129 | signalscxx . . $ signals.[CHANGEDcxx . . $ CHANGED.] = |
| 130 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("changed"), |
| 131 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 132 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 133 | 0, |
| 134 | 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`!, |
| 135 | g_cclosure_marshal_VOID__ENUMcxx . . $ g_cclosure_marshal_VOID__ENUM(cba270afb0f82555)., |
| 136 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 1, |
| 137 | GTK_TYPE_SORTER_CHANGEcxx . . $ `build/gtk/gtktypebuiltins.h:316:9`!); |
| 138 | g_signal_set_va_marshallercxx . . $ g_signal_set_va_marshaller(4fd870c04a9d6fe7). (signalscxx . . $ signals.[CHANGEDcxx . . $ CHANGED.], |
| 139 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 140 | g_cclosure_marshal_VOID__ENUMvcxx . . $ g_cclosure_marshal_VOID__ENUMv(d309f4be92d1737c).); |
| 141 | } |
| 142 | |
| 143 | static void |
| 144 | gtk_sorter_initcxx . . $ gtk_sorter_init(729b9824b0e36020). (GtkSortercxx . . $ GtkSorter# *self) |
| 145 | { |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * gtk_sorter_compare: |
| 150 | * @self: a `GtkSorter` |
| 151 | * @item1: (type GObject) (transfer none): first item to compare |
| 152 | * @item2: (type GObject) (transfer none): second item to compare |
| 153 | * |
| 154 | * Compares two given items according to the sort order implemented |
| 155 | * by the sorter. |
| 156 | * |
| 157 | * Sorters implement a partial order: |
| 158 | * |
| 159 | * * It is reflexive, ie a = a |
| 160 | * * It is antisymmetric, ie if a < b and b < a, then a = b |
| 161 | * * It is transitive, ie given any 3 items with a ≤ b and b ≤ c, |
| 162 | * then a ≤ c |
| 163 | * |
| 164 | * The sorter may signal it conforms to additional constraints |
| 165 | * via the return value of [[email protected]_order]. |
| 166 | * |
| 167 | * Returns: %GTK_ORDERING_EQUAL if @item1 == @item2, |
| 168 | * %GTK_ORDERING_SMALLER if @item1 < @item2, |
| 169 | * %GTK_ORDERING_LARGER if @item1 > @item2 |
| 170 | */ |
| 171 | GtkOrderingcxx . . $ GtkOrdering# |
| 172 | gtk_sorter_comparecxx . . $ gtk_sorter_compare(ae33962cdb89a5a3). (GtkSortercxx . . $ GtkSorter# *self, |
| 173 | gpointercxx . . $ gpointer# item1, |
| 174 | gpointercxx . . $ gpointer# item2) |
| 175 | { |
| 176 | GtkOrderingcxx . . $ GtkOrdering# result; |
| 177 | |
| 178 | /* We turn this off because gtk_sorter_compare() is called so much that it's too expensive */ |
| 179 | /* g_return_val_if_fail (GTK_IS_SORTER (self), GTK_ORDERING_EQUAL); */ |
| 180 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (item1 && item2, GTK_ORDERING_EQUAL); |
| 181 | |
| 182 | if (item1 == item2) |
| 183 | return GTK_ORDERING_EQUALcxx . . $ GTK_ORDERING_EQUAL.; |
| 184 | |
| 185 | result = GTK_SORTER_GET_CLASScxx . . $ GTK_SORTER_GET_CLASS(e026ce8a393ad6dd). (self)->comparecxx . . $ _GtkSorterClass#compare. (self, item1, item2); |
| 186 | |
| 187 | #ifdef G_ENABLE_DEBUGcxx . . $ `<built-in>:419:9`! |
| 188 | if (result < -1 || result > 1) |
| 189 | { |
| 190 | g_criticalcxx . . $ `<external>/5169755362661750954/gmessages.h:337:9`! ("A sorter of type \"%s\" returned %d, which is not a valid GtkOrdering result.\n" |
| 191 | "Did you forget to call gtk_ordering_from_cmpfunc()?", |
| 192 | G_OBJECT_TYPE_NAMEcxx . . $ `<external>/1341695927569185362/gobject.h:108:9`! (self), (int) result); |
| 193 | } |
| 194 | #endif |
| 195 | |
| 196 | return result; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * gtk_sorter_get_order: |
| 201 | * @self: a `GtkSorter` |
| 202 | * |
| 203 | * Gets the order that @self conforms to. |
| 204 | * |
| 205 | * See [[email protected]] for details |
| 206 | * of the possible return values. |
| 207 | * |
| 208 | * This function is intended to allow optimizations. |
| 209 | * |
| 210 | * Returns: The order |
| 211 | */ |
| 212 | GtkSorterOrdercxx . . $ GtkSorterOrder# |
| 213 | gtk_sorter_get_ordercxx . . $ gtk_sorter_get_order(4b53baa32927438b). (GtkSortercxx . . $ GtkSorter# *self) |
| 214 | { |
| 215 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_SORTER (self), GTK_SORTER_ORDER_PARTIAL); |
| 216 | |
| 217 | return GTK_SORTER_GET_CLASScxx . . $ GTK_SORTER_GET_CLASS(e026ce8a393ad6dd). (self)->get_ordercxx . . $ _GtkSorterClass#get_order. (self); |
| 218 | } |
| 219 | |
| 220 | static int |
| 221 | gtk_default_sort_keys_comparecxx . . $ gtk_default_sort_keys_compare(b8f62d2ccbc12f7d). (gconstpointercxx . . $ gconstpointer# a, |
| 222 | gconstpointercxx . . $ gconstpointer# b, |
| 223 | gpointercxx . . $ gpointer# data) |
| 224 | { |
| 225 | GtkDefaultSortKeyscxx . . $ GtkDefaultSortKeys# *self = data; |
| 226 | gpointercxx . . $ gpointer# *key_a = (gpointercxx . . $ gpointer# *) a; |
| 227 | gpointercxx . . $ gpointer# *key_b = (gpointercxx . . $ gpointer# *) b; |
| 228 | |
| 229 | return gtk_sorter_comparecxx . . $ gtk_sorter_compare(ae33962cdb89a5a3). (self->sortercxx . . $ _GtkDefaultSortKeys#sorter., *key_a, *key_b); |
| 230 | } |
| 231 | |
| 232 | static void |
| 233 | gtk_default_sort_keys_freecxx . . $ gtk_default_sort_keys_free(67e512b7258cdc6c). (GtkSortKeyscxx . . $ GtkSortKeys# *keys) |
| 234 | { |
| 235 | GtkDefaultSortKeyscxx . . $ GtkDefaultSortKeys# *self = (GtkDefaultSortKeyscxx . . $ GtkDefaultSortKeys# *) keys; |
| 236 | |
| 237 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (self->sortercxx . . $ _GtkDefaultSortKeys#sorter.); |
| 238 | |
| 239 | g_freecxx . . $ g_free(5d22bdacc48458e8). (self); |
| 240 | } |
| 241 | |
| 242 | static gbooleancxx . . $ gboolean# |
| 243 | gtk_default_sort_keys_is_compatiblecxx . . $ gtk_default_sort_keys_is_compatible(4070d1c6f051bcd2). (GtkSortKeyscxx . . $ GtkSortKeys# *keys, |
| 244 | GtkSortKeyscxx . . $ GtkSortKeys# *other) |
| 245 | { |
| 246 | if (keys->klasscxx . . $ _GtkSortKeys#klass. != other->klasscxx . . $ _GtkSortKeys#klass.) |
| 247 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 248 | |
| 249 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 250 | } |
| 251 | |
| 252 | static void |
| 253 | gtk_default_sort_keys_init_keycxx . . $ gtk_default_sort_keys_init_key(57c02422f6b769d). (GtkSortKeyscxx . . $ GtkSortKeys# *self, |
| 254 | gpointercxx . . $ gpointer# item, |
| 255 | gpointercxx . . $ gpointer# key_memory) |
| 256 | { |
| 257 | gpointercxx . . $ gpointer# *key = (gpointercxx . . $ gpointer# *) key_memory; |
| 258 | |
| 259 | *key = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (item); |
| 260 | } |
| 261 | |
| 262 | static void |
| 263 | gtk_default_sort_keys_clear_keycxx . . $ gtk_default_sort_keys_clear_key(fc995e6bdefb588e). (GtkSortKeyscxx . . $ GtkSortKeys# *self, |
| 264 | gpointercxx . . $ gpointer# key_memory) |
| 265 | { |
| 266 | gpointercxx . . $ gpointer# *key = (gpointercxx . . $ gpointer# *) key_memory; |
| 267 | |
| 268 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (*key); |
| 269 | } |
| 270 | |
| 271 | static const GtkSortKeysClasscxx . . $ GtkSortKeysClass# GTK_DEFAULT_SORT_KEYS_CLASScxx . . $ GTK_DEFAULT_SORT_KEYS_CLASS. = |
| 272 | { |
| 273 | gtk_default_sort_keys_freecxx . . $ gtk_default_sort_keys_free(67e512b7258cdc6c)., |
| 274 | gtk_default_sort_keys_comparecxx . . $ gtk_default_sort_keys_compare(b8f62d2ccbc12f7d)., |
| 275 | gtk_default_sort_keys_is_compatiblecxx . . $ gtk_default_sort_keys_is_compatible(4070d1c6f051bcd2)., |
| 276 | gtk_default_sort_keys_init_keycxx . . $ gtk_default_sort_keys_init_key(57c02422f6b769d)., |
| 277 | gtk_default_sort_keys_clear_keycxx . . $ gtk_default_sort_keys_clear_key(fc995e6bdefb588e)., |
| 278 | }; |
| 279 | |
| 280 | /*<private> |
| 281 | * gtk_sorter_get_keys: |
| 282 | * @self: a `GtkSorter` |
| 283 | * |
| 284 | * Gets a `GtkSortKeys` that can be used as an alternative to |
| 285 | * @self for faster sorting. |
| 286 | * |
| 287 | * The sort keys can change every time [[email protected]::changed] |
| 288 | * is emitted. When the keys change, you should redo all comparisons |
| 289 | * with the new keys. |
| 290 | * |
| 291 | * When [[email protected]_compatible] for the old and new keys |
| 292 | * returns %TRUE, you can reuse keys you generated previously. |
| 293 | * |
| 294 | * Returns: (transfer full): the sort keys to sort with |
| 295 | */ |
| 296 | GtkSortKeyscxx . . $ GtkSortKeys# * |
| 297 | gtk_sorter_get_keyscxx . . $ gtk_sorter_get_keys(d19169138b9ed4a1). (GtkSortercxx . . $ GtkSorter# *self) |
| 298 | { |
| 299 | GtkSorterPrivatecxx . . $ GtkSorterPrivate# *priv = gtk_sorter_get_instance_privatecxx . . $ gtk_sorter_get_instance_private(df87a86ed0a12d20). (self); |
| 300 | GtkDefaultSortKeyscxx . . $ GtkDefaultSortKeys# *fallback; |
| 301 | |
| 302 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_SORTER (self), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 303 | |
| 304 | if (priv->keyscxx . . $ _GtkSorterPrivate#keys.) |
| 305 | return gtk_sort_keys_refcxx . . $ gtk_sort_keys_ref(ca8f815f407c0735). (priv->keyscxx . . $ _GtkSorterPrivate#keys.); |
| 306 | |
| 307 | fallback = gtk_sort_keys_newcxx . . $ `gtk/gtksortkeysprivate.h:56:9`! (GtkDefaultSortKeys, >K_DEFAULT_SORT_KEYS_CLASS, sizeof (gpointer), G_ALIGNOFcxx . . $ `<external>/12741050725406041920/gmacros.h:1063:9`! (gpointer)); |
| 308 | fallback->sortercxx . . $ _GtkDefaultSortKeys#sorter. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (self); |
| 309 | |
| 310 | return (GtkSortKeyscxx . . $ GtkSortKeys# *) fallback; |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * gtk_sorter_changed: |
| 315 | * @self: a `GtkSorter` |
| 316 | * @change: How the sorter changed |
| 317 | * |
| 318 | * Notifies all users of the sorter that it has changed. |
| 319 | * |
| 320 | * This emits the [[email protected]::changed] signal. Users |
| 321 | * of the sorter should then update the sort order via |
| 322 | * [[email protected]]. |
| 323 | * |
| 324 | * Depending on the @change parameter, it may be possible to |
| 325 | * update the sort order without a full resorting. Refer to |
| 326 | * the [[email protected]] documentation for details. |
| 327 | * |
| 328 | * This function is intended for implementers of `GtkSorter` |
| 329 | * subclasses and should not be called from other functions. |
| 330 | */ |
| 331 | void |
| 332 | gtk_sorter_changedcxx . . $ gtk_sorter_changed(d5dbcecf33922a0). (GtkSortercxx . . $ GtkSorter# *self, |
| 333 | GtkSorterChangecxx . . $ GtkSorterChange# change) |
| 334 | { |
| 335 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SORTER (self)); |
| 336 | |
| 337 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (self, signalscxx . . $ signals.[CHANGEDcxx . . $ CHANGED.], 0, change); |
| 338 | } |
| 339 | |
| 340 | /*<private> |
| 341 | * gtk_sorter_changed_with_keys: |
| 342 | * @self: a `GtkSorter` |
| 343 | * @change: How the sorter changed |
| 344 | * @keys: (not nullable) (transfer full): New keys to use |
| 345 | * |
| 346 | * Updates the sorter's keys to @keys and then calls gtk_sorter_changed(). |
| 347 | * |
| 348 | * If you do not want to update the keys, call that function instead. |
| 349 | * |
| 350 | * This function should also be called in your_sorter_init() to initialize |
| 351 | * the keys to use with your sorter. |
| 352 | */ |
| 353 | void |
| 354 | gtk_sorter_changed_with_keyscxx . . $ gtk_sorter_changed_with_keys(e83fe4b799fa6bef). (GtkSortercxx . . $ GtkSorter# *self, |
| 355 | GtkSorterChangecxx . . $ GtkSorterChange# change, |
| 356 | GtkSortKeyscxx . . $ GtkSortKeys# *keys) |
| 357 | { |
| 358 | GtkSorterPrivatecxx . . $ GtkSorterPrivate# *priv = gtk_sorter_get_instance_privatecxx . . $ gtk_sorter_get_instance_private(df87a86ed0a12d20). (self); |
| 359 | |
| 360 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SORTER (self)); |
| 361 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (keys != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 362 | |
| 363 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&priv->keys, gtk_sort_keys_unref); |
| 364 | priv->keyscxx . . $ _GtkSorterPrivate#keys. = keys; |
| 365 | |
| 366 | gtk_sorter_changedcxx . . $ gtk_sorter_changed(d5dbcecf33922a0). (self, change); |
| 367 | } |
| 368 | |
| 369 | /* See the comment in gtkenums.h as to why we need to play |
| 370 | * games with the introspection scanner for static inline |
| 371 | * functions |
| 372 | */ |
| 373 | #ifdef __GI_SCANNER__ |
| 374 | /** |
| 375 | * gtk_ordering_from_cmpfunc: (skip) |
| 376 | * @cmpfunc_result: Result of a comparison function |
| 377 | * |
| 378 | * Converts the result of a `GCompareFunc` like strcmp() to a |
| 379 | * `GtkOrdering` value. |
| 380 | * |
| 381 | * Returns: the corresponding `GtkOrdering` |
| 382 | * |
| 383 | * Since: 4.2 |
| 384 | **/ |
| 385 | GtkOrdering |
| 386 | gtk_ordering_from_cmpfunc (int cmpfunc_result) |
| 387 | { |
| 388 | return (GtkOrdering) ((cmpfunc_result > 0) - (cmpfunc_result < 0)); |
| 389 | } |
| 390 | #endif |