[glade/internal-child-support] * gladeui/glade-widget-adaptor.[ch]: o removed GladeGetInternalChildrenFunc, replaced by making



commit 335fac30af85ec94de94ef9dd38c0c7650141cf7
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Tue Apr 5 01:22:34 2011 -0300

     * gladeui/glade-widget-adaptor.[ch]:
       o removed GladeGetInternalChildrenFunc, replaced by making GladeGetChildrenFunc
         base implementation return internal children
    
     * plugins/gtk+/glade-gtk.c: glade_gtk_container_get_children()
       chain up to parent implementation

 gladeui/glade-widget-adaptor.c |   28 +++++++---------------------
 gladeui/glade-widget-adaptor.h |   16 +---------------
 plugins/gtk+/glade-gtk.c       |   23 ++++++++++-------------
 3 files changed, 18 insertions(+), 49 deletions(-)
---
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 364b24e..a2a1a2f 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -1277,13 +1277,12 @@ glade_widget_adaptor_object_create_editable (GladeWidgetAdaptor * adaptor,
   return (GladeEditable *) glade_editor_table_new (adaptor, type);
 }
 
-static void
-gwa_get_internal_children (GladeWidgetAdaptor *adaptor,
-                           GObject *object,
-                           GList **children,
-                           GList *list)
+static GList *
+glade_widget_adaptor_object_get_children (GladeWidgetAdaptor *adaptor,
+                                          GObject *object)
 {
-  GList *l;
+  GList *list = adaptor->priv->internal_children;
+  GList *l, *children = NULL;
   
   for (l = list; l; l = g_list_next (l))
     {
@@ -1294,20 +1293,8 @@ gwa_get_internal_children (GladeWidgetAdaptor *adaptor,
                                                        object,
                                                        internal->name);
       if (child)
-        *children = g_list_prepend (*children, child);
-
-      if (internal->children)
-        gwa_get_internal_children (adaptor, object, children, internal->children);
+        children = g_list_prepend (children, child);
     }
-}
-
-static GList *
-glade_widget_adaptor_object_get_internal_children (GladeWidgetAdaptor *adaptor,
-                                                   GObject *object)
-{
-  GList *children = NULL;
-
-  gwa_get_internal_children (adaptor, object, &children, adaptor->priv->internal_children);
 
   return children;
 }
@@ -1351,7 +1338,7 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass * adaptor_class)
   adaptor_class->add = NULL;
   adaptor_class->remove = NULL;
   adaptor_class->replace_child = NULL;
-  adaptor_class->get_children = NULL;
+  adaptor_class->get_children = glade_widget_adaptor_object_get_children;
   adaptor_class->child_set_property = NULL;
   adaptor_class->child_get_property = NULL;
   adaptor_class->action_activate = glade_widget_adaptor_object_action_activate;
@@ -1365,7 +1352,6 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass * adaptor_class)
   adaptor_class->create_eprop = glade_widget_adaptor_object_create_eprop;
   adaptor_class->string_from_value = glade_widget_adaptor_object_string_from_value;
   adaptor_class->create_editable = glade_widget_adaptor_object_create_editable;
-  adaptor_class->get_internal_children = glade_widget_adaptor_object_get_internal_children;
 
   /* Base defaults here */
   adaptor_class->toplevel = FALSE;
diff --git a/gladeui/glade-widget-adaptor.h b/gladeui/glade-widget-adaptor.h
index 0559394..ab33a53 100644
--- a/gladeui/glade-widget-adaptor.h
+++ b/gladeui/glade-widget-adaptor.h
@@ -329,18 +329,6 @@ typedef GList   *(* GladeGetChildrenFunc)         (GladeWidgetAdaptor *adaptor,
 						   GObject            *container);
 
 /**
- * GladeGetInternalChildrenFunc:
- * @adaptor: A #GladeWidgetAdaptor
- * @object: A #GObject container
- *
- * A function called to get @object internal children.
- *
- * Returns: A #GList of #GObject internal children.
- */
-typedef GList   *(* GladeGetInternalChildrenFunc) (GladeWidgetAdaptor *adaptor,
-						   GObject            *container);
-
-/**
  * GladeAddChildFunc:
  * @adaptor: A #GladeWidgetAdaptor
  * @parent: A #GObject container
@@ -671,9 +659,7 @@ struct _GladeWidgetAdaptorClass
   GladeCreateEPropFunc         create_eprop;      /* Creates a GladeEditorProperty */
   GladeStringFromValueFunc     string_from_value; /* Creates a string for a value */
   GladeCreateEditableFunc      create_editable;   /* Creates a page for the editor */
-
-  GladeGetInternalChildrenFunc get_internal_children; /* Return the list of internal children */
-
+    
   void   (* glade_reserved1)   (void);
   void   (* glade_reserved2)   (void);
   void   (* glade_reserved3)   (void);
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 876ea60..b10521d 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1224,22 +1224,19 @@ glade_gtk_container_get_child_property (GladeWidgetAdaptor * adaptor,
 
 GList *
 glade_gtk_container_get_children (GladeWidgetAdaptor *adaptor,
-                                  GtkContainer *container)
+                                  GObject *container)
 {
-  GList *children;
-
-  children = glade_util_container_get_all_children (container);
+  GList *parent_children, *children;
 
-  if (GWA_GET_CLASS (GTK_TYPE_CONTAINER)->get_internal_children)
-    {
-      GList *internal;
-      
-      internal = GWA_GET_CLASS (GTK_TYPE_CONTAINER)->get_internal_children (adaptor, G_OBJECT (container));
-      
-      return glade_util_purify_list (g_list_concat (children, internal));
-    }
+  children = glade_util_container_get_all_children (GTK_CONTAINER (container));
+  
+  /* Chain up */
+  if (GWA_GET_CLASS (GTK_TYPE_WIDGET)->get_children)
+    parent_children = GWA_GET_CLASS (GTK_TYPE_WIDGET)->get_children (adaptor, container);
   else
-    return children;
+    parent_children = NULL;
+  
+  return glade_util_purify_list (g_list_concat (children, parent_children));
 }
 
 GladeEditable *



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