diff options
author | Benjamin Otte <otte.benjamin@googlemail.com> | 2022-05-06 16:11:21 +0000 |
---|---|---|
committer | Benjamin Otte <otte.benjamin@googlemail.com> | 2022-05-06 16:11:21 +0000 |
commit | bd9c491076333eb446dad64f82360da6668428a0 (patch) | |
tree | 04c674166b6196c4d0d0ca6083d5596884f51e3a | |
parent | 93d62acdf37427b18d8b9ebd655a7f2f6d32424b (diff) | |
parent | 8328bd9f9614b4e16d25c855cc591064f76c9c33 (diff) | |
download | gtk+-bd9c491076333eb446dad64f82360da6668428a0.tar.gz |
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
-rw-r--r-- | gtk/gtklistitem.c | 16 | ||||
-rw-r--r-- | gtk/gtklistitemprivate.h | 5 | ||||
-rw-r--r-- | gtk/gtklistitemwidget.c | 9 |
3 files changed, 22 insertions, 8 deletions
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index b4371b8c93..47fed45058 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -247,6 +247,22 @@ gtk_list_item_new (void) 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) * @self: a `GtkListItem` diff --git a/gtk/gtklistitemprivate.h b/gtk/gtklistitemprivate.h index d8f8833313..af8cdd4c94 100644 --- a/gtk/gtklistitemprivate.h +++ b/gtk/gtklistitemprivate.h @@ -40,6 +40,11 @@ struct _GtkListItem 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 diff --git a/gtk/gtklistitemwidget.c b/gtk/gtklistitemwidget.c index 5ef1d357b7..56f807cf70 100644 --- a/gtk/gtklistitemwidget.c +++ b/gtk/gtklistitemwidget.c @@ -576,14 +576,7 @@ gtk_list_item_widget_default_update (GtkListItemWidget *self, } if (list_item) - { - 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"); - } + gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected); } void |