40 lines
1.2 KiB
Diff
Raw Normal View History

From 74a81cbb03a4b6a27b0e9c58099d54bc1537865d Mon Sep 17 00:00:00 2001
From: iain holmes <iain@xamarin.com>
Date: Fri, 22 Jul 2016 14:39:28 +0100
Subject: [PATCH] [GtkBox] Emit GtkContainer's add signal
Even though GtkBox is a subclass of GtkContainer, it won't emit
GtkContainer::add when a widget is added via gtk_box_pack functions.
We emit that signal, and guard against cycles caused by the signal triggering
another gtk_box_add call.
---
gtk/gtkbox.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 1ebcbcf..26c66cf 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -760,6 +760,8 @@ gtk_box_pack (GtkBox *box,
gtk_widget_child_notify (child, "pack-type");
gtk_widget_child_notify (child, "position");
gtk_widget_thaw_child_notify (child);
+
+ g_signal_emit_by_name (G_OBJECT (box), "add", child);
}
/**
@@ -1188,6 +1190,11 @@ gtk_box_add (GtkContainer *container,
{
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (container);
+ if (widget->parent == container) {
+ // Break the add signal cycle
+ return;
+ }
+
gtk_box_pack_start (GTK_BOX (container), widget,
private->default_expand,
private->default_expand,