From e432687831ef9fbeb8d03a932a37fee5ace646f2 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Fri, 6 Oct 2017 10:29:05 -0700 Subject: [PATCH] Update QuickSwitch context menu whenever it changes. Fix #1225. --- .../src/module/options.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/omega-target-chromium-extension/src/module/options.coffee b/omega-target-chromium-extension/src/module/options.coffee index 6db128d..525d705 100644 --- a/omega-target-chromium-extension/src/module/options.coffee +++ b/omega-target-chromium-extension/src/module/options.coffee @@ -277,14 +277,12 @@ class ChromeOptions extends OmegaTarget.Options }) _quickSwitchInit: false - _quickSwitchContextMenuCreated: false + _quickSwitchHandlerReady: false _quickSwitchCanEnable: false setQuickSwitch: (quickSwitch, canEnable) -> @_quickSwitchCanEnable = canEnable - if not @_quickSwitchContextMenuCreated - @_quickSwitchContextMenuCreated = true - if quickSwitch - chrome.contextMenus?.update('enableQuickSwitch', {checked: true}) + if not @_quickSwitchHandlerReady + @_quickSwitchHandlerReady = true window.OmegaContextMenuQuickSwitchHandler = (info) => changes = {} changes['-enableQuickSwitch'] = info.checked @@ -319,6 +317,8 @@ class ChromeOptions extends OmegaTarget.Options chrome.tabs.reload(tab.id) else chrome.browserAction.setPopup({popup: 'popup/index.html'}) + + chrome.contextMenus?.update('enableQuickSwitch', {checked: !!quickSwitch}) Promise.resolve() setInspect: (settings) ->