From 038a32330f5f33b8a8d335d1a4e3911d3e0c7a0f Mon Sep 17 00:00:00 2001 From: Marina Zhurakhinskaya Date: Wed, 13 Jan 2010 15:03:26 -0500 Subject: [PATCH] [St] Add st_box_layout_move_child and st_box_layout_insert_actor --- src/st/st-box-layout.c | 33 +++++++++++++++++++++++++++++++++ src/st/st-box-layout.h | 8 ++++++++ 2 files changed, 41 insertions(+) diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 88c2d9309..d23226a91 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -1418,3 +1418,36 @@ st_box_layout_get_n_children (StBoxLayout *self) { return g_list_length (self->priv->children); } + +void +st_box_layout_move_child (StBoxLayout *self, + ClutterActor *actor, + int pos) +{ + StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (self)->priv; + + GList *item = NULL; + + item = g_list_find (priv->children, actor); + + if (item == NULL) + { + g_warning ("Actor of type '%s' is not a child of the StBoxLayout container", + g_type_name (G_OBJECT_TYPE (actor))); + return; + } + + priv->children = g_list_delete_link (priv->children, item); + priv->children = g_list_insert (priv->children, actor, pos); + clutter_actor_queue_relayout ((ClutterActor*) self); +} + +void +st_box_layout_insert_actor (StBoxLayout *self, + ClutterActor *actor, + int pos) +{ + clutter_container_add_actor((ClutterContainer*) self, actor); + st_box_layout_move_child(self, actor, pos); +} + diff --git a/src/st/st-box-layout.h b/src/st/st-box-layout.h index 21cd0b757..33b59240a 100644 --- a/src/st/st-box-layout.h +++ b/src/st/st-box-layout.h @@ -95,6 +95,14 @@ void st_box_layout_destroy_children (StBoxLayout *box); guint st_box_layout_get_n_children (StBoxLayout *box); +void st_box_layout_move_child (StBoxLayout *self, + ClutterActor *actor, + int pos); + +void st_box_layout_insert_actor (StBoxLayout *self, + ClutterActor *actor, + int pos); + G_END_DECLS #endif /* _ST_BOX_LAYOUT_H */