[gnome-shell/wip/paging-release: 65/85] Fixed indicator layout make growing the parent bin due to its min size



commit eb3a00de877cf095382eb99c174490250f3f99ca
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Wed Jul 24 11:34:02 2013 +0200

    Fixed indicator layout make growing the parent bin due to its min size

 js/ui/appDisplay.js |   26 ++++++++------------------
 js/ui/iconGrid.js   |   11 -----------
 2 files changed, 8 insertions(+), 29 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index eda5025..534392b 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -434,9 +434,6 @@ const PaginationScrollView = new Lang.Class({
         this.set_allocation(box, flags);        
         let availWidth = box.x2 - box.x1;
         let availHeight = box.y2 - box.y1;
-        global.log("&&&&&&&&&&&&&&&&&&");
-        global.log("Allocation height " + availHeight);
-        global.log("&&&&&&&&&&&&&&&&&&");
         let childBox = new Clutter.ActorBox();
         childBox.x1 = 0;
         childBox.y1 = 0;
@@ -655,7 +652,7 @@ const PaginationIndicator = new Lang.Class({
             natHeight = this._nPages * natHeightPerChild - this._spacing;
         } else
             minHeight = natHeight = 0;
-        alloc.min_size = minHeight;
+        alloc.min_size = 0;
         alloc.natural_size = natHeight;
     },
     
@@ -681,7 +678,7 @@ const PaginationIndicator = new Lang.Class({
         let [minWidth, natWidth] = children[0].get_preferred_width(natHeight);
         let widthPerChild = natWidth + this._spacing * 2;
         let firstPosition = [this._spacing, availHeight / 2 - totalUsedHeight / 2];
-        global.log(" AVAVAVAAAIL HEIGHT " + availHeight);
+        global.log(" Indicator availL HEIGHT " + availHeight);
         for(let i = 0; i < this._nPages; i++) {
             let childBox = new Clutter.ActorBox();
             childBox.x1 = 0;
@@ -689,7 +686,7 @@ const PaginationIndicator = new Lang.Class({
             childBox.y1 = firstPosition[1] + i * heightPerChild;
             childBox.y2 = childBox.y1 + heightPerChild;
             if(childBox.y2 > availHeight)
-                return;
+                break;
             children[i].allocate(childBox, flags);
             this.actor.set_skip_paint(children[i], false);
         }
@@ -733,6 +730,7 @@ const AllView = new Lang.Class({
     _updatedNPages: function(iconGrid, nPages) {
         // We don't need a relayout because we already done it at iconGrid
         // when pages are calculated (and then the signal is emitted before that)");
+        global.log("Update n pages " + nPages);
         this._paginationIndicator._nPages = nPages;
         this._paginationView.invalidatePagination = true;
     },
@@ -766,7 +764,10 @@ const AllView = new Lang.Class({
     },
     
     goToPage: function(index, action) {
-        
this._paginationIndicator.actor.get_child_at_index(this._paginationView.currentPage()).set_checked(false);
+        // Since it can happens after a relayout, we have to ensure that all is unchecked
+        let indicators = this._paginationIndicator.actor.get_children();
+        for(let index in indicators)
+            indicators[index].set_checked(false);
         this._paginationView.goToPage(index, action);
         
this._paginationIndicator.actor.get_child_at_index(this._paginationView.currentPage()).set_checked(true);
     },
@@ -1241,17 +1242,12 @@ const FolderView = new Lang.Class({
     usedWidth: function() {
         let box = this._containerBox();
         let availWidthPerPage = box.x2 - box.x1;
-        global.log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
-        global.log("AvailWidth " + availWidthPerPage);
         // Since we want to do the calculation of the real width of the grid
         // taking into account the parent behaviour, we have to substract from the
         // avail width the padding we subsctratc before to the folder view
         // in its surrounding spacings
         availWidthPerPage -= 2 * this._offsetForEachSide;
-        global.log("AvailWidth after " + availWidthPerPage);
         let maxUsedWidth = this._grid.usedWidth(availWidthPerPage);
-        global.log("maxUsedWidth " + maxUsedWidth);
-        global.log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
         return maxUsedWidth;
     },
     
@@ -1264,19 +1260,14 @@ const FolderView = new Lang.Class({
         let box = this._containerBox();
         let availHeightPerPage = box.y2 - box.y1;
         let availWidthPerPage = box.x2 - box.x1;
-        global.log("///////////////////////////");
         //FIXME: if we do that, we really not showing the maximum of rows we can show on collection view
         // Since we want to do the calculation of the real width of the grid
         // taking into account the parent behaviour, we have to substract from the
         // avail width the padding we subsctratc before to the folder view
         // in its surrounding spacings
-        global.log("Avail height BEF" + availHeightPerPage);
         availWidthPerPage -= 2 * this._offsetForEachSide;
         availHeightPerPage -= 2 * this._offsetForEachSide;
         
-        global.log("Avail height " + availHeightPerPage);
-        global.log("///////////////////////////");
-
         let maxRowsDisplayedAtOnce = this.maxRowsDisplayedAtOnce();
         let usedRows = this._grid.nUsedRows(availWidthPerPage);
         usedRows = usedRows <= maxRowsDisplayedAtOnce ? usedRows : maxRowsDisplayedAtOnce;
@@ -1291,7 +1282,6 @@ const FolderView = new Lang.Class({
         // taking into account the parent behaviour, we have to substract from the
         // avail width the padding we subsctratc before to the folder view
         // in its surrounding spacings
-        global.log("Avail height BEF" + availHeightPerPage);
         availHeightPerPage -= 2 * this._offsetForEachSide;
         let maxRowsPerPage = this._grid.rowsForHeight(availHeightPerPage);
         //Then, we can only show that rows least one.
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 7f752ad..63453de 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -382,29 +382,18 @@ const IconGrid = new Lang.Class({
     },
     
     _calculatePaginationValues: function (availHeightPerPage, nColumns, nRows) {
-        global.log("########## START PAGINATION ########");
         let spacing = this.getSpacing();
-        global.log("availHeightPerPage " + availHeightPerPage);
-        global.log("nColumns " + nColumns);
-        global.log("nRows " + nRows);
-        global.log("spacing " + spacing);
         this._spacePerRow = this._vItemSize + spacing;
         // We want to contain the grid inside the parent box with padding
         availHeightPerPage -= this.top_padding + this.bottom_padding;
-        global.log("availHeightPerPage no padding " + availHeightPerPage);
-        global.log("this._spacePerRow " + this._spacePerRow); 
         this._rowsPerPage = Math.floor(availHeightPerPage / this._spacePerRow);
-        global.log("Rows per page " + this._rowsPerPage);
         // Check if deleting spacing from bottom there's enough space for another row
         let spaceWithOneMoreRow = (this._rowsPerPage + 1) * this._spacePerRow - spacing;
         this._rowsPerPage = spaceWithOneMoreRow <= availHeightPerPage? this._rowsPerPage + 1 : 
this._rowsPerPage;
-        global.log("this._rowsPerPage " + this._rowsPerPage);
         this._nPages = Math.ceil(nRows / this._rowsPerPage);
-        global.log("this._nPages "  + this._nPages);
         this._spaceBetweenPages = availHeightPerPage - (this._rowsPerPage * (this._vItemSize + spacing) - 
spacing);
         this._spaceBetweenPagesTotal = this._spaceBetweenPages * (this._nPages);
         this._childrenPerPage = nColumns * this._rowsPerPage;
-        global.log("########## END PAGINATION ########");
     },
     
     _calculateChildrenBox: function(child, x, y, box) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]