[the-board] [ui] Save current page model before switching pages
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Save current page model before switching pages
- Date: Sun, 19 Dec 2010 22:12:10 +0000 (UTC)
commit 9bb3d929fabc599acc429c4bb830a848fac5d83b
Author: Lucas Rocha <lucasr gnome org>
Date: Sun Dec 19 22:10:44 2010 +0000
[ui] Save current page model before switching pages
https://bugzilla.gnome.org/show_bug.cgi?id=637483
src/js/ui/mainWindow.js | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 17c3d2c..e4eefac 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -55,6 +55,8 @@ MainWindow.prototype = {
this._thingToolbar = null;
this._toolbarsByThingId = {};
+ this._savingOldCurrentPage = false;
+
this._createGtkWindow();
this._createClutterEmbed();
this._createStatusIcon();
@@ -477,6 +479,7 @@ MainWindow.prototype = {
_updateSpinner : function() {
if (this._currentPage &&
this._currentPage.loaded &&
+ !this._savingOldCurrentPage &&
!this._animatingPageTurn) {
this._hideSpinner();
} else {
@@ -489,6 +492,15 @@ MainWindow.prototype = {
this._updateStartupBox();
},
+ _setSavingOldCurrentPage : function(savingOldCurrentPage) {
+ if (this._savingOldCurrentPage == savingOldCurrentPage) {
+ return;
+ }
+
+ this._savingOldCurrentPage = savingOldCurrentPage;
+ this._updateSpinner();
+ },
+
_setAnimatingPageTurn : function(animatingPageTurn) {
if (this._animatingPageTurn == animatingPageTurn) {
return;
@@ -798,11 +810,18 @@ MainWindow.prototype = {
Lang.bind(this, this._onPageLoadedChanged));
if (oldCurrentPage) {
- if (this._currentPage.model.id > oldCurrentPage.model.id) {
- this._animateNextPage(this._currentPage, oldCurrentPage);
- } else {
- this._animatePreviousPage(this._currentPage, oldCurrentPage);
- }
+ let onModelSaved = function() {
+ this._setSavingOldCurrentPage(false);
+
+ if (this._currentPage.model.id > oldCurrentPage.model.id) {
+ this._animateNextPage(this._currentPage, oldCurrentPage);
+ } else {
+ this._animatePreviousPage(this._currentPage, oldCurrentPage);
+ }
+ };
+
+ this._setSavingOldCurrentPage(true);
+ oldCurrentPage.model.save(Lang.bind(this, onModelSaved));
} else {
this._contentBox.append(this._currentPage.actor,
Tb.BoxPackFlags.EXPAND);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]