diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-05-04 15:05:08 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-05-04 15:05:08 -0400 |
commit | bf66cd1e94f298131ac16fc6b64fee95b452e8b3 (patch) | |
tree | 0c9f8d3d44656da1f211b95b866fa0e8ccc6568e /gtk/gtkbox.c | |
parent | 5b19747ef8cca357156c50f8ba5d8bc3a10085e9 (diff) | |
download | gtk+-bf66cd1e94f298131ac16fc6b64fee95b452e8b3.tar.gz |
box: Only emit ::child-notify when necessary
We can easily check if the values for expand, padding and so forth
actually changed, so lets do it.
Diffstat (limited to 'gtk/gtkbox.c')
-rw-r--r-- | gtk/gtkbox.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 16df01d137..93206cf403 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -1542,10 +1542,14 @@ gtk_box_pack (GtkBox *box, gtk_widget_set_parent (child, GTK_WIDGET (box)); - gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_EXPAND]); - gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_FILL]); - gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_PADDING]); - gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_PACK_TYPE]); + if (expand) + gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_EXPAND]); + if (!fill) + gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_FILL]); + if (padding != 0) + gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_PADDING]); + if (pack_type != GTK_PACK_START) + gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_PACK_TYPE]); gtk_container_child_notify_by_pspec (container, child, child_props[CHILD_PROP_POSITION]); gtk_widget_thaw_child_notify (child); @@ -2550,10 +2554,20 @@ gtk_box_set_child_packing (GtkBox *box, gtk_container_child_notify_by_pspec (GTK_CONTAINER (box), child, child_props[CHILD_PROP_EXPAND]); } - child_info->fill = fill != FALSE; - gtk_container_child_notify_by_pspec (GTK_CONTAINER (box), child, child_props[CHILD_PROP_FILL]); - child_info->padding = padding; - gtk_container_child_notify_by_pspec (GTK_CONTAINER (box), child, child_props[CHILD_PROP_PADDING]); + fill = fill != FALSE; + + if (child_info->fill != fill) + { + child_info->fill = fill; + gtk_container_child_notify_by_pspec (GTK_CONTAINER (box), child, child_props[CHILD_PROP_FILL]); + } + + if (child_info->padding != padding) + { + child_info->padding = padding; + gtk_container_child_notify_by_pspec (GTK_CONTAINER (box), child, child_props[CHILD_PROP_PADDING]); + } + if (pack_type != GTK_PACK_END) pack_type = GTK_PACK_START; if (child_info->pack != pack_type) |