Don't remove keybinding if it wasn't added

This commit is contained in:
Romain Vigier
2020-08-07 13:30:55 +02:00
parent d7c56f44da
commit 14a209a45a
+4
View File
@@ -41,6 +41,7 @@ var TimerOndemand = class {
constructor() { constructor() {
this._button = null; this._button = null;
this._previousKeybinding = null;
this._ondemandKeybindingConnect = null; this._ondemandKeybindingConnect = null;
this._ondemandButtonPlacementConnect = null; this._ondemandButtonPlacementConnect = null;
} }
@@ -99,6 +100,7 @@ var TimerOndemand = class {
_addKeybinding() { _addKeybinding() {
this._previousKeybinding = e.settingsManager.ondemandKeybinding;
if (!e.settingsManager.ondemandKeybinding) if (!e.settingsManager.ondemandKeybinding)
return; return;
logDebug('Adding On-demand Timer keybinding...'); logDebug('Adding On-demand Timer keybinding...');
@@ -113,10 +115,12 @@ var TimerOndemand = class {
} }
_removeKeybinding() { _removeKeybinding() {
if (this._previousKeybinding) {
logDebug('Removing On-demand Timer keybinding...'); logDebug('Removing On-demand Timer keybinding...');
main.wm.removeKeybinding('nightthemeswitcher-ondemand-keybinding'); main.wm.removeKeybinding('nightthemeswitcher-ondemand-keybinding');
logDebug('Removed On-demand Timer keybinding.'); logDebug('Removed On-demand Timer keybinding.');
} }
}
_addButton() { _addButton() {
switch (e.settingsManager.ondemandButtonPlacement) { switch (e.settingsManager.ondemandButtonPlacement) {