IconGrid: don't ask for the children list when the number is enough

Clutter keeps the number of children cached, while the list must be
built every time.
This commit is contained in:
Giovanni Campagna 2013-02-20 17:02:34 +01:00
parent 899f7da032
commit c1518dc728

View File

@ -204,10 +204,10 @@ const IconGrid = new Lang.Class({
// later we'll allocate as many children as fit the parent // later we'll allocate as many children as fit the parent
return; return;
let children = this._grid.get_children(); let nChildren = this._grid.get_n_children();
let nColumns = this._colLimit ? Math.min(this._colLimit, let nColumns = this._colLimit ? Math.min(this._colLimit,
children.length) nChildren)
: children.length; : nChildren;
let totalSpacing = Math.max(0, nColumns - 1) * this._spacing; let totalSpacing = Math.max(0, nColumns - 1) * this._spacing;
// Kind of a lie, but not really an issue right now. If // Kind of a lie, but not really an issue right now. If
// we wanted to support some sort of hidden/overflow that would // we wanted to support some sort of hidden/overflow that would