st-box-layout: Remove insert_actor/insert_before

Now that 'insert_child_at_index' and 'insert_child_below' exist
on ClutterActor, these aren't necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
Jasper St. Pierre 2012-02-13 15:27:16 -05:00
parent c892610f27
commit a8b081661c
9 changed files with 14 additions and 85 deletions

View File

@ -677,7 +677,7 @@ const Dash = new Lang.Class({
}
for (let i = 0; i < addedItems.length; i++)
this._box.insert_actor(addedItems[i].item.actor,
this._box.insert_child_at_index(addedItems[i].item.actor,
addedItems[i].pos);
for (let i = 0; i < removedActors.length; i++) {
@ -787,7 +787,7 @@ const Dash = new Lang.Class({
this._dragPlaceholder = new DragPlaceholderItem();
this._dragPlaceholder.child.set_width (this.iconSize);
this._dragPlaceholder.child.set_height (this.iconSize / 2);
this._box.insert_actor(this._dragPlaceholder.actor,
this._box.insert_child_at_index(this._dragPlaceholder.actor,
this._dragPlaceholderPos);
if (fadeIn)
this._dragPlaceholder.animateIn();

View File

@ -1038,7 +1038,7 @@ const LookingGlass = new Lang.Class({
actor.add(padBin);
this._completionActor = actor;
this._evalBox.insert_before(this._completionActor, this._entryArea);
this._evalBox.insert_child_below(this._completionActor, this._entryArea);
}
this._completionText.set_text(completions.join(', '));

View File

@ -1520,10 +1520,10 @@ const MessageTray = new Lang.Class({
let summaryItem = new SummaryItem(source);
if (source.isChat) {
this._summary.insert_actor(summaryItem.actor, 0);
this._summary.insert_child_at_index(summaryItem.actor, 0);
this._chatSummaryItemsCount++;
} else {
this._summary.insert_actor(summaryItem.actor, this._chatSummaryItemsCount);
this._summary.insert_child_at_index(summaryItem.actor, this._chatSummaryItemsCount);
}
let titleWidth = summaryItem.getTitleNaturalWidth();

View File

@ -1078,13 +1078,13 @@ const Panel = new Lang.Class({
for (i = children.length - 1; i >= 0; i--) {
let rolePosition = children[i]._rolePosition;
if (position > rolePosition) {
this._rightBox.insert_actor(actor, i + 1);
this._rightBox.insert_child_at_index(actor, i + 1);
break;
}
}
if (i == -1) {
// If we didn't find a position, we must be first
this._rightBox.insert_actor(actor, 0);
this._rightBox.insert_child_at_index(actor, 0);
}
actor._rolePosition = position;
},

View File

@ -1010,10 +1010,12 @@ const PopupMenuBase = new Lang.Class({
let items = this._getMenuItems();
if (position < items.length) {
before_item = items[position].actor;
this.box.insert_before(menuItem.actor, before_item);
} else
this.box.insert_child_below(menuItem.actor, before_item);
} else {
this.box.add(menuItem.actor);
}
}
if (menuItem instanceof PopupMenuSection) {
this._connectSubMenuSignals(menuItem, menuItem);
menuItem._closingId = this.connect('open-state-changed',
@ -1031,7 +1033,7 @@ const PopupMenuBase = new Lang.Class({
if (before_item == null)
this.box.add(menuItem.menu.actor);
else
this.box.insert_before(menuItem.menu.actor, before_item);
this.box.insert_child_below(menuItem.menu.actor, before_item);
this._connectSubMenuSignals(menuItem, menuItem.menu);
this._connectItemSignals(menuItem);
menuItem._closingId = this.connect('open-state-changed', function(self, open) {

View File

@ -1192,44 +1192,3 @@ st_box_layout_get_pack_start (StBoxLayout *box)
return box->priv->is_pack_start;
}
/**
* st_box_layout_insert_actor:
* @self: A #StBoxLayout
* @actor: A #ClutterActor
* @pos: position to insert actor
*
* Adds @actor to @self at position @pos. If @pos is
* negative or larger than the number of elements in the
* list then @actor is added after all the others previously
* added.
*/
void
st_box_layout_insert_actor (StBoxLayout *self,
ClutterActor *actor,
int pos)
{
clutter_container_add_actor((ClutterContainer*) self, actor);
st_container_move_child (ST_CONTAINER (self), actor, pos);
}
/**
* st_box_layout_insert_before:
* @self: A #StBoxLayout
* @actor: A #ClutterActor
* @sibling: A previously added #ClutterActor
*
* Adds @actor to @self at the position before @sibling.
* @sibling cannot be %NULL and must be already a child
* of @self.
*/
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);
}

View File

@ -86,14 +86,6 @@ void st_box_layout_set_pack_start (StBoxLayout *box,
gboolean pack_start);
gboolean st_box_layout_get_pack_start (StBoxLayout *box);
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 */

View File

@ -30,24 +30,6 @@
G_DEFINE_ABSTRACT_TYPE (StContainer, st_container, ST_TYPE_WIDGET);
void
st_container_move_child (StContainer *container,
ClutterActor *actor,
int pos)
{
clutter_actor_set_child_at_index (CLUTTER_ACTOR (container),
actor, pos);
}
void
st_container_move_before (StContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
clutter_actor_set_child_below_sibling (CLUTTER_ACTOR (container),
actor, sibling);
}
/**
* st_container_get_children_list:
* @container: An #StContainer

View File

@ -51,12 +51,6 @@ struct _StContainerClass {
GType st_container_get_type (void) G_GNUC_CONST;
/* Only to be used by subclasses of StContainer */
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