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

Commit

Permalink
Merge pull request #9030 from MarcelGerber/errors-statusbar-pref
Browse files Browse the repository at this point in the history
Make "Show Errors in Status Bar" pref more solid
  • Loading branch information
redmunds committed Oct 13, 2014
2 parents 5442320 + 8a29009 commit 3afa289
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/extensions/default/DebugCommands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,11 @@ define(function (require, exports, module) {
}

function toggleErrorNotification(bool) {
var val;
var val,
oldPref = !!PreferencesManager.get(DEBUG_SHOW_ERRORS_IN_STATUS_BAR);

if (typeof bool === "undefined") {
val = !PreferencesManager.get(DEBUG_SHOW_ERRORS_IN_STATUS_BAR);
if (bool === undefined) {
val = !oldPref;
} else {
val = !!bool;
}
Expand All @@ -249,7 +250,9 @@ define(function (require, exports, module) {

// update menu
CommandManager.get(DEBUG_SHOW_ERRORS_IN_STATUS_BAR).setChecked(val);
PreferencesManager.set(DEBUG_SHOW_ERRORS_IN_STATUS_BAR, val);
if (val !== oldPref) {
PreferencesManager.set(DEBUG_SHOW_ERRORS_IN_STATUS_BAR, val);
}
}

function handleOpenBracketsSource() {
Expand Down Expand Up @@ -287,6 +290,10 @@ define(function (require, exports, module) {

enableRunTestsMenuItem();
toggleErrorNotification(PreferencesManager.get(DEBUG_SHOW_ERRORS_IN_STATUS_BAR));

PreferencesManager.on("change", DEBUG_SHOW_ERRORS_IN_STATUS_BAR, function () {
toggleErrorNotification(PreferencesManager.get(DEBUG_SHOW_ERRORS_IN_STATUS_BAR));
});

/*
* Debug menu
Expand Down

0 comments on commit 3afa289

Please sign in to comment.