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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
This commit is contained in:
parent
6a46d338e7
commit
3006c05ea5
@ -8,6 +8,8 @@ export {
|
|||||||
pgettext
|
pgettext
|
||||||
} from './sharedInternals.js';
|
} from './sharedInternals.js';
|
||||||
|
|
||||||
|
const {extensionManager} = imports.ui.main;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the preference dialog of the current extension
|
* Open the preference dialog of the current extension
|
||||||
*/
|
*/
|
||||||
@ -17,12 +19,5 @@ export function openPrefs() {
|
|||||||
if (!extension)
|
if (!extension)
|
||||||
throw new Error('openPrefs() can only be called from extensions');
|
throw new Error('openPrefs() can only be called from extensions');
|
||||||
|
|
||||||
try {
|
extensionManager.openExtensionPrefs(extension.uuid, '', {});
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user