Merge branch 'fix_dropdown_set_expression' into 'main'

GtkDropDown: Force redisplay of the drop-down items after expression change

See merge request GNOME/gtk!6145
This commit is contained in:
Matthias Clasen 2023-06-28 09:57:04 +00:00
commit d9cfb94a80

View File

@ -105,6 +105,8 @@ struct _GtkDropDown
{
GtkWidget parent_instance;
gboolean uses_default_factory;
gboolean uses_default_list_factory;
GtkListItemFactory *factory;
GtkListItemFactory *list_factory;
GtkListItemFactory *header_factory;
@ -820,6 +822,10 @@ set_default_factory (GtkDropDown *self)
g_signal_connect (factory, "unbind", G_CALLBACK (unbind_item), self);
gtk_drop_down_set_factory (self, factory);
self->uses_default_factory = TRUE;
if (self->uses_default_list_factory)
gtk_drop_down_set_list_factory (self, NULL);
g_object_unref (factory);
}
@ -1000,7 +1006,12 @@ gtk_drop_down_set_factory (GtkDropDown *self,
gtk_list_factory_widget_set_factory (GTK_LIST_FACTORY_WIDGET (self->button_item), factory);
if (self->list_factory == NULL)
gtk_list_view_set_factory (GTK_LIST_VIEW (self->popup_list), factory);
{
gtk_list_view_set_factory (GTK_LIST_VIEW (self->popup_list), factory);
self->uses_default_list_factory = TRUE;
}
self->uses_default_factory = factory != NULL;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
}
@ -1085,6 +1096,8 @@ gtk_drop_down_set_list_factory (GtkDropDown *self,
else
gtk_list_view_set_factory (GTK_LIST_VIEW (self->popup_list), self->factory);
self->uses_default_list_factory = factory != NULL;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LIST_FACTORY]);
}
@ -1222,6 +1235,9 @@ gtk_drop_down_set_expression (GtkDropDown *self,
if (self->expression)
gtk_expression_ref (self->expression);
if (self->uses_default_factory)
set_default_factory (self);
update_filter (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EXPRESSION]);