diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-16 16:16:02 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-17 07:35:09 -0400 |
commit | a9c7f94e04207d95c0ff1f18f37477dab440d353 (patch) | |
tree | 69d151a4a9fd5f8592d245dcff4dc1f4bf20289c /gtk/gtklistview.c | |
parent | 31bb969cce30f30121d5b03730417aa41ae2e4b9 (diff) | |
download | gtk+-view-model-selection.tar.gz |
Change list widget to use a GtkSelectionModelview-model-selection
Change the type of the model property in GtkListView,
GtkColumnView and GtkGridView to be GtkSelectionModel.
The convenience of automatic interposition of a selection
model is minor, compared to the confusion.
Update all callers.
Diffstat (limited to 'gtk/gtklistview.c')
-rw-r--r-- | gtk/gtklistview.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gtk/gtklistview.c b/gtk/gtklistview.c index 3a65706ee6..28164cf174 100644 --- a/gtk/gtklistview.c +++ b/gtk/gtklistview.c @@ -831,13 +831,14 @@ gtk_list_view_class_init (GtkListViewClass *klass) /** * GtkListView:model: * - * Model for the items displayed + * Model for the items displayed. + * This must be a #GtkSelectionModel */ properties[PROP_MODEL] = g_param_spec_object ("model", P_("Model"), P_("Model for the items displayed"), - G_TYPE_LIST_MODEL, + GTK_TYPE_SELECTION_MODEL, G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); /** @@ -989,7 +990,7 @@ gtk_list_view_new_with_factory (GtkListItemFactory *factory) * * Returns: (nullable) (transfer none): The model in use **/ -GListModel * +GtkSelectionModel * gtk_list_view_get_model (GtkListView *self) { g_return_val_if_fail (GTK_IS_LIST_VIEW (self), NULL); @@ -1002,17 +1003,14 @@ gtk_list_view_get_model (GtkListView *self) * @self: a #GtkListView * @model: (allow-none) (transfer none): the model to use or %NULL for none * - * Sets the #GListModel to use. - * - * If the @model is a #GtkSelectionModel, it is used for managing the selection. - * Otherwise, @self creates a #GtkSingleSelection for the selection. - **/ + * Sets the #GtkSelectionModel to use. + */ void -gtk_list_view_set_model (GtkListView *self, - GListModel *model) +gtk_list_view_set_model (GtkListView *self, + GtkSelectionModel *model) { g_return_if_fail (GTK_IS_LIST_VIEW (self)); - g_return_if_fail (model == NULL || G_IS_LIST_MODEL (model)); + g_return_if_fail (model == NULL || GTK_IS_SELECTION_MODEL (model)); if (!gtk_list_base_set_model (GTK_LIST_BASE (self), model)) return; |