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.
This commit is contained in:
Matthias Clasen
2020-07-17 08:10:51 -04:00
parent 8611faf338
commit e4f3c5da40

View File

@@ -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);