extensionUtils: Remove userExtensionsDir
Make this less stateful https://bugzilla.gnome.org/show_bug.cgi?id=677586
This commit is contained in:
parent
cdbe0bbf38
commit
5265884af9
@ -268,7 +268,6 @@ function initEnvironment() {
|
|||||||
|
|
||||||
function main(argv) {
|
function main(argv) {
|
||||||
initEnvironment();
|
initEnvironment();
|
||||||
ExtensionUtils.init();
|
|
||||||
|
|
||||||
Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||||
Gettext.textdomain(Config.GETTEXT_PACKAGE);
|
Gettext.textdomain(Config.GETTEXT_PACKAGE);
|
||||||
|
@ -14,9 +14,6 @@ const ExtensionType = {
|
|||||||
PER_USER: 2
|
PER_USER: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// GFile for user extensions
|
|
||||||
var userExtensionsDir = null;
|
|
||||||
|
|
||||||
// Maps uuid -> metadata object
|
// Maps uuid -> metadata object
|
||||||
const extensions = {};
|
const extensions = {};
|
||||||
|
|
||||||
@ -152,11 +149,6 @@ function installImporter(extension) {
|
|||||||
_extension = null;
|
_extension = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
|
||||||
let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
|
|
||||||
userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
function scanExtensionsInDirectory(callback, dir, type) {
|
function scanExtensionsInDirectory(callback, dir, type) {
|
||||||
let fileEnum;
|
let fileEnum;
|
||||||
let file, info;
|
let file, info;
|
||||||
@ -179,8 +171,10 @@ function scanExtensionsInDirectory(callback, dir, type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function scanExtensions(callback) {
|
function scanExtensions(callback) {
|
||||||
let systemDataDirs = GLib.get_system_data_dirs();
|
let userExtensionsDir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions']));
|
||||||
scanExtensionsInDirectory(callback, userExtensionsDir, ExtensionType.PER_USER);
|
scanExtensionsInDirectory(callback, userExtensionsDir, ExtensionType.PER_USER);
|
||||||
|
|
||||||
|
let systemDataDirs = GLib.get_system_data_dirs();
|
||||||
for (let i = 0; i < systemDataDirs.length; i++) {
|
for (let i = 0; i < systemDataDirs.length; i++) {
|
||||||
let dirPath = GLib.build_filenamev([systemDataDirs[i], 'gnome-shell', 'extensions']);
|
let dirPath = GLib.build_filenamev([systemDataDirs[i], 'gnome-shell', 'extensions']);
|
||||||
let dir = Gio.file_new_for_path(dirPath);
|
let dir = Gio.file_new_for_path(dirPath);
|
||||||
|
@ -66,7 +66,7 @@ function gotExtensionZipFile(session, message, uuid) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
|
let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
|
||||||
try {
|
try {
|
||||||
if (!dir.query_exists(null))
|
if (!dir.query_exists(null))
|
||||||
dir.make_directory_with_parents(null);
|
dir.make_directory_with_parents(null);
|
||||||
|
@ -257,8 +257,6 @@ function onEnabledExtensionsChanged() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
ExtensionUtils.init();
|
|
||||||
|
|
||||||
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
|
||||||
enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user