diff options
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r-- | gtk/gtknotebook.c | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 57b554adb3..80abd55d56 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1124,9 +1124,13 @@ gtk_notebook_init (GtkNotebook *notebook) GTK_STYLE_CLASS_FRAME); } +static GtkBuildableIface *parent_buildable_iface; + static void gtk_notebook_buildable_init (GtkBuildableIface *iface) { + parent_buildable_iface = g_type_interface_peek_parent (iface); + iface->add_child = gtk_notebook_buildable_add_child; } @@ -1138,31 +1142,38 @@ gtk_notebook_buildable_add_child (GtkBuildable *buildable, { GtkNotebook *notebook = GTK_NOTEBOOK (buildable); - if (type && strcmp (type, "tab") == 0) + if (GTK_IS_WIDGET (child)) { - GtkWidget * page; - - page = gtk_notebook_get_nth_page (notebook, -1); - /* To set the tab label widget, we must have already a child - * inside the tab container. */ - g_assert (page != NULL); - /* warn when Glade tries to overwrite label */ - if (gtk_notebook_get_tab_label (notebook, page)) - g_warning ("Overriding tab label for notebook"); - gtk_notebook_set_tab_label (notebook, page, GTK_WIDGET (child)); - } - else if (type && strcmp (type, "action-start") == 0) - { - gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_START); + if (type && strcmp (type, "tab") == 0) + { + GtkWidget * page; + + page = gtk_notebook_get_nth_page (notebook, -1); + /* To set the tab label widget, we must have already a child + * inside the tab container. */ + g_assert (page != NULL); + /* warn when Glade tries to overwrite label */ + if (gtk_notebook_get_tab_label (notebook, page)) + g_warning ("Overriding tab label for notebook"); + gtk_notebook_set_tab_label (notebook, page, GTK_WIDGET (child)); + } + else if (type && strcmp (type, "action-start") == 0) + { + gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_START); + } + else if (type && strcmp (type, "action-end") == 0) + { + gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_END); + } + else if (!type) + gtk_notebook_append_page (notebook, GTK_WIDGET (child), NULL); + else + GTK_BUILDER_WARN_INVALID_CHILD_TYPE (notebook, type); } - else if (type && strcmp (type, "action-end") == 0) + else { - gtk_notebook_set_action_widget (notebook, GTK_WIDGET (child), GTK_PACK_END); + parent_buildable_iface->add_child (buildable, builder, child, type); } - else if (!type) - gtk_notebook_append_page (notebook, GTK_WIDGET (child), NULL); - else - GTK_BUILDER_WARN_INVALID_CHILD_TYPE (notebook, type); } static gboolean |