From 98eaec99ee20b1aafeda238ef20d23b61a80446f Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Mon, 4 Sep 2023 10:29:40 -0700 Subject: [PATCH] gtksingleselection: Implement unselect_all The default implementation of unselect_all calls set_selection, which SingleSelection does not have an implementation for (it's unclear what it would do with multiple selections). Add a straightforward implementation for unselect_all. --- gtk/gtksingleselection.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/gtksingleselection.c b/gtk/gtksingleselection.c index e4a19176a9..3b5257b2f7 100644 --- a/gtk/gtksingleselection.c +++ b/gtk/gtksingleselection.c @@ -173,12 +173,21 @@ gtk_single_selection_unselect_item (GtkSelectionModel *model, return TRUE; } +static gboolean +gtk_single_selection_unselect_all (GtkSelectionModel *model) +{ + GtkSingleSelection *self = GTK_SINGLE_SELECTION (model); + + return gtk_single_selection_unselect_item (model, self->selected); +} + static void gtk_single_selection_selection_model_init (GtkSelectionModelInterface *iface) { iface->is_selected = gtk_single_selection_is_selected; iface->get_selection_in_range = gtk_single_selection_get_selection_in_range; iface->select_item = gtk_single_selection_select_item; + iface->unselect_all = gtk_single_selection_unselect_all; iface->unselect_item = gtk_single_selection_unselect_item; }