[gnome-documents/gnome-3-16] embed: Unbreak re-activation before the inactivity timeout
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-16] embed: Unbreak re-activation before the inactivity timeout
- Date: Tue, 17 Mar 2015 20:41:07 +0000 (UTC)
commit 0b4ef5a25fb234a3693a7b3a6e3e91021c83a1fa
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Mar 13 19:41:34 2015 +0100
embed: Unbreak re-activation before the inactivity timeout
When we build the UI for the second time, we need to populate the
ViewModels with the items already present in the DocumentManager. We
lost this as a fall out from 4c7ffba09ac512c2814d4518cc2a63b61f942334
We also need to remove the rowRefs on each item when clearing the
application state. The rowRefs are used as markers to indicate if they
are already part of a ViewModel. If we don't clear them, then the
ViewModel's filtering mechanism will prevent the items from being
re-added when the application is re-activated.
https://bugzilla.gnome.org/show_bug.cgi?id=744643
src/application.js | 1 +
src/documents.js | 7 +++++++
src/view.js | 6 ++++++
3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 524c3fc..e38444f 100644
--- a/src/application.js
+++ b/src/application.js
@@ -704,6 +704,7 @@ const Application = new Lang.Class({
this.disconnectAllJS();
// reset state
+ documentManager.clearRowRefs();
documentManager.setActiveItem(null);
modeController.setWindowMode(WindowMode.WindowMode.NONE);
selectionController.setSelection(null);
diff --git a/src/documents.js b/src/documents.js
index 39cdb48..b378f5f 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -1222,6 +1222,13 @@ const DocumentManager = new Lang.Class({
this.parent();
},
+ clearRowRefs: function() {
+ let items = this.getItems();
+ for (let idx in items) {
+ items[idx].rowRefs = {};
+ }
+ },
+
getActiveCollection: function() {
return this._activeCollection;
},
diff --git a/src/view.js b/src/view.js
index 1e46f7b..a73574d 100644
--- a/src/view.js
+++ b/src/view.js
@@ -98,6 +98,12 @@ const ViewModel = new Lang.Class({
return;
this._clear();
}));
+
+ // populate with the initial items
+ let items = Application.documentManager.getItems();
+ for (let idx in items) {
+ this._onItemAdded(Application.documentManager, items[idx]);
+ }
},
_clear: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]