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



commit 76f7f95c2663a4d37a32b7c3102e35b582cf6ca5
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
    
    AllView: start at page 0 on hidden overview!

 js/ui/appDisplay.js |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 83efba7..2e5eb09 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -301,6 +301,15 @@ const PaginationScrollView = new Lang.Class({
         
         this._verticalAdjustment.page_size = availHeight;
         this._verticalAdjustment.upper = this._stack.height;
+        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;
     },
 
     goToPage: function(pageNumber, action) {
@@ -547,6 +556,8 @@ const AllView = new Lang.Class({
             this._paginationIndicator.actor.add_actor(indicatorIcon.actor);
         }
         this._paginationView._pages._grid.connect('n-pages-changed', Lang.bind(this, this._updatedNPages));
+        // Always start at page 0 when we enter and quit overview
+        Main.overview.connect('hidden', Lang.bind(this, function() {this.goToPage(0);}));
     },
 
     _updatedNPages: function(iconGrid, nPages) {
@@ -593,10 +604,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]