Transfer the Mac SDK bockbuild profiles & resources inside the Mono repository.
[mono.git] / bockbuild / mac-sdk / patches / gtk / emit-container-add.patch
1 From 74a81cbb03a4b6a27b0e9c58099d54bc1537865d Mon Sep 17 00:00:00 2001
2 From: iain holmes <iain@xamarin.com>
3 Date: Fri, 22 Jul 2016 14:39:28 +0100
4 Subject: [PATCH] [GtkBox] Emit GtkContainer's add signal
5
6 Even though GtkBox is a subclass of GtkContainer, it won't emit
7 GtkContainer::add when a widget is added via gtk_box_pack functions.
8
9 We emit that signal, and guard against cycles caused by the signal triggering
10 another gtk_box_add call.
11 ---
12  gtk/gtkbox.c | 7 +++++++
13  1 file changed, 7 insertions(+)
14
15 diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
16 index 1ebcbcf..26c66cf 100644
17 --- a/gtk/gtkbox.c
18 +++ b/gtk/gtkbox.c
19 @@ -760,6 +760,8 @@ gtk_box_pack (GtkBox      *box,
20    gtk_widget_child_notify (child, "pack-type");
21    gtk_widget_child_notify (child, "position");
22    gtk_widget_thaw_child_notify (child);
23 +
24 +  g_signal_emit_by_name (G_OBJECT (box), "add", child);
25  }
26
27  /**
28 @@ -1188,6 +1190,11 @@ gtk_box_add (GtkContainer *container,
29  {
30    GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (container);
31
32 +  if (widget->parent == container) {
33 +    // Break the add signal cycle
34 +    return;
35 +  }
36 +
37    gtk_box_pack_start (GTK_BOX (container), widget,
38                        private->default_expand,
39                        private->default_expand,