From d2aab9d6a620f561e71a884ff5c44ec0bb654f9a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 16 Feb 2012 13:40:31 -0500 Subject: [PATCH] st-container: Remove st_container_get_children_list Replace it with the new actor iteration APIs. This fixes a few unintentional memory leaks - st_container_get_children_list returns an internal list, and clutter_actor_get_children_list allocates a new list. https://bugzilla.gnome.org/show_bug.cgi?id=670034 https://bugzilla.gnome.org/show_bug.cgi?id=670910 --- src/shell-generic-container.c | 27 +++++----- src/shell-stack.c | 40 ++++++--------- src/st/st-box-layout.c | 91 ++++++++++++++------------------- src/st/st-container.c | 15 ------ src/st/st-container.h | 3 -- src/st/st-group.c | 30 +++++------ src/st/st-table.c | 95 +++++++++++------------------------ 7 files changed, 106 insertions(+), 195 deletions(-) diff --git a/src/shell-generic-container.c b/src/shell-generic-container.c index 4766d9f0d..c5eb30694 100644 --- a/src/shell-generic-container.c +++ b/src/shell-generic-container.c @@ -125,15 +125,14 @@ static void shell_generic_container_paint (ClutterActor *actor) { ShellGenericContainer *self = (ShellGenericContainer*) actor; - GList *iter, *children; + ClutterActor *child; st_widget_paint_background (ST_WIDGET (actor)); - children = st_container_get_children_list (ST_CONTAINER (actor)); - 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; - if (g_hash_table_lookup (self->priv->skip_paint, child)) continue; @@ -146,15 +145,14 @@ shell_generic_container_pick (ClutterActor *actor, const ClutterColor *color) { ShellGenericContainer *self = (ShellGenericContainer*) actor; - GList *iter, *children; + ClutterActor *child; 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) + for (child = clutter_actor_get_first_child (actor); + child != NULL; + child = clutter_actor_get_next_sibling (child)) { - ClutterActor *child = iter->data; - if (g_hash_table_lookup (self->priv->skip_paint, child)) continue; @@ -166,13 +164,14 @@ static GList * shell_generic_container_get_focus_chain (StWidget *widget) { ShellGenericContainer *self = SHELL_GENERIC_CONTAINER (widget); - GList *children, *focus_chain; + ClutterActor *child; + GList *focus_chain; focus_chain = NULL; - for (children = st_container_get_children_list (ST_CONTAINER (widget)); 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); diff --git a/src/shell-stack.c b/src/shell-stack.c index 76ed475c9..f788ee4ef 100644 --- a/src/shell-stack.c +++ b/src/shell-stack.c @@ -27,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); } } @@ -48,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, @@ -100,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, @@ -152,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. @@ -166,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 diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index fb19c4f71..19a2d46f5 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -287,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; @@ -370,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; @@ -490,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 @@ -508,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; @@ -547,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 @@ -609,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; @@ -693,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) || @@ -729,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; @@ -827,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++; } } @@ -890,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) @@ -909,9 +904,7 @@ st_box_layout_paint (ClutterActor *actor) cogl_pop_matrix (); } - children = st_container_get_children_list (ST_CONTAINER (actor)); - - if (children == NULL) + if (clutter_actor_get_n_children (actor) == 0) return; clutter_actor_get_allocation_box (actor, &allocation_box); @@ -931,13 +924,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 (); @@ -950,10 +940,10 @@ 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) @@ -969,9 +959,7 @@ st_box_layout_pick (ClutterActor *actor, cogl_pop_matrix (); } - children = st_container_get_children_list (ST_CONTAINER (actor)); - - if (children == NULL) + if (clutter_actor_get_n_children (actor) == 0) return; clutter_actor_get_allocation_box (actor, &allocation_box); @@ -988,13 +976,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-container.c b/src/st/st-container.c index 36174c172..a670111c4 100644 --- a/src/st/st-container.c +++ b/src/st/st-container.c @@ -30,21 +30,6 @@ G_DEFINE_ABSTRACT_TYPE (StContainer, st_container, ST_TYPE_WIDGET); -/** - * st_container_get_children_list: - * @container: An #StContainer - * - * Get the internal list of @container's child actors. This function - * should only be used by subclasses of StContainer - * - * Returns: (element-type Clutter.Actor) (transfer none): list of @container's child actors - */ -GList * -st_container_get_children_list (StContainer *container) -{ - return clutter_actor_get_children (CLUTTER_ACTOR (container)); -} - static gboolean st_container_get_paint_volume (ClutterActor *actor, ClutterPaintVolume *volume) diff --git a/src/st/st-container.h b/src/st/st-container.h index 9f9593e46..915e809f9 100644 --- a/src/st/st-container.h +++ b/src/st/st-container.h @@ -50,9 +50,6 @@ struct _StContainerClass { GType st_container_get_type (void) G_GNUC_CONST; -/* Only to be used by subclasses of StContainer */ -GList * st_container_get_children_list (StContainer *container); - G_END_DECLS #endif /* __ST_CONTAINER_H__ */ diff --git a/src/st/st-group.c b/src/st/st-group.c index 172726f30..edf2671ed 100644 --- a/src/st/st-group.c +++ b/src/st/st-group.c @@ -61,7 +61,7 @@ st_group_get_preferred_width (ClutterActor *actor, StThemeNode *node = st_widget_get_theme_node (ST_WIDGET (actor)); gdouble min_width, natural_width; gint css_width, css_min_width, css_max_width; - GList *l, *children; + ClutterActor *child; css_width = st_theme_node_get_width (node); css_min_width = st_theme_node_get_min_width (node); @@ -73,11 +73,10 @@ st_group_get_preferred_width (ClutterActor *actor, min_width = 0; natural_width = 0; - children = st_container_get_children_list (ST_CONTAINER (actor)); - - for (l = children; l != NULL; l = l->next) + for (child = clutter_actor_get_first_child (actor); + child != NULL; + child = clutter_actor_get_next_sibling (child)) { - ClutterActor *child = l->data; gfloat child_x, child_min, child_nat; child_x = clutter_actor_get_x (child); @@ -122,7 +121,7 @@ st_group_get_preferred_height (ClutterActor *actor, StThemeNode *node = st_widget_get_theme_node (ST_WIDGET (actor)); gdouble min_height, natural_height; gint css_height, css_min_height, css_max_height; - GList *l, *children; + ClutterActor *child; css_height = st_theme_node_get_height (node); css_min_height = st_theme_node_get_min_height (node); @@ -134,11 +133,10 @@ st_group_get_preferred_height (ClutterActor *actor, min_height = 0; natural_height = 0; - children = st_container_get_children_list (ST_CONTAINER (actor)); - - for (l = children; l != NULL; l = l->next) + for (child = clutter_actor_get_first_child (actor); + child != NULL; + child = clutter_actor_get_next_sibling (child)) { - ClutterActor *child = l->data; gfloat child_y, child_min, child_nat; child_y = clutter_actor_get_y (child); @@ -179,16 +177,14 @@ st_group_allocate (ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags) { - GList *l, *children; + ClutterActor *child; CLUTTER_ACTOR_CLASS (st_group_parent_class)->allocate (actor, box, flags); - children = st_container_get_children_list (ST_CONTAINER (actor)); - for (l = children; l != NULL; l = l->next) - { - ClutterActor *child = l->data; - clutter_actor_allocate_preferred_size (child, flags); - } + for (child = clutter_actor_get_first_child (actor); + child != NULL; + child = clutter_actor_get_next_sibling (child)) + clutter_actor_allocate_preferred_size (child, flags); } static void diff --git a/src/st/st-table.c b/src/st/st-table.c index d253a7ee2..b1226ed4a 100644 --- a/src/st/st-table.c +++ b/src/st/st-table.c @@ -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); @@ -915,30 +902,6 @@ st_table_get_preferred_height (ClutterActor *self, st_theme_node_adjust_preferred_height (theme_node, min_height_p, natural_height_p); } -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) { @@ -978,8 +941,6 @@ st_table_class_init (StTableClass *klass) 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;