[gtk+] box: Only emit ::child-notify when necessary
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] box: Only emit ::child-notify when necessary
- Date: Wed, 4 May 2016 20:06:28 +0000 (UTC)
commit bf66cd1e94f298131ac16fc6b64fee95b452e8b3
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 4 15:05:08 2016 -0400
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.
gtk/gtkbox.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 16df01d..93206cf 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]