From 3006c05ea5d353c2f62238b6c2c3912619128566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 10 Jul 2023 05:12:30 +0200 Subject: [PATCH] extensions: Simplify openPrefs() The module is now only used inside the gnome-shell process, so we don't have to handle the case where it is used from prefs, and we can use regular imports for shell modules. Part-of: --- js/extensions/extension.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/js/extensions/extension.js b/js/extensions/extension.js index 125b7a350..b9e72584a 100644 --- a/js/extensions/extension.js +++ b/js/extensions/extension.js @@ -8,6 +8,8 @@ export { pgettext } from './sharedInternals.js'; +const {extensionManager} = imports.ui.main; + /** * Open the preference dialog of the current extension */ @@ -17,12 +19,5 @@ export function openPrefs() { if (!extension) throw new Error('openPrefs() can only be called from extensions'); - try { - const extensionManager = imports.ui.main.extensionManager; - extensionManager.openExtensionPrefs(extension.uuid, '', {}); - } catch (e) { - if (e.name === 'ImportError') - throw new Error('openPrefs() cannot be called from preferences'); - logError(e, 'Failed to open extension preferences'); - } + extensionManager.openExtensionPrefs(extension.uuid, '', {}); }