[gtk+/center-box: 6/7] Make GtkCenterBox buildable
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/center-box: 6/7] Make GtkCenterBox buildable
- Date: Sat, 3 Jun 2017 20:11:51 +0000 (UTC)
commit b095bf05c2bdf6707a1213ba27697a087391c1b6
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jun 3 16:04:57 2017 -0400
Make GtkCenterBox buildable
gtk/gtkcenterbox.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c
index 80abe2c..d6df01f 100644
--- a/gtk/gtkcenterbox.c
+++ b/gtk/gtkcenterbox.c
@@ -33,10 +33,36 @@
#include "gtkcenterbox.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetprivate.h"
+#include "gtkbuildable.h"
-G_DEFINE_TYPE (GtkCenterBox, gtk_center_box, GTK_TYPE_WIDGET);
+static void gtk_center_box_buildable_init (GtkBuildableIface *iface);
+G_DEFINE_TYPE_WITH_CODE (GtkCenterBox, gtk_center_box, GTK_TYPE_WIDGET,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_center_box_buildable_init))
+
+static void
+gtk_center_box_buildable_add_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type)
+{
+ if (g_strcmp0 (type, "start") == 0)
+ gtk_center_box_set_start_widget (GTK_CENTER_BOX (buildable), GTK_WIDGET (child));
+ else if (g_strcmp0 (type, "center") == 0)
+ gtk_center_box_set_center_widget (GTK_CENTER_BOX (buildable), GTK_WIDGET (child));
+ else if (g_strcmp0 (type, "end") == 0)
+ gtk_center_box_set_end_widget (GTK_CENTER_BOX (buildable), GTK_WIDGET (child));
+ else
+ GTK_BUILDER_WARN_INVALID_CHILD_TYPE (GTK_CENTER_BOX (buildable), type);
+}
+
+static void
+gtk_center_box_buildable_init (GtkBuildableIface *iface)
+{
+ iface->add_child = gtk_center_box_buildable_add_child;
+}
static void
gtk_center_box_measure (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]