[gnome-shell/wip/paging-release: 66/85] AppDisplay: Start always at page 0



commit 87401d711b451e7509b05e08d89fba2617d4d6ed
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Mon Aug 12 15:21:32 2013 +0200

    AppDisplay: Start always at page 0
    
    AppDisplay: Always start at page 0

 js/ui/appDisplay.js |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 534392b..32039e6 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -443,9 +443,14 @@ const PaginationScrollView = new Lang.Class({
         
         this._verticalAdjustment.page_size = availHeight;
         this._verticalAdjustment.upper = this._stack.height;
-        
-        if(this.invalidatePagination)
-            this.goToPage(0);
+        if(this.invalidatePagination) {
+            // we can modify our adjustment, so we do that to show the first page, but we can't modify the 
indicators,
+            // so we modify it before redraw (we won't see too much flickering at all)
+            if(this._pages.nPages() > 1) {
+                this.goToPage(0);
+                Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() 
{this._parent.goToPage(0);}));
+            }
+        }
         this.invalidatePagination = false;
     },
 
@@ -725,12 +730,13 @@ const AllView = new Lang.Class({
         }
 
         this._paginationView._pages._grid.connect('n-pages-changed', Lang.bind(this, this._updatedNPages));
+        // Always start at page 0 when we enter and wuit overview
+        Main.overview.connect('shown', Lang.bind(this, function() {this.goToPage(0);}));
     },
     
     _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;
     },
@@ -764,10 +770,12 @@ const AllView = new Lang.Class({
     },
     
     goToPage: function(index, action) {
+        if(!this._paginationView.nPages())
+            return;
         // 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);
+        for(let i in indicators)
+            indicators[i].set_checked(false);
         this._paginationView.goToPage(index, action);
         
this._paginationIndicator.actor.get_child_at_index(this._paginationView.currentPage()).set_checked(true);
     },


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