| 1 | /* |
| 2 | * Copyright © 2020 Red Hat, Inc. |
| 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 |
| 18 | */ |
| 19 | |
| 20 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 21 | |
| 22 | #include "gtkselectionfiltermodel.h"cxx . . $ `<file>/gtk/gtkselectionfiltermodel.h`/ |
| 23 | #include "gtkbitset.h"cxx . . $ `<file>/gtk/gtkbitset.h`/ |
| 24 | |
| 25 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 26 | |
| 27 | /** |
| 28 | * GtkSelectionFilterModel: |
| 29 | * |
| 30 | * A list model that presents the selection from a `GtkSelectionModel`. |
| 31 | */ |
| 32 | |
| 33 | enumcxx . . $ $anonymous_type_43c41db67e20cf94_0# { |
| 34 | PROP_0cxx . . $ PROP_0., |
| 35 | PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE., |
| 36 | PROP_MODELcxx . . $ PROP_MODEL., |
| 37 | PROP_N_ITEMScxx . . $ PROP_N_ITEMS., |
| 38 | |
| 39 | NUM_PROPERTIEScxx . . $ NUM_PROPERTIES. |
| 40 | }; |
| 41 | |
| 42 | struct _GtkSelectionFilterModelcxx . . $ _GtkSelectionFilterModel# |
| 43 | { |
| 44 | GObjectcxx . . $ GObject# parent_instancecxx . . $ _GtkSelectionFilterModel#parent_instance.; |
| 45 | |
| 46 | GtkSelectionModelcxx . . $ GtkSelectionModel# *modelcxx . . $ _GtkSelectionFilterModel#model.; |
| 47 | GtkBitsetcxx . . $ GtkBitset# *selectioncxx . . $ _GtkSelectionFilterModel#selection.; |
| 48 | }; |
| 49 | |
| 50 | struct _GtkSelectionFilterModelClasscxx . . $ _GtkSelectionFilterModelClass# |
| 51 | { |
| 52 | GObjectClasscxx . . $ GObjectClass# parent_classcxx . . $ _GtkSelectionFilterModelClass#parent_class.; |
| 53 | }; |
| 54 | |
| 55 | static GParamSpeccxx . . $ GParamSpec# *propertiescxx . . $ properties.[NUM_PROPERTIEScxx . . $ NUM_PROPERTIES.] = { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, }; |
| 56 | |
| 57 | static GTypecxx . . $ GType# |
| 58 | gtk_selection_filter_model_get_item_typecxx . . $ gtk_selection_filter_model_get_item_type(94bfa31565da8ed5). (GListModelcxx . . $ GListModel# *list) |
| 59 | { |
| 60 | return G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!; |
| 61 | } |
| 62 | |
| 63 | static guintcxx . . $ guint# |
| 64 | gtk_selection_filter_model_get_n_itemscxx . . $ gtk_selection_filter_model_get_n_items(43b97f6a983b4be8). (GListModelcxx . . $ GListModel# *list) |
| 65 | { |
| 66 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self = GTK_SELECTION_FILTER_MODELcxx . . $ GTK_SELECTION_FILTER_MODEL(43e48d5d498b750). (list); |
| 67 | |
| 68 | if (!self->selectioncxx . . $ _GtkSelectionFilterModel#selection.) |
| 69 | return 0; |
| 70 | |
| 71 | return gtk_bitset_get_sizecxx . . $ gtk_bitset_get_size(69f9a7c04b446200). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection.); |
| 72 | } |
| 73 | |
| 74 | static gpointercxx . . $ gpointer# |
| 75 | gtk_selection_filter_model_get_itemcxx . . $ gtk_selection_filter_model_get_item(9715a6516b430a30). (GListModelcxx . . $ GListModel# *list, |
| 76 | guintcxx . . $ guint# position) |
| 77 | { |
| 78 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self = GTK_SELECTION_FILTER_MODELcxx . . $ GTK_SELECTION_FILTER_MODEL(43e48d5d498b750). (list); |
| 79 | |
| 80 | if (!self->selectioncxx . . $ _GtkSelectionFilterModel#selection.) |
| 81 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 82 | |
| 83 | if (position >= gtk_bitset_get_sizecxx . . $ gtk_bitset_get_size(69f9a7c04b446200). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection.)) |
| 84 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 85 | |
| 86 | position = gtk_bitset_get_nthcxx . . $ gtk_bitset_get_nth(f7b42321e5fbd84e). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection., position); |
| 87 | |
| 88 | return g_list_model_get_itemcxx . . $ g_list_model_get_item(9715a6516b430a30). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self->modelcxx . . $ _GtkSelectionFilterModel#model.), position); |
| 89 | } |
| 90 | |
| 91 | static void |
| 92 | gtk_selection_filter_model_list_model_initcxx . . $ gtk_selection_filter_model_list_model_init(41b235b28ecdc2f9). (GListModelInterfacecxx . . $ GListModelInterface# *iface) |
| 93 | { |
| 94 | iface->get_item_typecxx . . $ _GListModelInterface#get_item_type. = gtk_selection_filter_model_get_item_typecxx . . $ gtk_selection_filter_model_get_item_type(94bfa31565da8ed5).; |
| 95 | iface->get_n_itemscxx . . $ _GListModelInterface#get_n_items. = gtk_selection_filter_model_get_n_itemscxx . . $ gtk_selection_filter_model_get_n_items(43b97f6a983b4be8).; |
| 96 | iface->get_itemcxx . . $ _GListModelInterface#get_item. = gtk_selection_filter_model_get_itemcxx . . $ gtk_selection_filter_model_get_item(9715a6516b430a30).; |
| 97 | } |
| 98 | |
| 99 | G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (GtkSelectionFilterModel, gtk_selection_filter_model, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!, |
| 100 | G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (G_TYPE_LIST_MODELcxx . . $ `<external>/10117917155607792737/glistmodel.h:36:9`!, gtk_selection_filter_model_list_model_init)) |
| 101 | |
| 102 | static void |
| 103 | selection_filter_model_items_changedcxx . . $ selection_filter_model_items_changed(cca92d86503eb027). (GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self, |
| 104 | guintcxx . . $ guint# position, |
| 105 | guintcxx . . $ guint# removed, |
| 106 | guintcxx . . $ guint# added) |
| 107 | { |
| 108 | GtkBitsetcxx . . $ GtkBitset# *selection; |
| 109 | guintcxx . . $ guint# sel_position = 0; |
| 110 | guintcxx . . $ guint# sel_removed = 0; |
| 111 | guintcxx . . $ guint# sel_added = 0; |
| 112 | |
| 113 | selection = gtk_selection_model_get_selectioncxx . . $ gtk_selection_model_get_selection(2685d35c08279656). (self->modelcxx . . $ _GtkSelectionFilterModel#model.); |
| 114 | |
| 115 | if (position > 0) |
| 116 | sel_position = gtk_bitset_get_size_in_rangecxx . . $ gtk_bitset_get_size_in_range(8dd704e311c3063c). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection., 0, position - 1); |
| 117 | |
| 118 | if (removed > 0) |
| 119 | sel_removed = gtk_bitset_get_size_in_rangecxx . . $ gtk_bitset_get_size_in_range(8dd704e311c3063c). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection., position, position + removed - 1); |
| 120 | |
| 121 | if (added > 0) |
| 122 | sel_added = gtk_bitset_get_size_in_rangecxx . . $ gtk_bitset_get_size_in_range(8dd704e311c3063c). (selection, position, position + added - 1); |
| 123 | |
| 124 | gtk_bitset_unrefcxx . . $ gtk_bitset_unref(a981648d8e5e1e8a). (self->selectioncxx . . $ _GtkSelectionFilterModel#selection.); |
| 125 | self->selectioncxx . . $ _GtkSelectionFilterModel#selection. = gtk_bitset_copycxx . . $ gtk_bitset_copy(b490948ea57a6d3d). (selection); |
| 126 | |
| 127 | gtk_bitset_unrefcxx . . $ gtk_bitset_unref(a981648d8e5e1e8a). (selection); |
| 128 | |
| 129 | if (sel_removed > 0 || sel_added > 0) |
| 130 | g_list_model_items_changedcxx . . $ g_list_model_items_changed(2896dae0034144d8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self), sel_position, sel_removed, sel_added); |
| 131 | if (sel_removed != sel_added) |
| 132 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.]); |
| 133 | } |
| 134 | |
| 135 | static void |
| 136 | gtk_selection_filter_model_items_changed_cbcxx . . $ gtk_selection_filter_model_items_changed_cb(b7778c2682d5c4). (GListModelcxx . . $ GListModel# *model, |
| 137 | guintcxx . . $ guint# position, |
| 138 | guintcxx . . $ guint# removed, |
| 139 | guintcxx . . $ guint# added, |
| 140 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self) |
| 141 | { |
| 142 | selection_filter_model_items_changedcxx . . $ selection_filter_model_items_changed(cca92d86503eb027). (self, position, removed, added); |
| 143 | } |
| 144 | |
| 145 | static void |
| 146 | gtk_selection_filter_model_selection_changed_cbcxx . . $ gtk_selection_filter_model_selection_changed_cb(b9893ef2157e2fb9). (GListModelcxx . . $ GListModel# *model, |
| 147 | guintcxx . . $ guint# position, |
| 148 | guintcxx . . $ guint# n_items, |
| 149 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self) |
| 150 | { |
| 151 | selection_filter_model_items_changedcxx . . $ selection_filter_model_items_changed(cca92d86503eb027). (self, position, n_items, n_items); |
| 152 | } |
| 153 | |
| 154 | static void |
| 155 | gtk_selection_filter_model_set_propertycxx . . $ gtk_selection_filter_model_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 156 | guintcxx . . $ guint# prop_id, |
| 157 | const GValuecxx . . $ GValue# *value, |
| 158 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 159 | { |
| 160 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self = GTK_SELECTION_FILTER_MODELcxx . . $ GTK_SELECTION_FILTER_MODEL(43e48d5d498b750). (object); |
| 161 | |
| 162 | switch (prop_id) |
| 163 | { |
| 164 | case PROP_MODELcxx . . $ PROP_MODEL.: |
| 165 | gtk_selection_filter_model_set_modelcxx . . $ gtk_selection_filter_model_set_model(67502dc96f85b6f6). (self, g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value)); |
| 166 | break; |
| 167 | |
| 168 | default: |
| 169 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 170 | break; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | static void |
| 175 | gtk_selection_filter_model_get_propertycxx . . $ gtk_selection_filter_model_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 176 | guintcxx . . $ guint# prop_id, |
| 177 | GValuecxx . . $ GValue# *value, |
| 178 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 179 | { |
| 180 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self = GTK_SELECTION_FILTER_MODELcxx . . $ GTK_SELECTION_FILTER_MODEL(43e48d5d498b750). (object); |
| 181 | |
| 182 | switch (prop_id) |
| 183 | { |
| 184 | case PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE.: |
| 185 | g_value_set_gtypecxx . . $ g_value_set_gtype(235192cae6c1f0e4). (value, gtk_selection_filter_model_get_item_typecxx . . $ gtk_selection_filter_model_get_item_type(94bfa31565da8ed5). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self))); |
| 186 | break; |
| 187 | |
| 188 | case PROP_MODELcxx . . $ PROP_MODEL.: |
| 189 | g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, self->modelcxx . . $ _GtkSelectionFilterModel#model.); |
| 190 | break; |
| 191 | |
| 192 | case PROP_N_ITEMScxx . . $ PROP_N_ITEMS.: |
| 193 | g_value_set_uintcxx . . $ g_value_set_uint(f81c5c84daf56975). (value, gtk_selection_filter_model_get_n_itemscxx . . $ gtk_selection_filter_model_get_n_items(43b97f6a983b4be8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self))); |
| 194 | break; |
| 195 | |
| 196 | default: |
| 197 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 198 | break; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | static void |
| 203 | gtk_selection_filter_model_clear_modelcxx . . $ gtk_selection_filter_model_clear_model(24b89d5312417356). (GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self) |
| 204 | { |
| 205 | if (self->modelcxx . . $ _GtkSelectionFilterModel#model. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 206 | return; |
| 207 | |
| 208 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (self->model, gtk_selection_filter_model_items_changed_cb, self); |
| 209 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (self->model, gtk_selection_filter_model_selection_changed_cb, self); |
| 210 | |
| 211 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->model); |
| 212 | g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->selection, gtk_bitset_unref); |
| 213 | } |
| 214 | |
| 215 | static void |
| 216 | gtk_selection_filter_model_disposecxx . . $ gtk_selection_filter_model_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 217 | { |
| 218 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self = GTK_SELECTION_FILTER_MODELcxx . . $ GTK_SELECTION_FILTER_MODEL(43e48d5d498b750). (object); |
| 219 | |
| 220 | gtk_selection_filter_model_clear_modelcxx . . $ gtk_selection_filter_model_clear_model(24b89d5312417356). (self); |
| 221 | |
| 222 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_selection_filter_model_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object); |
| 223 | } |
| 224 | |
| 225 | static void |
| 226 | gtk_selection_filter_model_class_initcxx . . $ gtk_selection_filter_model_class_init(bb688d9e793563e4). (GtkSelectionFilterModelClasscxx . . $ GtkSelectionFilterModelClass# *class) |
| 227 | { |
| 228 | GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (class); |
| 229 | |
| 230 | gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_selection_filter_model_set_propertycxx . . $ gtk_selection_filter_model_set_property(d7c4bb29f36c0dc4).; |
| 231 | gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_selection_filter_model_get_propertycxx . . $ gtk_selection_filter_model_get_property(cee2c52f22407c66).; |
| 232 | gobject_class->disposecxx . . $ _GObjectClass#dispose. = gtk_selection_filter_model_disposecxx . . $ gtk_selection_filter_model_dispose(6087475fa43034d3).; |
| 233 | |
| 234 | /** |
| 235 | * GtkSelectionFilterModel:item-type: |
| 236 | * |
| 237 | * The type of items. See [[email protected]_item_type]. |
| 238 | * |
| 239 | * Since: 4.8 |
| 240 | **/ |
| 241 | propertiescxx . . $ properties.[PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE.] = |
| 242 | g_param_spec_gtypecxx . . $ g_param_spec_gtype(faf99966f027a127). ("item-type", 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`!, |
| 243 | G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!, |
| 244 | G_PARAM_READABLEcxx . . $ G_PARAM_READABLE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!); |
| 245 | |
| 246 | /** |
| 247 | * GtkSelectionFilterModel:model: |
| 248 | * |
| 249 | * The model being filtered. |
| 250 | */ |
| 251 | propertiescxx . . $ properties.[PROP_MODELcxx . . $ PROP_MODEL.] = |
| 252 | g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("model", 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`!, |
| 253 | GTK_TYPE_SELECTION_MODELcxx . . $ `gtk/gtkselectionmodel.h:30:9`!, |
| 254 | GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 255 | |
| 256 | /** |
| 257 | * GtkSelectionFilterModel:n-items: |
| 258 | * |
| 259 | * The number of items. See [[email protected]_n_items]. |
| 260 | * |
| 261 | * Since: 4.8 |
| 262 | **/ |
| 263 | propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.] = |
| 264 | g_param_spec_uintcxx . . $ g_param_spec_uint(503a1013c8de17d5). ("n-items", 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`!, |
| 265 | 0, G_MAXUINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:40:9`!, 0, |
| 266 | G_PARAM_READABLEcxx . . $ G_PARAM_READABLE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!); |
| 267 | |
| 268 | g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (gobject_class, NUM_PROPERTIEScxx . . $ NUM_PROPERTIES., propertiescxx . . $ properties.); |
| 269 | } |
| 270 | |
| 271 | static void |
| 272 | gtk_selection_filter_model_initcxx . . $ gtk_selection_filter_model_init(24b89d5312417356). (GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self) |
| 273 | { |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * gtk_selection_filter_model_new: |
| 278 | * @model: (nullable) (transfer none): the selection model to filter |
| 279 | * |
| 280 | * Creates a new `GtkSelectionFilterModel` that will include the |
| 281 | * selected items from the underlying selection model. |
| 282 | * |
| 283 | * Returns: a new `GtkSelectionFilterModel` |
| 284 | */ |
| 285 | GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# * |
| 286 | gtk_selection_filter_model_newcxx . . $ gtk_selection_filter_model_new(d4daf4f26daa9839). (GtkSelectionModelcxx . . $ GtkSelectionModel# *model) |
| 287 | { |
| 288 | return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_SELECTION_FILTER_MODELcxx . . $ `gtk/gtkselectionfiltermodel.h:32:9`!, |
| 289 | "model", model, |
| 290 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * gtk_selection_filter_model_set_model: |
| 295 | * @self: a `GtkSelectionFilterModel` |
| 296 | * @model: (nullable): The model to be filtered |
| 297 | * |
| 298 | * Sets the model to be filtered. |
| 299 | * |
| 300 | * Note that GTK makes no effort to ensure that @model conforms to |
| 301 | * the item type of @self. It assumes that the caller knows what they |
| 302 | * are doing and have set up an appropriate filter to ensure that item |
| 303 | * types match. |
| 304 | **/ |
| 305 | void |
| 306 | gtk_selection_filter_model_set_modelcxx . . $ gtk_selection_filter_model_set_model(67502dc96f85b6f6). (GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self, |
| 307 | GtkSelectionModelcxx . . $ GtkSelectionModel# *model) |
| 308 | { |
| 309 | guintcxx . . $ guint# removed, added; |
| 310 | |
| 311 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_SELECTION_FILTER_MODEL (self)); |
| 312 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (model == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || GTK_IS_SELECTION_MODEL (model)); |
| 313 | |
| 314 | if (self->modelcxx . . $ _GtkSelectionFilterModel#model. == model) |
| 315 | return; |
| 316 | |
| 317 | removed = g_list_model_get_n_itemscxx . . $ g_list_model_get_n_items(43b97f6a983b4be8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self)); |
| 318 | gtk_selection_filter_model_clear_modelcxx . . $ gtk_selection_filter_model_clear_model(24b89d5312417356). (self); |
| 319 | |
| 320 | if (model) |
| 321 | { |
| 322 | GtkBitsetcxx . . $ GtkBitset# *selection; |
| 323 | |
| 324 | self->modelcxx . . $ _GtkSelectionFilterModel#model. = g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (model); |
| 325 | |
| 326 | selection = gtk_selection_model_get_selectioncxx . . $ gtk_selection_model_get_selection(2685d35c08279656). (self->modelcxx . . $ _GtkSelectionFilterModel#model.); |
| 327 | self->selectioncxx . . $ _GtkSelectionFilterModel#selection. = gtk_bitset_copycxx . . $ gtk_bitset_copy(b490948ea57a6d3d). (selection); |
| 328 | gtk_bitset_unrefcxx . . $ gtk_bitset_unref(a981648d8e5e1e8a). (selection); |
| 329 | |
| 330 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (model, "items-changed", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (gtk_selection_filter_model_items_changed_cb), self); |
| 331 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (model, "selection-changed", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (gtk_selection_filter_model_selection_changed_cb), self); |
| 332 | } |
| 333 | |
| 334 | added = g_list_model_get_n_itemscxx . . $ g_list_model_get_n_items(43b97f6a983b4be8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self)); |
| 335 | |
| 336 | if (removed > 0 || added > 0) |
| 337 | g_list_model_items_changedcxx . . $ g_list_model_items_changed(2896dae0034144d8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self), 0, removed, added); |
| 338 | if (removed != added) |
| 339 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.]); |
| 340 | |
| 341 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_MODELcxx . . $ PROP_MODEL.]); |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * gtk_selection_filter_model_get_model: |
| 346 | * @self: a `GtkSelectionFilterModel` |
| 347 | * |
| 348 | * Gets the model currently filtered or %NULL if none. |
| 349 | * |
| 350 | * Returns: (nullable) (transfer none): The model that gets filtered |
| 351 | */ |
| 352 | GtkSelectionModelcxx . . $ GtkSelectionModel# * |
| 353 | gtk_selection_filter_model_get_modelcxx . . $ gtk_selection_filter_model_get_model(bab14d15427dba63). (GtkSelectionFilterModelcxx . . $ GtkSelectionFilterModel# *self) |
| 354 | { |
| 355 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_SELECTION_FILTER_MODEL (self), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 356 | |
| 357 | return self->modelcxx . . $ _GtkSelectionFilterModel#model.; |
| 358 | } |