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



commit 302853d49f5c3b89151a77879ac0d80c443d303b
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 cb67ce4..5e45e1c 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -299,6 +299,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) {
@@ -553,6 +562,8 @@ 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 quit overview
+        Main.overview.connect('hidden', Lang.bind(this, function() {this.goToPage(0);}));
     },
 
     _updatedNPages: function(iconGrid, nPages) {
@@ -599,10 +610,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]