[gnome-shell/wip/paging-release: 74/93] AppDisplay: Start always at page 0
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/paging-release: 74/93] AppDisplay: Start always at page 0
- Date: Mon, 12 Aug 2013 17:18:00 +0000 (UTC)
commit 9be49efaf6e719e780cfe54e90a0cababe5d65be
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 b544188..dd0452e 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]