[gtk+/overlay] overlay: add GtkBuilder support
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/overlay] overlay: add GtkBuilder support
- Date: Sat, 11 Jun 2011 02:23:36 +0000 (UTC)
commit bb71cec470e52865b876c21986856c4cf0700ef1
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 10 22:22:18 2011 -0400
overlay: add GtkBuilder support
The only thing we need to add here is a named child slot for
overlay children. The name of the slot is 'overlay'.
gtk/gtkoverlay.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 3f39026..bf13560 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -58,7 +58,11 @@ enum
CHILD_PROP_Y_OFFSET
};
-G_DEFINE_TYPE (GtkOverlay, gtk_overlay, GTK_TYPE_CONTAINER)
+static void gtk_overlay_buildable_init (GtkBuildableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (GtkOverlay, gtk_overlay, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
+ gtk_overlay_buildable_init))
/* the reason for this is that the main widget doesn't need
* to set an offset and it doesn't need an extra window
@@ -734,6 +738,26 @@ gtk_overlay_init (GtkOverlay *overlay)
gtk_widget_set_has_window (GTK_WIDGET (overlay), FALSE);
}
+static void
+gtk_overlay_buildable_add_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type)
+{
+ if (type && strcmp (type, "overlay") == 0)
+ gtk_overlay_add (GTK_OVERLAY (buildable), GTK_WIDGET (child));
+ else if (!type)
+ gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
+ else
+ GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
+}
+
+static void
+gtk_overlay_buildable_init (GtkBuildableIface *iface)
+{
+ iface->add_child = gtk_overlay_buildable_add_child;
+}
+
/**
* gtk_overlay_new:
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]