[nautilus/wip/antoniof/new-list-view: 77/85] view-model: Always notify selection changes
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/new-list-view: 77/85] view-model: Always notify selection changes
- Date: Sat, 9 Apr 2022 16:15:51 +0000 (UTC)
commit 817dae3519f352f839faa91ea7ab682c38872687
Author: António Fernandes <antoniof gnome org>
Date: Thu Feb 10 12:47:32 2022 +0000
view-model: Always notify selection changes
Sometimes selection changes are not notified, which causes regressions:
* `nautilus --select /path/to/file` fails to select file
* going to parent folder fails to select child folder we came from
As we implement GtkSelectionModel ourselves, we can and should notify
these changes even if the internal GtkMultiSelection doesn't.
src/nautilus-view-model.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index 925e6208c..4c5d15011 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -82,8 +82,20 @@ nautilus_view_model_set_selection (GtkSelectionModel *model,
{
NautilusViewModel *self = NAUTILUS_VIEW_MODEL (model);
GtkSelectionModel *selection_model = GTK_SELECTION_MODEL (self->selection_model);
+ gboolean res;
- return gtk_selection_model_set_selection (selection_model, selected, mask);
+ res = gtk_selection_model_set_selection (selection_model, selected, mask);
+ if (res)
+ {
+ guint min = gtk_bitset_get_minimum (mask);
+ guint max = gtk_bitset_get_maximum (mask);
+
+ if (min <= max)
+ {
+ gtk_selection_model_selection_changed (selection_model, min, max - min + 1);
+ }
+ }
+ return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]