[gtk/view-selection-model-2: 1/3] lists: Don't create a ghost selection



commit e4f3c5da40695e48b97db38cd660d46fc8a170f9
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 17 08:10:51 2020 -0400

    lists: Don't create a ghost selection
    
    If the model passed to gtk_...view_set_model is not
    a selection model, create a GtkNoSelection for internal
    purposes, not a GtkSingleSelection. The single selection
    is confusing because it maintains a selection state that
    cannot be accessed from the application side.

 gtk/gtklistbase.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c
index 5a1a38e40a..e0c3939b5f 100644
--- a/gtk/gtklistbase.c
+++ b/gtk/gtklistbase.c
@@ -32,7 +32,7 @@
 #include "gtkmultiselection.h"
 #include "gtkorientable.h"
 #include "gtkscrollable.h"
-#include "gtksingleselection.h"
+#include "gtknoselection.h"
 #include "gtksnapshot.h"
 #include "gtkstylecontextprivate.h"
 #include "gtktypebuiltins.h"
@@ -2130,7 +2130,7 @@ gtk_list_base_set_model (GtkListBase *self,
       if (GTK_IS_SELECTION_MODEL (model))
         selection_model = GTK_SELECTION_MODEL (g_object_ref (model));
       else
-        selection_model = GTK_SELECTION_MODEL (gtk_single_selection_new (model));
+        selection_model = GTK_SELECTION_MODEL (gtk_no_selection_new (model));
 
       gtk_list_item_manager_set_model (priv->item_manager, selection_model);
       gtk_list_base_set_anchor (self, 0, 0.0, GTK_PACK_START, 0.0, GTK_PACK_START);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]