commit 86b50427814e7a3e8180dfc2a516a363df1d017e
parent e787bb11836ba020a82de569e2eaf19d43c4c6a4
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 1 Jul 2016 17:51:40 -0400
Rename _rememberOpenStates() to _saveOpenStates() in collectionTreeView
Diffstat:
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js
@@ -879,7 +879,7 @@ Zotero.CollectionTreeView.prototype.toggleOpenState = Zotero.Promise.coroutine(f
this._rows[row].isOpen = true;
this._treebox.invalidateRow(row);
this._refreshRowMap();
- this._startRememberOpenStatesTimer();
+ this._startSaveOpenStatesTimer();
});
@@ -899,7 +899,7 @@ Zotero.CollectionTreeView.prototype._closeContainer = function (row) {
this._rows[row].isOpen = false;
this._treebox.invalidateRow(row);
this._refreshRowMap();
- this._startRememberOpenStatesTimer();
+ this._startSaveOpenStatesTimer();
}
@@ -907,13 +907,13 @@ Zotero.CollectionTreeView.prototype._closeContainer = function (row) {
* After a short delay, persist the open states of the tree, or if already queued, cancel and requeue.
* This avoids repeated saving while opening or closing multiple rows.
*/
-Zotero.CollectionTreeView.prototype._startRememberOpenStatesTimer = function () {
- if (this._rememberOpenStatesTimeoutID) {
- clearTimeout(this._rememberOpenStatesTimeoutID);
+Zotero.CollectionTreeView.prototype._startSaveOpenStatesTimer = function () {
+ if (this._saveOpenStatesTimeoutID) {
+ clearTimeout(this._saveOpenStatesTimeoutID);
}
- this._rememberOpenStatesTimeoutID = setTimeout(() => {
- this._rememberOpenStates();
- this._rememberOpenStatesTimeoutID = null;
+ this._saveOpenStatesTimeoutID = setTimeout(() => {
+ this._saveOpenStates();
+ this._saveOpenStatesTimeoutID = null;
}, 250)
};
@@ -1011,10 +1011,10 @@ Zotero.CollectionTreeView.prototype.collapseLibrary = function (libraryID) {
this.selection.select(row);
// We have to manually delete closed rows from the container state object, because otherwise
- // _rememberOpenStates() wouldn't see any of the rows under the library (since the library is now
+ // _saveOpenStates() wouldn't see any of the rows under the library (since the library is now
// collapsed) and they'd remain as open in the persisted object.
closed.forEach(id => { delete this._containerState[id]; });
- this._rememberOpenStates();
+ this._saveOpenStates();
return true;
};
@@ -1385,7 +1385,7 @@ Zotero.CollectionTreeView.prototype._refreshRowMap = function() {
/**
* Persist the current open/closed state of rows to a pref
*/
-Zotero.CollectionTreeView.prototype._rememberOpenStates = Zotero.Promise.coroutine(function* () {
+Zotero.CollectionTreeView.prototype._saveOpenStates = Zotero.Promise.coroutine(function* () {
var state = this._containerState;
// Every so often, remove obsolete rows
diff --git a/test/tests/collectionTreeViewTest.js b/test/tests/collectionTreeViewTest.js
@@ -91,7 +91,7 @@ describe("Zotero.CollectionTreeView", function() {
it("should open a library and respect stored container state", function* () {
// Collapse B
yield cv.toggleOpenState(cv.getRowIndexByID(col2.treeViewID));
- yield cv._rememberOpenStates();
+ yield cv._saveOpenStates();
// Close and reopen library
yield cv.toggleOpenState(libraryRow);
@@ -104,7 +104,7 @@ describe("Zotero.CollectionTreeView", function() {
it("should open a library and all subcollections in recursive mode", function* () {
yield cv.toggleOpenState(cv.getRowIndexByID(col2.treeViewID));
- yield cv._rememberOpenStates();
+ yield cv._saveOpenStates();
// Close and reopen library
yield cv.toggleOpenState(libraryRow);