summaryrefslogtreecommitdiff
path: root/gtk/gtklistitemfactory.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-09-29 22:34:43 +0200
committerMatthias Clasen <mclasen@redhat.com>2020-05-30 19:26:45 -0400
commitb3fb80c60825813f9cdea24831404a885eb6fba2 (patch)
tree48f790629873290afdbae70e24751890b1fdda19 /gtk/gtklistitemfactory.c
parent5b69fd535d1bac96912566dc8c2d2ca3c3f969ed (diff)
downloadgtk+-b3fb80c60825813f9cdea24831404a885eb6fba2.tar.gz
listview: Add selection properties to ListItem
This just brings the infrastructure into place, we're not using the properties yet.
Diffstat (limited to 'gtk/gtklistitemfactory.c')
-rw-r--r--gtk/gtklistitemfactory.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtklistitemfactory.c b/gtk/gtklistitemfactory.c
index e102e25df3..7a508aed45 100644
--- a/gtk/gtklistitemfactory.c
+++ b/gtk/gtklistitemfactory.c
@@ -152,7 +152,8 @@ void
gtk_list_item_factory_bind (GtkListItemFactory *self,
GtkListItem *list_item,
guint position,
- gpointer item)
+ gpointer item,
+ gboolean selected)
{
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
g_return_if_fail (GTK_IS_LIST_ITEM (list_item));
@@ -161,6 +162,7 @@ gtk_list_item_factory_bind (GtkListItemFactory *self,
gtk_list_item_set_item (list_item, item);
gtk_list_item_set_position (list_item, position);
+ gtk_list_item_set_selected (list_item, selected);
if (self->bind_func)
self->bind_func (list_item, self->user_data);
@@ -171,12 +173,18 @@ gtk_list_item_factory_bind (GtkListItemFactory *self,
void
gtk_list_item_factory_update (GtkListItemFactory *self,
GtkListItem *list_item,
- guint position)
+ guint position,
+ gboolean selected)
{
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
g_return_if_fail (GTK_IS_LIST_ITEM (list_item));
+ g_object_freeze_notify (G_OBJECT (list_item));
+
gtk_list_item_set_position (list_item, position);
+ gtk_list_item_set_selected (list_item, selected);
+
+ g_object_thaw_notify (G_OBJECT (list_item));
}
void
@@ -190,6 +198,7 @@ gtk_list_item_factory_unbind (GtkListItemFactory *self,
gtk_list_item_set_item (list_item, NULL);
gtk_list_item_set_position (list_item, 0);
+ gtk_list_item_set_selected (list_item, FALSE);
g_object_thaw_notify (G_OBJECT (list_item));
}