From b953ba50ba3ce6f719111432071d36e82d81924f Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Sat, 10 Jun 2023 00:10:38 +0100 Subject: [PATCH] Switch to strings for menu type, rather than a boolean This is in preparation for a third type of menu --- extension/extension.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/extension/extension.js b/extension/extension.js index f892b80..bd47824 100644 --- a/extension/extension.js +++ b/extension/extension.js @@ -227,9 +227,15 @@ class Extension { this._extensionSettings.disconnect(this._settingsChangedSignal); } - _useQuickSettings() { - //Return true if running GNOME 43+ and quick settings are enabled - return this._extensionSettings.get_boolean('use-quick-settings') && ShellVersion >= 43; + _decideMenuType() { + //Return 'quick-toggles' if running GNOME 43+ and quick settings are enabled + if (this._extensionSettings.get_boolean('use-quick-settings')) { + if (ShellVersion >= 43) { + return 'quick-toggles'; + } + } + + return 'indicator'; } initMenu() { @@ -246,9 +252,10 @@ class Extension { _createMenu() { //Create the correct type of menu, from preference and capabilities - if (this._useQuickSettings()) { + let menuType = this._decideMenuType(); + if (menuType == 'quick-toggles') { this._privacyManager = new QuickSettingsManager(); - } else { + } else if (menuType == 'indicator') { this._privacyManager = new IndicatorSettingsManager(); } }