[gtk+/composite-templates: 6/18] Implemented gtk_container_buildable_get_internal_child() and removed GSEAL macros



commit 9b59f6ae20e9bc49168ac34fcd399d02cf0b6abb
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Sat Jun 9 20:02:00 2012 -0300

    Implemented gtk_container_buildable_get_internal_child() and removed GSEAL macros

 gtk/gtkcontainer.c |   29 ++++++++++++++++++++++-------
 gtk/gtkcontainer.h |    6 +++---
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 6e85515..bfb88a2 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -529,10 +529,26 @@ gtk_container_class_init (GtkContainerClass *class)
   gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CONTAINER_ACCESSIBLE);
 }
 
+static GObject *
+gtk_container_buildable_get_internal_child (GtkBuildable *buildable,
+                                            GtkBuilder   *builder,
+                                            const gchar  *childname)
+{
+  GtkWidget *child;
+
+  child = gtk_container_get_composite_child (GTK_CONTAINER (buildable), childname);
+  if (child) return G_OBJECT (child);
+
+  return parent_buildable_iface->get_internal_child (buildable,
+                                                     builder,
+                                                     childname);
+}
+
 static void
 gtk_container_buildable_init (GtkBuildableIface *iface)
 {
   parent_buildable_iface = g_type_interface_peek_parent (iface);
+  iface->get_internal_child = gtk_container_buildable_get_internal_child;
   iface->add_child = gtk_container_buildable_add_child;
   iface->custom_tag_start = gtk_container_buildable_custom_tag_start;
   iface->custom_tag_end = gtk_container_buildable_custom_tag_end;
@@ -1344,21 +1360,22 @@ gtk_container_get_composite_child (GtkContainer *container,
   GParamSpec   **pspecs;
   guint          n_pspecs = 0, i;
   GtkWidget     *composite_child = NULL;
+  gchar *name;
 
   g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
   g_return_val_if_fail (composite_name && composite_name[0], NULL);
 
+  name = g_strdelimit (g_strdup (composite_name), "_", '-');
+  
   pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (container), &n_pspecs);
   for (i = 0; i < n_pspecs; i++)
     {
-      if (strcmp (pspecs[i]->name, composite_name) == 0)
+      if (strcmp (pspecs[i]->name, name) == 0)
 	{
 	  if (GTK_IS_PARAM_SPEC_COMPOSITE (pspecs[i]) &&
 	      (pspecs[i]->flags & G_PARAM_WRITABLE) != 0)
 	    {
-	      g_object_get (G_OBJECT (container), 
-			    composite_name, &composite_child, 
-			    NULL);
+	      g_object_get (G_OBJECT (container), name, &composite_child, NULL);
 	      
 	      if (composite_child)
 		g_object_unref (composite_child);
@@ -1370,6 +1387,7 @@ gtk_container_get_composite_child (GtkContainer *container,
 	}
     }
   g_free (pspecs);
+  g_free (name);
 
   return composite_child;
 }
@@ -3764,6 +3782,3 @@ gtk_param_spec_composite (const gchar *name,
   
   return G_PARAM_SPEC (ospec);
 }
-
-#define __GTK_CONTAINER_C__
-#include "gtkaliasdef.c"
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index d14980a..1cdc82f 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -141,9 +141,9 @@ struct _GtkContainerClass
   unsigned int _handle_border_width : 1;
 
   /* GtkBuilder templates for automated composite classes */
-  gchar *GSEAL (tmpl);
-  gchar *GSEAL (tmpl_file);
-  GtkBuilderConnectFunc GSEAL (connect_func);
+  gchar *tmpl;
+  gchar *tmpl_file;
+  GtkBuilderConnectFunc connect_func;
 
   /* Padding for future expansion */
   void (*_gtk_reserved1) (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]