mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
For the time being this mostly means re-exporting functions from the shared module. However openPrefs() is now only available to extensions, and we stop exporting both getCurrentExtension() and setExtensionManager() to either extensions or prefs. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2837>
28 lines
763 B
JavaScript
28 lines
763 B
JavaScript
import {getCurrentExtension} from './sharedInternals.js';
|
|
|
|
export {
|
|
getSettings,
|
|
initTranslations,
|
|
gettext,
|
|
ngettext,
|
|
pgettext
|
|
} from './sharedInternals.js';
|
|
|
|
/**
|
|
* Open the preference dialog of the current extension
|
|
*/
|
|
export function openPrefs() {
|
|
const extension = getCurrentExtension();
|
|
|
|
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');
|
|
}
|
|
}
|