From f42a26bcf16d4c6bd93eb83f5f97ff8739f6f465 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Wed, 16 Aug 2023 12:26:30 +0100 Subject: [PATCH] Use addExternalIndicator to add quick settings entries --- extension/extension.js | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/extension/extension.js b/extension/extension.js index df331c8..6a5c8f0 100644 --- a/extension/extension.js +++ b/extension/extension.js @@ -249,34 +249,17 @@ class QuickSettingsManager { ]; //Create a quick setting toggle for each privacy setting - quickSettingsInfo.forEach((quickSettingInfo) => { + quickSettingsInfo.forEach((quickSettingInfo, i) => { this._quickSettingToggles.push( new PrivacyQuickToggle( - quickSettingInfo[0], - quickSettingInfo[1], - quickSettingInfo[2], - quickSettingInfo[3], + quickSettingInfo[0], quickSettingInfo[1], + quickSettingInfo[2], quickSettingInfo[3], quickSettingInfo[4] ) ); - }); - //Add the toggles to the system menu - QuickSettingsMenu._addItems(this._quickSettingToggles); - -/* TODO: - - This is a bad idea - - When the shell provides a better way to add above background apps, it should be used instead - - This is a temporary hacky fix - - GLib import should also be dropped when the fix is removed -*/ - - //Place the toggles above the background apps entry - GLib.idle_add(GLib.PRIORITY_LOW, () => { - this._quickSettingToggles.forEach((item) => { - QuickSettingsMenu.menu._grid.set_child_below_sibling(item, - QuickSettingsMenu._backgroundApps.quickSettingsItems[0]); - }); + //Add the toggle to the system menu + QuickSettingsMenu.addExternalIndicator(this._quickSettingToggles[i]); }); } @@ -293,14 +276,9 @@ class QuickSettingsManager { class QuickGroupManager { constructor(useQuickSubtitle) { + //Create quick settings group and add to the system menu this._quickSettingsGroup = new PrivacyQuickGroup(useQuickSubtitle); - - //Add the toggles to the system menu - QuickSettingsMenu._addItems([this._quickSettingsGroup]); - - //Place the toggles above the background apps entry - QuickSettingsMenu.menu._grid.set_child_below_sibling(this._quickSettingsGroup, - QuickSettingsMenu._backgroundApps.quickSettingsItems[0]); + QuickSettingsMenu.addExternalIndicator(this._quickSettingsGroup); } clean() {