Merge branch 'list-item-factory-notify-by-pspec' into 'main'

list-item: Use notify_by_pspec instead of by name

See merge request GNOME/gtk!4697
This commit is contained in:
Benjamin Otte 2022-05-06 16:11:21 +00:00
commit bd9c491076
3 changed files with 22 additions and 8 deletions

View File

@ -247,6 +247,22 @@ gtk_list_item_new (void)
return g_object_new (GTK_TYPE_LIST_ITEM, NULL); return g_object_new (GTK_TYPE_LIST_ITEM, NULL);
} }
void
gtk_list_item_do_notify (GtkListItem *list_item,
gboolean notify_item,
gboolean notify_position,
gboolean notify_selected)
{
GObject *object = G_OBJECT (list_item);
if (notify_item)
g_object_notify_by_pspec (object, properties[PROP_ITEM]);
if (notify_position)
g_object_notify_by_pspec (object, properties[PROP_POSITION]);
if (notify_selected)
g_object_notify_by_pspec (object, properties[PROP_SELECTED]);
}
/** /**
* gtk_list_item_get_item: (attributes org.gtk.Method.get_property=item) * gtk_list_item_get_item: (attributes org.gtk.Method.get_property=item)
* @self: a `GtkListItem` * @self: a `GtkListItem`

View File

@ -40,6 +40,11 @@ struct _GtkListItem
GtkListItem * gtk_list_item_new (void); GtkListItem * gtk_list_item_new (void);
void gtk_list_item_do_notify (GtkListItem *list_item,
gboolean notify_item,
gboolean notify_position,
gboolean notify_selected);
G_END_DECLS G_END_DECLS

View File

@ -576,14 +576,7 @@ gtk_list_item_widget_default_update (GtkListItemWidget *self,
} }
if (list_item) if (list_item)
{ gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected);
if (notify_item)
g_object_notify (G_OBJECT (list_item), "item");
if (notify_position)
g_object_notify (G_OBJECT (list_item), "position");
if (notify_selected)
g_object_notify (G_OBJECT (list_item), "selected");
}
} }
void void