From a8b081661cfcb1b65a6a9fe9bf2f96e27d6d2c20 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 13 Feb 2012 15:27:16 -0500 Subject: [PATCH] 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 --- js/ui/dash.js | 8 ++++---- js/ui/lookingGlass.js | 2 +- js/ui/messageTray.js | 4 ++-- js/ui/panel.js | 4 ++-- js/ui/popupMenu.js | 8 +++++--- src/st/st-box-layout.c | 41 ----------------------------------------- src/st/st-box-layout.h | 8 -------- src/st/st-container.c | 18 ------------------ src/st/st-container.h | 6 ------ 9 files changed, 14 insertions(+), 85 deletions(-) diff --git a/js/ui/dash.js b/js/ui/dash.js index 15e0ced45..5035915a7 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -677,8 +677,8 @@ const Dash = new Lang.Class({ } for (let i = 0; i < addedItems.length; i++) - this._box.insert_actor(addedItems[i].item.actor, - addedItems[i].pos); + this._box.insert_child_at_index(addedItems[i].item.actor, + addedItems[i].pos); for (let i = 0; i < removedActors.length; i++) { let item = removedActors[i]._delegate; @@ -787,8 +787,8 @@ 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._dragPlaceholderPos); + this._box.insert_child_at_index(this._dragPlaceholder.actor, + this._dragPlaceholderPos); if (fadeIn) this._dragPlaceholder.animateIn(); } diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index fc5029848..80f7ca5f6 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -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(', ')); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 9ccc6e4f7..8fc3291b4 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -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(); diff --git a/js/ui/panel.js b/js/ui/panel.js index c4cf09f62..d8a9a9315 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -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; }, diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 58ca000fa..c0e26a239 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -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) { diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 9fe13968b..fb19c4f71 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -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); -} diff --git a/src/st/st-box-layout.h b/src/st/st-box-layout.h index f19a065d0..4db806ba6 100644 --- a/src/st/st-box-layout.h +++ b/src/st/st-box-layout.h @@ -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 */ diff --git a/src/st/st-container.c b/src/st/st-container.c index e30e02e62..36174c172 100644 --- a/src/st/st-container.c +++ b/src/st/st-container.c @@ -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 diff --git a/src/st/st-container.h b/src/st/st-container.h index c20432570..9f9593e46 100644 --- a/src/st/st-container.h +++ b/src/st/st-container.h @@ -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