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
This commit is contained in:
Jasper St. Pierre
2012-02-16 13:40:31 -05:00
parent 4005863e3d
commit d2aab9d6a6
7 changed files with 106 additions and 195 deletions

View File

@ -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);