iconGrid: Exclude hidden children from the layout

As all children were considered for the grid's layout, hidden items showed up as
empty space. Instead, exclude hidden children from the layout, so that the grid is
only made up of visible items.

https://bugzilla.gnome.org/show_bug.cgi?id=631537
This commit is contained in:
Maxim Ermilov 2010-12-18 22:09:58 +03:00
parent 4fd24da4e4
commit dafaab66b1

View File

@ -165,8 +165,16 @@ IconGrid.prototype = {
alloc.natural_size = nColumns * this._item_size + totalSpacing;
},
_getPreferredHeight: function (grid, forWidth, alloc) {
_getVisibleChildren: function() {
let children = this._grid.get_children();
children = children.filter(function(actor) {
return actor.visible;
});
return children;
},
_getPreferredHeight: function (grid, forWidth, alloc) {
let children = this._getVisibleChildren();
let [nColumns, usedWidth] = this._computeLayout(forWidth);
let nRows;
if (nColumns > 0)
@ -182,7 +190,7 @@ IconGrid.prototype = {
},
_allocate: function (grid, box, flags) {
let children = this._grid.get_children();
let children = this._getVisibleChildren();
let availWidth = box.x2 - box.x1;
let availHeight = box.y2 - box.y1;