Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
busykai committed Feb 25, 2014
1 parent 870a9ef commit bc4f1f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
5 changes: 2 additions & 3 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ define({
"ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} <span class='dialog-filename'>{1}</span>. {2}",

// Application preferences corrupt error strings
"ERROR_PREFS_CORRUPT_TITLE" : "Preferences file is corrupt",
"ERROR_PREFS_CORRUPT" : "{APP_NAME} preferences file is not a valid JSON and cannot be parsed. It will now be opened so that you could fix it. You will need to restart or reload {APP_NAME} for the changes to take effect.",

"ERROR_PREFS_CORRUPT_TITLE" : "Error reading preferences",
"ERROR_PREFS_CORRUPT" : "Your preferences file is not valid JSON. The file will be opened so that you can correct the format. You will need to restart {APP_NAME} for the changes to take effect.",

// Application error strings
"ERROR_IN_BROWSER_TITLE" : "Oops! {APP_NAME} doesn't run in browsers yet.",
Expand Down
20 changes: 5 additions & 15 deletions src/preferences/PreferencesBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -1034,11 +1034,11 @@ define(function (require, exports, module) {
scopeOrder: ["default"],
_shadowScopeOrder: [{
id: "default",
scope: this._scopes["default"],
promise: (new $.Deferred()).resolve().promise()
}]
};

this._pendingEvents = {};
this._pendingScopes = {};

this._saveInProgress = false;
Expand Down Expand Up @@ -1257,7 +1257,6 @@ define(function (require, exports, module) {
.fail(function (err) {
// clean up all what's been done up to this point
_.pull(shadowScopeOrder, shadowEntry);
delete this._pendingEvents[id];
}.bind(this));
if (this._pendingScopes[id]) {
var pending = this._pendingScopes[id];
Expand Down Expand Up @@ -1298,14 +1297,14 @@ define(function (require, exports, module) {
if (scope) {
_.pull(this._defaultContext.scopeOrder, id);
var $this = $(this);
$(scope).off(".prefsys");
$this.trigger(SCOPEORDER_CHANGE, {
id: id,
action: "removed"
});
$this.trigger(PREFERENCE_CHANGE, {
ids: scope.getKeys()
});
$(scope).off(".prefsys");
}
},

Expand Down Expand Up @@ -1377,22 +1376,13 @@ define(function (require, exports, module) {
if (!scope) {
return;
}
delete this._scopes[id];
delete this._pendingEvents[id];
_.pull(this._defaultContext.scopeOrder, id);

this.removeFromScopeOrder(id);
shadowIndex = _.findIndex(this._defaultContext._shadowScopeOrder, function (entry) {
return entry.id === id;
});
this._defaultContext._shadowScopeOrder.splice(shadowIndex, 1);
$(this).trigger(SCOPEORDER_CHANGE, {
id: id,
action: "removed"
});
$(this).trigger(PREFERENCE_CHANGE, {
ids: scope.getKeys()
});

$(scope).off(PREFERENCE_CHANGE);
delete this._scopes[id];
},

/**
Expand Down
6 changes: 3 additions & 3 deletions src/preferences/PreferencesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ define(function (require, exports, module) {
* @private
* @type {$.Deferred}
*/
var _deferred = new $.Deferred();
var _prefManagerReadyDeferred = new $.Deferred();

/**
* Promises to add scopes. Used at init time only.
Expand Down Expand Up @@ -292,7 +292,7 @@ define(function (require, exports, module) {

Async.waitForAll(_addScopePromises)
.always(function () {
_deferred.resolve();
_prefManagerReadyDeferred.resolve();
});
});

Expand Down Expand Up @@ -639,7 +639,6 @@ define(function (require, exports, module) {
}

// Private API for unit testing and use elsewhere in Brackets core
exports.ready = _deferred.promise();
exports._isUserScopeCorrupt = function () { return _userScopeCorrupt; };
exports._manager = preferencesManager;
exports._setCurrentEditingFile = _setCurrentEditingFile;
Expand All @@ -651,6 +650,7 @@ define(function (require, exports, module) {
exports.CURRENT_FILE = CURRENT_FILE;
exports.CURRENT_PROJECT = CURRENT_PROJECT;

exports.ready = _prefManagerReadyDeferred.promise();
exports.getUserPrefFile = getUserPrefFile;
exports.get = get;
exports.set = set;
Expand Down

0 comments on commit bc4f1f4

Please sign in to comment.