diff options
author | Paolo Borelli <pborelli@gnome.org> | 2014-02-17 09:24:48 +0100 |
---|---|---|
committer | Paolo Borelli <pborelli@gnome.org> | 2014-02-17 14:05:36 +0100 |
commit | b63ecf8b1ace0482e1416f7a355827d12cc76f46 (patch) | |
tree | 968e2ca37ace26753ecdf2848246f0c7436098b4 /gtk/gtkbox.c | |
parent | 11834ebf5ccdba65254af8a8449be947cd393a31 (diff) | |
download | gtk+-b63ecf8b1ace0482e1416f7a355827d12cc76f46.tar.gz |
Add builder support for GtkBox center widget
Diffstat (limited to 'gtk/gtkbox.c')
-rw-r--r-- | gtk/gtkbox.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 72616efdea..7bf8a47c02 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -207,10 +207,12 @@ static void gtk_box_get_preferred_height_and_baseline_for_width (GtkWidget gint *minimum_baseline, gint *natural_baseline); +static void gtk_box_buildable_init (GtkBuildableIface *iface); G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER, G_ADD_PRIVATE (GtkBox) - G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)) + G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL) + G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_box_buildable_init)) static void gtk_box_class_init (GtkBoxClass *class) @@ -1393,6 +1395,26 @@ gtk_box_get_path_for_child (GtkContainer *container, } static void +gtk_box_buildable_add_child (GtkBuildable *buildable, + GtkBuilder *builder, + GObject *child, + const gchar *type) +{ + if (type && strcmp (type, "center") == 0) + gtk_box_set_center_widget (GTK_BOX (buildable), GTK_WIDGET (child)); + else if (!type) + gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child)); + else + GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_BOX (buildable), type); +} + +static void +gtk_box_buildable_init (GtkBuildableIface *iface) +{ + iface->add_child = gtk_box_buildable_add_child; +} + +static void gtk_box_invalidate_order_foreach (GtkWidget *widget) { _gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_SIBLING_POSITION); |