[gtk+] Add builder support for GtkBox center widget
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add builder support for GtkBox center widget
- Date: Mon, 17 Feb 2014 13:05:45 +0000 (UTC)
commit b63ecf8b1ace0482e1416f7a355827d12cc76f46
Author: Paolo Borelli <pborelli gnome org>
Date: Mon Feb 17 09:24:48 2014 +0100
Add builder support for GtkBox center widget
gtk/gtkbox.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 72616ef..7bf8a47 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]