[gnome-shell] [St] Add st_box_layout_move_child and st_box_layout_insert_actor



commit 038a32330f5f33b8a8d335d1a4e3911d3e0c7a0f
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date:   Wed Jan 13 15:03:26 2010 -0500

    [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(+), 0 deletions(-)
---
diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c
index 88c2d93..d23226a 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 21cd0b7..33b5924 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 */



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