[gnome-shell/wip/clutter-deprecation-fixes: 20/25] st: Remove st-container



commit 68a014b505023aaea6cb56d5be2cc1421554675f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Feb 13 20:07:09 2012 -0500

    st: Remove st-container
    
    Now that ClutterActor is a container, this isn't necessary.

 src/Makefile-st.am            |    2 -
 src/shell-generic-container.c |   62 +++----------------
 src/shell-generic-container.h |    4 +-
 src/shell-stack.c             |   66 +++++----------------
 src/shell-stack.h             |    4 +-
 src/st/st-box-layout.c        |  124 ++++++++++++--------------------------
 src/st/st-box-layout.h        |    6 +-
 src/st/st-container.h         |   71 ----------------------
 src/st/st-table.c             |  133 +++++++++--------------------------------
 src/st/st-table.h             |    6 +-
 10 files changed, 102 insertions(+), 376 deletions(-)
---
diff --git a/src/Makefile-st.am b/src/Makefile-st.am
index 2243b03..4510ead 100644
--- a/src/Makefile-st.am
+++ b/src/Makefile-st.am
@@ -50,7 +50,6 @@ st_source_h =					\
 	st/st-box-layout-child.h		\
 	st/st-button.h				\
 	st/st-clipboard.h			\
-	st/st-container.h			\
 	st/st-drawing-area.h			\
 	st/st-entry.h				\
 	st/st-focus-manager.h			\
@@ -105,7 +104,6 @@ st_source_c =					\
 	st/st-box-layout-child.c		\
 	st/st-button.c				\
 	st/st-clipboard.c			\
-	st/st-container.c			\
 	st/st-drawing-area.c			\
 	st/st-entry.c				\
 	st/st-focus-manager.c			\
diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c
index f0c32a4..22b834d 100644
--- a/src/shell-generic-container.c
+++ b/src/shell-generic-container.c
@@ -25,7 +25,7 @@ static void shell_generic_container_iface_init (ClutterContainerIface *iface);
 
 G_DEFINE_TYPE_WITH_CODE(ShellGenericContainer,
                         shell_generic_container,
-                        ST_TYPE_CONTAINER,
+                        ST_TYPE_WIDGET,
                         G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
                                                shell_generic_container_iface_init));
 
@@ -121,58 +121,18 @@ shell_generic_container_get_preferred_height (ClutterActor *actor,
   st_theme_node_adjust_preferred_height (theme_node, min_height_p, natural_height_p);
 }
 
-static void
-shell_generic_container_paint (ClutterActor  *actor)
-{
-  ShellGenericContainer *self = (ShellGenericContainer*) actor;
-  GList *iter, *children;
-
-  CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->paint (actor);
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-  for (iter = children; iter; iter = iter->next)
-    {
-      ClutterActor *child = iter->data;
-
-      if (g_hash_table_lookup (self->priv->skip_paint, child))
-        continue;
-
-      clutter_actor_paint (child);
-    }
-}
-
-static void
-shell_generic_container_pick (ClutterActor        *actor,
-                              const ClutterColor  *color)
-{
-  ShellGenericContainer *self = (ShellGenericContainer*) actor;
-  GList *iter, *children;
-
-  CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->pick (actor, color);
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-  for (iter = children; iter; iter = iter->next)
-    {
-      ClutterActor *child = iter->data;
-
-      if (g_hash_table_lookup (self->priv->skip_paint, child))
-        continue;
-
-      clutter_actor_paint (child);
-    }
-}
-
 static GList *
-shell_generic_container_get_focus_chain (StContainer *container)
+shell_generic_container_get_focus_chain (StWidget *widget)
 {
-  ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (container);
-  GList *children, *focus_chain;
+  ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (widget);
+  ClutterActor *child;
+  GList *focus_chain;
 
   focus_chain = NULL;
-  for (children = st_container_get_children_list (container); children; children = children->next)
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (self));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = children->data;
-
       if (CLUTTER_ACTOR_IS_VISIBLE (child) &&
           !shell_generic_container_get_skip_paint (self, child))
         focus_chain = g_list_prepend (focus_chain, child);
@@ -252,17 +212,15 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
-  StContainerClass *container_class = ST_CONTAINER_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
 
   gobject_class->finalize = shell_generic_container_finalize;
 
   actor_class->get_preferred_width = shell_generic_container_get_preferred_width;
   actor_class->get_preferred_height = shell_generic_container_get_preferred_height;
   actor_class->allocate = shell_generic_container_allocate;
-  actor_class->paint = shell_generic_container_paint;
-  actor_class->pick = shell_generic_container_pick;
 
-  container_class->get_focus_chain = shell_generic_container_get_focus_chain;
+  widget_class->get_focus_chain = shell_generic_container_get_focus_chain;
 
   /**
    * ShellGenericContainer::get-preferred-width:
diff --git a/src/shell-generic-container.h b/src/shell-generic-container.h
index f49b78a..93637bb 100644
--- a/src/shell-generic-container.h
+++ b/src/shell-generic-container.h
@@ -29,14 +29,14 @@ typedef struct _ShellGenericContainerPrivate ShellGenericContainerPrivate;
 
 struct _ShellGenericContainer
 {
-    StContainer parent;
+    StWidget parent;
 
     ShellGenericContainerPrivate *priv;
 };
 
 struct _ShellGenericContainerClass
 {
-    StContainerClass parent_class;
+    StWidgetClass parent_class;
 };
 
 GType    shell_generic_container_get_type         (void) G_GNUC_CONST;
diff --git a/src/shell-stack.c b/src/shell-stack.c
index e7d4175..55d5d03 100644
--- a/src/shell-stack.c
+++ b/src/shell-stack.c
@@ -18,29 +18,7 @@
 
 G_DEFINE_TYPE (ShellStack,
                shell_stack,
-               ST_TYPE_CONTAINER);
-
-static void
-shell_stack_paint (ClutterActor *actor)
-{
-  CLUTTER_ACTOR_CLASS (shell_stack_parent_class)->paint (actor);
-
-  clutter_container_foreach (CLUTTER_CONTAINER (actor),
-                             CLUTTER_CALLBACK (clutter_actor_paint),
-                             NULL);
-}
-
-static void
-shell_stack_pick (ClutterActor       *actor,
-                  const ClutterColor *pick)
-{
-  /* Chain up so we get a bounding box painted (if we are reactive) */
-  CLUTTER_ACTOR_CLASS (shell_stack_parent_class)->pick (actor, pick);
-
-  clutter_container_foreach (CLUTTER_CONTAINER (actor),
-                             CLUTTER_CALLBACK (clutter_actor_paint),
-                             NULL);
-}
+               ST_TYPE_WIDGET);
 
 static void
 shell_stack_allocate (ClutterActor           *self,
@@ -49,18 +27,18 @@ shell_stack_allocate (ClutterActor           *self,
 {
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
   ClutterActorBox content_box;
-  GList *children, *iter;
+  ClutterActor *child;
 
   clutter_actor_set_allocation (self, box, flags);
 
   st_theme_node_get_content_box (theme_node, box, &content_box);
 
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (iter = children; iter; iter = iter->next)
+  for (child = clutter_actor_get_first_child (self);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *actor = CLUTTER_ACTOR (iter->data);
       ClutterActorBox child_box = content_box;
-      clutter_actor_allocate (actor, &child_box, flags);
+      clutter_actor_allocate (child, &child_box, flags);
     }
 }
 
@@ -70,20 +48,17 @@ shell_stack_get_preferred_height (ClutterActor *actor,
                                   gfloat *min_height_p,
                                   gfloat *natural_height_p)
 {
-  ShellStack *stack = SHELL_STACK (actor);
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
   gboolean first = TRUE;
   float min = 0, natural = 0;
-  GList *children;
-  GList *iter;
+  ClutterActor *child;
 
   st_theme_node_adjust_for_width (theme_node, &for_width);
 
-  children = st_container_get_children_list (ST_CONTAINER (stack));
-
-  for (iter = children; iter; iter = iter->next)
+  for (child = clutter_actor_get_first_child (actor);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = iter->data;
       float child_min, child_natural;
 
       clutter_actor_get_preferred_height (child,
@@ -122,20 +97,17 @@ shell_stack_get_preferred_width (ClutterActor *actor,
                                  gfloat *min_width_p,
                                  gfloat *natural_width_p)
 {
-  ShellStack *stack = SHELL_STACK (actor);
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
   gboolean first = TRUE;
   float min = 0, natural = 0;
-  GList *iter;
-  GList *children;
+  ClutterActor *child;
 
   st_theme_node_adjust_for_height (theme_node, &for_height);
 
-  children = st_container_get_children_list (ST_CONTAINER (stack));
-
-  for (iter = children; iter; iter = iter->next)
+  for (child = clutter_actor_get_first_child (actor);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = iter->data;
       float child_min, child_natural;
 
       clutter_actor_get_preferred_width (child,
@@ -174,7 +146,6 @@ shell_stack_navigate_focus (StWidget         *widget,
                             GtkDirectionType  direction)
 {
   ClutterActor *top_actor;
-  GList *children;
 
   /* If the stack is itself focusable, then focus into or out of
    * it, as appropriate.
@@ -188,12 +159,7 @@ shell_stack_navigate_focus (StWidget         *widget,
       return TRUE;
     }
 
-  /* Otherwise, navigate into its top-most child only */
-  children = st_container_get_children_list (ST_CONTAINER (widget));
-  if (!children)
-    return FALSE;
-
-  top_actor = g_list_last (children)->data;
+  top_actor = clutter_actor_get_last_child (CLUTTER_ACTOR (widget));
   if (ST_IS_WIDGET (top_actor))
     return st_widget_navigate_focus (ST_WIDGET (top_actor), from, direction, FALSE);
   else
@@ -206,8 +172,6 @@ shell_stack_class_init (ShellStackClass *klass)
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
   StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
 
-  actor_class->paint = shell_stack_paint;
-  actor_class->pick = shell_stack_pick;
   actor_class->get_preferred_width = shell_stack_get_preferred_width;
   actor_class->get_preferred_height = shell_stack_get_preferred_height;
   actor_class->allocate = shell_stack_allocate;
diff --git a/src/shell-stack.h b/src/shell-stack.h
index e89d39f..73df518 100644
--- a/src/shell-stack.h
+++ b/src/shell-stack.h
@@ -19,14 +19,14 @@ typedef struct _ShellStackPrivate ShellStackPrivate;
 
 struct _ShellStack
 {
-    StContainer parent;
+    StWidget parent;
 
     ShellStackPrivate *priv;
 };
 
 struct _ShellStackClass
 {
-    StContainerClass parent_class;
+    StWidgetClass parent_class;
 };
 
 GType shell_stack_get_type (void) G_GNUC_CONST;
diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c
index e2dc5eb..4aaff37 100644
--- a/src/st/st-box-layout.c
+++ b/src/st/st-box-layout.c
@@ -59,7 +59,7 @@
 static void st_box_container_iface_init (ClutterContainerIface *iface);
 static void st_box_scrollable_interface_init (StScrollableInterface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (StBoxLayout, st_box_layout, ST_TYPE_CONTAINER,
+G_DEFINE_TYPE_WITH_CODE (StBoxLayout, st_box_layout, ST_TYPE_WIDGET,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
                                                 st_box_container_iface_init)
                          G_IMPLEMENT_INTERFACE (ST_TYPE_SCROLLABLE,
@@ -90,17 +90,6 @@ struct _StBoxLayoutPrivate
 };
 
 /*
- * ClutterContainer Interface Implementation
- */
-static void
-st_box_sort_depth_order (ClutterContainer *container)
-{
-  /* The parent class' implementation would mess up the
-   * left-to-right order of the children - do nothing instead
-   */
-}
-
-/*
  * StScrollable Interface Implementation
  */
 static void
@@ -195,7 +184,6 @@ st_box_scrollable_interface_init (StScrollableInterface *iface)
 static void
 st_box_container_iface_init (ClutterContainerIface *iface)
 {
-  iface->sort_depth_order = st_box_sort_depth_order;
   iface->child_meta_type = ST_TYPE_BOX_LAYOUT_CHILD;
 }
 
@@ -299,16 +287,15 @@ get_content_preferred_width (StBoxLayout *self,
   gint n_children = 0;
   gint n_fixed = 0;
   gfloat min_width, natural_width;
-  GList *l, *children;
+  ClutterActor *child;
 
   min_width = 0;
   natural_width = 0;
 
-  children = st_container_get_children_list (ST_CONTAINER (self));
-
-  for (l = children; l; l = g_list_next (l))
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (self));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = l->data;
       gfloat child_min = 0, child_nat = 0;
       gboolean child_fill;
 
@@ -382,16 +369,15 @@ get_content_preferred_height (StBoxLayout *self,
   gint n_children = 0;
   gint n_fixed = 0;
   gfloat min_height, natural_height;
-  GList *l, *children;
+  ClutterActor *child;
 
   min_height = 0;
   natural_height = 0;
 
-  children = st_container_get_children_list (ST_CONTAINER (self));
-
-  for (l = children; l; l = g_list_next (l))
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (self));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = l->data;
       gfloat child_min = 0, child_nat = 0;
       gboolean child_fill = FALSE;
 
@@ -502,14 +488,13 @@ compute_shrinks (StBoxLayout *self,
                  gfloat       total_shrink)
 {
   StBoxLayoutPrivate *priv = self->priv;
-  GList *children = st_container_get_children_list (ST_CONTAINER (self));
-  int n_children = g_list_length (children);
+  int n_children = clutter_actor_get_n_children (CLUTTER_ACTOR (self));
   BoxChildShrink *shrinks = g_new0 (BoxChildShrink, n_children);
   gfloat shrink_so_far;
   gfloat base_shrink = 0; /* the "= 0" is just to make gcc happy */
   int n_shrink_children;
-  GList *l;
-  int i;
+  ClutterActor *child;
+  int i = 0;
 
   /* The effect that we want is that all the children get an equal chance
    * to expand from their minimum size up to the natural size. Or to put
@@ -520,14 +505,14 @@ compute_shrinks (StBoxLayout *self,
 
   /* Find the amount of possible shrink for each child */
   int n_possible_shrink_children = 0;
-  for (l = children, i = 0; l; l = l->next, i++)
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (self));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = l->data;
       gfloat child_min, child_nat;
       gboolean child_fill;
       gboolean fixed;
 
-      child = (ClutterActor*) l->data;
       fixed = clutter_actor_get_fixed_position_set (child);
 
       shrinks[i].child_index = i;
@@ -559,6 +544,8 @@ compute_shrinks (StBoxLayout *self,
         {
           shrinks[i].shrink_amount = -1.;
         }
+
+      i++;
     }
 
   /* We want to process children starting from the child with the maximum available
@@ -621,19 +608,15 @@ st_box_layout_allocate (ClutterActor          *actor,
   ClutterActorBox content_box;
   gfloat avail_width, avail_height, min_width, natural_width, min_height, natural_height;
   gfloat position, next_position;
-  GList *l, *children;
   gint n_expand_children = 0, i;
   gfloat expand_amount, shrink_amount;
   BoxChildShrink *shrinks = NULL;
   gboolean flip = (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
                    && (!priv->is_vertical);
+  ClutterActor *child;
 
   clutter_actor_set_allocation (actor, box, flags);
 
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-  if (children == NULL)
-    return;
-
   st_theme_node_get_content_box (theme_node, box, &content_box);
 
   avail_width  = content_box.x2 - content_box.x1;
@@ -705,9 +688,10 @@ st_box_layout_allocate (ClutterActor          *actor,
     {
       /* count the number of children with expand set to TRUE */
       n_expand_children = 0;
-      for (l = children; l; l = l->next)
+      for (child = clutter_actor_get_first_child (actor);
+           child != NULL;
+           child = clutter_actor_get_next_sibling (child))
         {
-          ClutterActor *child = l->data;
           gboolean expand;
 
           if (!CLUTTER_ACTOR_IS_VISIBLE (child) ||
@@ -741,18 +725,17 @@ st_box_layout_allocate (ClutterActor          *actor,
 
   if (priv->is_pack_start)
     {
-      l = g_list_last (children);
-      i = g_list_length (children);
+      child = clutter_actor_get_last_child (actor);
+      i = clutter_actor_get_n_children (actor);
     }
   else
     {
-      l = children;
+      child = clutter_actor_get_first_child (actor);
       i = 0;
     }
 
-  while (l)
+  while (child != NULL)
     {
-      ClutterActor *child = (ClutterActor*) l->data;
       ClutterActorBox child_box;
       gfloat child_min, child_nat, child_allocated;
       gboolean xfill, yfill, expand, fixed;
@@ -839,12 +822,12 @@ st_box_layout_allocate (ClutterActor          *actor,
     next_child:
       if (priv->is_pack_start)
         {
-          l = l->prev;
+          child = clutter_actor_get_previous_sibling (child);
           i--;
         }
       else
         {
-          l = l->next;
+          child = clutter_actor_get_next_sibling (child);
           i++;
         }
     }
@@ -902,10 +885,10 @@ st_box_layout_paint (ClutterActor *actor)
   StBoxLayout *self = ST_BOX_LAYOUT (actor);
   StBoxLayoutPrivate *priv = self->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  GList *l, *children;
   gdouble x, y;
   ClutterActorBox allocation_box;
   ClutterActorBox content_box;
+  ClutterActor *child;
 
   get_border_paint_offsets (self, &x, &y);
   if (x != 0 || y != 0)
@@ -917,14 +900,7 @@ st_box_layout_paint (ClutterActor *actor)
   st_widget_paint_background (ST_WIDGET (actor));
 
   if (x != 0 || y != 0)
-    {
-      cogl_pop_matrix ();
-    }
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-
-  if (children == NULL)
-    return;
+    cogl_pop_matrix ();
 
   clutter_actor_get_allocation_box (actor, &allocation_box);
   st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
@@ -943,13 +919,10 @@ st_box_layout_paint (ClutterActor *actor)
                               (int)content_box.x2,
                               (int)content_box.y2);
 
-  for (l = children; l; l = g_list_next (l))
-    {
-      ClutterActor *child = (ClutterActor*) l->data;
-
-      if (CLUTTER_ACTOR_IS_VISIBLE (child))
-        clutter_actor_paint (child);
-    }
+  for (child = clutter_actor_get_first_child (actor);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
+    clutter_actor_paint (child);
 
   if (priv->hadjustment || priv->vadjustment)
     cogl_clip_pop ();
@@ -962,30 +935,12 @@ st_box_layout_pick (ClutterActor       *actor,
   StBoxLayout *self = ST_BOX_LAYOUT (actor);
   StBoxLayoutPrivate *priv = self->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
-  GList *l, *children;
   gdouble x, y;
   ClutterActorBox allocation_box;
   ClutterActorBox content_box;
+  ClutterActor *child;
 
   get_border_paint_offsets (self, &x, &y);
-  if (x != 0 || y != 0)
-    {
-      cogl_push_matrix ();
-      cogl_translate ((int)x, (int)y, 0);
-    }
-
-  CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->pick (actor, color);
-
-  if (x != 0 || y != 0)
-    {
-      cogl_pop_matrix ();
-    }
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-
-  if (children == NULL)
-    return;
-
   clutter_actor_get_allocation_box (actor, &allocation_box);
   st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
 
@@ -1000,13 +955,10 @@ st_box_layout_pick (ClutterActor       *actor,
                               (int)content_box.x2,
                               (int)content_box.y2);
 
-  for (l = children; l; l = g_list_next (l))
-    {
-      ClutterActor *child = (ClutterActor*) l->data;
-
-      if (CLUTTER_ACTOR_IS_VISIBLE (child))
-        clutter_actor_paint (child);
-    }
+  for (child = clutter_actor_get_first_child (actor);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
+    clutter_actor_paint (child);
 
   if (priv->hadjustment || priv->vadjustment)
     cogl_clip_pop ();
diff --git a/src/st/st-box-layout.h b/src/st/st-box-layout.h
index 4db806b..ff4a1f8 100644
--- a/src/st/st-box-layout.h
+++ b/src/st/st-box-layout.h
@@ -25,7 +25,7 @@
 #ifndef _ST_BOX_LAYOUT_H
 #define _ST_BOX_LAYOUT_H
 
-#include <st/st-container.h>
+#include <st/st-widget.h>
 
 G_BEGIN_DECLS
 
@@ -64,14 +64,14 @@ typedef struct _StBoxLayoutPrivate StBoxLayoutPrivate;
 struct _StBoxLayout
 {
   /*< private >*/
-  StContainer parent;
+  StWidget parent;
 
   StBoxLayoutPrivate *priv;
 };
 
 struct _StBoxLayoutClass
 {
-  StContainerClass parent_class;
+  StWidgetClass parent_class;
 };
 
 GType st_box_layout_get_type (void);
diff --git a/src/st/st-table.c b/src/st/st-table.c
index 8542084..f059bf5 100644
--- a/src/st/st-table.c
+++ b/src/st/st-table.c
@@ -85,7 +85,7 @@ struct _StTablePrivate
 
 static void st_table_container_iface_init (ClutterContainerIface *iface);
 
-G_DEFINE_TYPE_WITH_CODE (StTable, st_table, ST_TYPE_CONTAINER,
+G_DEFINE_TYPE_WITH_CODE (StTable, st_table, ST_TYPE_WIDGET,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
                                                 st_table_container_iface_init));
 
@@ -99,15 +99,15 @@ st_table_actor_removed (ClutterContainer *container,
                         ClutterActor     *actor)
 {
   StTablePrivate *priv = ST_TABLE (container)->priv;
-  GList *list, *children;
   gint n_rows = 0;
   gint n_cols = 0;
+  ClutterActor *child;
 
   /* Calculate and update the number of rows / columns */
-  children = st_container_get_children_list (ST_CONTAINER (container));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (actor);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
-      ClutterActor *child = CLUTTER_ACTOR (list->data);
       StTableChild *meta;
 
       if (child == actor)
@@ -221,11 +221,11 @@ st_table_homogeneous_allocate (ClutterActor          *self,
                                const ClutterActorBox *content_box,
                                gboolean               flags)
 {
-  GList *list, *children;
   gfloat col_width, row_height;
   gint row_spacing, col_spacing;
   StTablePrivate *priv = ST_TABLE (self)->priv;
   gboolean ltr = st_widget_get_direction (ST_WIDGET (self)) == ST_TEXT_DIRECTION_LTR;
+  ClutterActor *child;
 
   col_spacing = priv->col_spacing;
   row_spacing = priv->row_spacing;
@@ -237,18 +237,16 @@ st_table_homogeneous_allocate (ClutterActor          *self,
                       - (row_spacing * (priv->n_rows - 1)))
                       / priv->n_rows + 0.5);
 
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (self);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint row, col, row_span, col_span;
       StTableChild *meta;
-      ClutterActor *child;
       ClutterActorBox childbox;
       StAlign x_align, y_align;
       gboolean x_fill, y_fill;
 
-      child = CLUTTER_ACTOR (list->data);
-
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);
 
       if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
@@ -296,7 +294,7 @@ st_table_calculate_col_widths (StTable *table,
   gboolean *is_expand_col;
   gint extra_col_width, n_expanded_cols = 0, expanded_cols = 0;
   gint *pref_widths, *min_widths;
-  GList *list, *children;
+  ClutterActor *child;
 
   g_array_set_size (priv->is_expand_col, 0);
   g_array_set_size (priv->is_expand_col, priv->n_cols);
@@ -310,19 +308,16 @@ st_table_calculate_col_widths (StTable *table,
   g_array_set_size (priv->min_widths, priv->n_cols);
   min_widths = (gint *) priv->min_widths->data;
 
-  children = st_container_get_children_list (ST_CONTAINER (table));
-
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (table));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint col;
       gfloat w_min, w_pref;
       gboolean x_expand;
       StTableChild *meta;
-      ClutterActor *child;
       gint col_span;
 
-      child = CLUTTER_ACTOR (list->data);
-
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (table), child);
 
       if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
@@ -398,11 +393,11 @@ st_table_calculate_row_heights (StTable *table,
                                 gint   * col_widths)
 {
   StTablePrivate *priv = ST_TABLE (table)->priv;
-  GList *list, *children;
   gint *is_expand_row, *min_heights, *pref_heights, *row_heights, extra_row_height;
   gint i, total_min_height;
   gint expanded_rows = 0;
   gint n_expanded_rows = 0;
+  ClutterActor *child;
 
   g_array_set_size (priv->row_heights, 0);
   g_array_set_size (priv->row_heights, priv->n_rows);
@@ -420,18 +415,16 @@ st_table_calculate_row_heights (StTable *table,
   g_array_set_size (priv->pref_heights, priv->n_rows);
   pref_heights = (gboolean *) priv->pref_heights->data;
 
-  children = st_container_get_children_list (ST_CONTAINER (table));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (CLUTTER_ACTOR (table));
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint row, col, cell_width;
       gfloat h_min, h_pref;
       gboolean y_expand;
       StTableChild *meta;
-      ClutterActor *child;
       gint col_span, row_span;
 
-      child = CLUTTER_ACTOR (list->data);
-
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (table), child);
 
       if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
@@ -571,13 +564,13 @@ st_table_preferred_allocate (ClutterActor          *self,
                              const ClutterActorBox *content_box,
                              gboolean               flags)
 {
-  GList *list, *children;
   gint row_spacing, col_spacing;
   gint i;
   gint *col_widths, *row_heights;
   StTable *table;
   StTablePrivate *priv;
   gboolean ltr;
+  ClutterActor *child;
 
   table = ST_TABLE (self);
   priv = ST_TABLE (self)->priv;
@@ -596,20 +589,18 @@ st_table_preferred_allocate (ClutterActor          *self,
 
   ltr = (st_widget_get_direction (ST_WIDGET (self)) == ST_TEXT_DIRECTION_LTR);
 
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (self);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint row, col, row_span, col_span;
       gint col_width, row_height;
       StTableChild *meta;
-      ClutterActor *child;
       ClutterActorBox childbox;
       gint child_x, child_y;
       StAlign x_align, y_align;
       gboolean x_fill, y_fill;
 
-      child = CLUTTER_ACTOR (list->data);
-
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);
 
       if (!meta->allocate_hidden && !CLUTTER_ACTOR_IS_VISIBLE (child))
@@ -740,8 +731,8 @@ st_table_get_preferred_width (ClutterActor *self,
   gfloat total_min_width, total_pref_width;
   StTablePrivate *priv = ST_TABLE (self)->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
-  GList *list, *children;
   gint i;
+  ClutterActor *child;
 
   if (priv->n_cols < 1)
     {
@@ -762,15 +753,13 @@ st_table_get_preferred_width (ClutterActor *self,
   pref_widths = (gint *) priv->pref_widths->data;
 
   /* calculate minimum row widths */
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (self);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint col, col_span;
       gfloat w_min, w_pref;
       StTableChild *meta;
-      ClutterActor *child;
-
-      child = CLUTTER_ACTOR (list->data);
 
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);
 
@@ -824,9 +813,9 @@ st_table_get_preferred_height (ClutterActor *self,
   gfloat total_min_height, total_pref_height;
   StTablePrivate *priv = ST_TABLE (self)->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (self));
-  GList *list, *children;
   gint i;
   gint *min_widths;
+  ClutterActor *child;
 
   /* We only support height-for-width allocation. So if we are called
    * width-for-height, calculate heights based on our natural width
@@ -863,15 +852,13 @@ st_table_get_preferred_height (ClutterActor *self,
   pref_heights = (gint *) priv->pref_heights->data;
 
   /* calculate minimum row heights */
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
+  for (child = clutter_actor_get_first_child (self);
+       child != NULL;
+       child = clutter_actor_get_next_sibling (child))
     {
       gint row, col, col_span, cell_width, row_span;
       gfloat min, pref;
       StTableChild *meta;
-      ClutterActor *child;
-
-      child = CLUTTER_ACTOR (list->data);
 
       meta = (StTableChild *) clutter_container_get_child_meta (CLUTTER_CONTAINER (self), child);
 
@@ -916,64 +903,6 @@ st_table_get_preferred_height (ClutterActor *self,
 }
 
 static void
-st_table_paint (ClutterActor *self)
-{
-  GList *list, *children;
-
-  /* make sure the background gets painted first */
-  CLUTTER_ACTOR_CLASS (st_table_parent_class)->paint (self);
-
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
-    {
-      ClutterActor *child = CLUTTER_ACTOR (list->data);
-      if (CLUTTER_ACTOR_IS_VISIBLE (child))
-        clutter_actor_paint (child);
-    }
-}
-
-static void
-st_table_pick (ClutterActor       *self,
-               const ClutterColor *color)
-{
-  GList *list, *children;
-
-  /* Chain up so we get a bounding box painted (if we are reactive) */
-  CLUTTER_ACTOR_CLASS (st_table_parent_class)->pick (self, color);
-
-  children = st_container_get_children_list (ST_CONTAINER (self));
-  for (list = children; list; list = list->next)
-    {
-      if (CLUTTER_ACTOR_IS_VISIBLE (list->data))
-        clutter_actor_paint (CLUTTER_ACTOR (list->data));
-    }
-}
-
-static void
-st_table_show_all (ClutterActor *table)
-{
-  GList *l, *children;
-
-  children = st_container_get_children_list (ST_CONTAINER (table));
-  for (l = children; l; l = l->next)
-    clutter_actor_show_all (CLUTTER_ACTOR (l->data));
-
-  clutter_actor_show (table);
-}
-
-static void
-st_table_hide_all (ClutterActor *table)
-{
-  GList *l, *children;
-
-  clutter_actor_hide (table);
-
-  children = st_container_get_children_list (ST_CONTAINER (table));
-  for (l = children; l; l = l->next)
-    clutter_actor_hide_all (CLUTTER_ACTOR (l->data));
-}
-
-static void
 st_table_style_changed (StWidget *self)
 {
   StTablePrivate *priv = ST_TABLE (self)->priv;
@@ -1009,13 +938,9 @@ st_table_class_init (StTableClass *klass)
   gobject_class->get_property = st_table_get_property;
   gobject_class->finalize = st_table_finalize;
 
-  actor_class->paint = st_table_paint;
-  actor_class->pick = st_table_pick;
   actor_class->allocate = st_table_allocate;
   actor_class->get_preferred_width = st_table_get_preferred_width;
   actor_class->get_preferred_height = st_table_get_preferred_height;
-  actor_class->show_all = st_table_show_all;
-  actor_class->hide_all = st_table_hide_all;
 
   widget_class->style_changed = st_table_style_changed;
 
diff --git a/src/st/st-table.h b/src/st/st-table.h
index f6b8d71..a87baa4 100644
--- a/src/st/st-table.h
+++ b/src/st/st-table.h
@@ -25,7 +25,7 @@
 #define __ST_TABLE_H__
 
 #include <st/st-types.h>
-#include <st/st-container.h>
+#include <st/st-widget.h>
 
 G_BEGIN_DECLS
 
@@ -68,14 +68,14 @@ typedef struct _StTableClass         StTableClass;
 struct _StTable
 {
   /*< private >*/
-  StContainer parent_instance;
+  StWidget parent_instance;
 
   StTablePrivate *priv;
 };
 
 struct _StTableClass
 {
-  StContainerClass parent_class;
+  StWidgetClass parent_class;
 };
 
 GType st_table_get_type (void) G_GNUC_CONST;



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