[gnome-shell] StBoxLayout: add insert_before
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StBoxLayout: add insert_before
- Date: Thu, 6 Jan 2011 18:51:13 +0000 (UTC)
commit 046308c5821bd8448cbaa0aea79f21574b5ef81d
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Mon Dec 20 19:06:54 2010 +0100
StBoxLayout: add insert_before
Add st_container_move_before internal API, and
st_box_layout_insert_before, that inserts an actor before another
in the container.
https://bugzilla.gnome.org/show_bug.cgi?id=637681
src/st/st-box-layout.c | 11 +++++++++++
src/st/st-box-layout.h | 4 ++++
src/st/st-container.c | 23 +++++++++++++++++++++++
src/st/st-container.h | 3 +++
4 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c
index ae26cd7..0aa5ef2 100644
--- a/src/st/st-box-layout.c
+++ b/src/st/st-box-layout.c
@@ -1213,3 +1213,14 @@ st_box_layout_insert_actor (StBoxLayout *self,
clutter_container_add_actor((ClutterContainer*) self, actor);
st_container_move_child (ST_CONTAINER (self), actor, pos);
}
+
+void
+st_box_layout_insert_before (StBoxLayout *self,
+ ClutterActor *actor,
+ ClutterActor *sibling)
+{
+ g_return_if_fail (ST_IS_BOX_LAYOUT (self));
+
+ clutter_container_add_actor(CLUTTER_CONTAINER (self), actor);
+ st_container_move_before (ST_CONTAINER (self), actor, sibling);
+}
diff --git a/src/st/st-box-layout.h b/src/st/st-box-layout.h
index 54372d5..f19a065 100644
--- a/src/st/st-box-layout.h
+++ b/src/st/st-box-layout.h
@@ -90,6 +90,10 @@ void st_box_layout_insert_actor (StBoxLayout *self,
ClutterActor *actor,
int pos);
+void st_box_layout_insert_before (StBoxLayout *self,
+ ClutterActor *actor,
+ ClutterActor *sibling);
+
G_END_DECLS
#endif /* _ST_BOX_LAYOUT_H */
diff --git a/src/st/st-container.c b/src/st/st-container.c
index 4d140a1..0fb5eb4 100644
--- a/src/st/st-container.c
+++ b/src/st/st-container.c
@@ -159,6 +159,29 @@ st_container_move_child (StContainer *container,
clutter_actor_queue_relayout ((ClutterActor*) container);
}
+void
+st_container_move_before (StContainer *container,
+ ClutterActor *actor,
+ ClutterActor *sibling)
+{
+ StContainerPrivate *priv = container->priv;
+ GList *actor_item = NULL;
+ GList *sibling_item = NULL;
+
+ actor_item = g_list_find (priv->children, actor);
+ sibling_item = g_list_find (priv->children, sibling);
+
+ g_return_if_fail (actor_item != NULL);
+ g_return_if_fail (sibling_item != NULL);
+
+ priv->children = g_list_delete_link (priv->children, actor_item);
+ priv->children = g_list_insert_before (priv->children, sibling_item, actor);
+
+ st_container_update_pseudo_classes (container);
+
+ clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
+}
+
/**
* st_container_get_children_list:
* @container: An #StContainer
diff --git a/src/st/st-container.h b/src/st/st-container.h
index f5f04aa..91f457f 100644
--- a/src/st/st-container.h
+++ b/src/st/st-container.h
@@ -62,6 +62,9 @@ GList * st_container_get_focus_chain (StContainer *container);
void st_container_move_child (StContainer *container,
ClutterActor *actor,
int pos);
+void st_container_move_before (StContainer *container,
+ ClutterActor *actor,
+ ClutterActor *sibling);
GList * st_container_get_children_list (StContainer *container);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]