[gnome-shell] extensionUtils: Remove userExtensionsDir



commit 5265884af9aa82a8c63acc0b4862900a58937930
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Jun 3 23:13:15 2012 -0400

    extensionUtils: Remove userExtensionsDir
    
    Make this less stateful
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677586

 js/extensionPrefs/main.js    |    1 -
 js/misc/extensionUtils.js    |   12 +++---------
 js/ui/extensionDownloader.js |    2 +-
 js/ui/extensionSystem.js     |    2 --
 4 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index c924af5..a403cdb 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -268,7 +268,6 @@ function initEnvironment() {
 
 function main(argv) {
     initEnvironment();
-    ExtensionUtils.init();
 
     Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
     Gettext.textdomain(Config.GETTEXT_PACKAGE);
diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js
index 1065f36..d086484 100644
--- a/js/misc/extensionUtils.js
+++ b/js/misc/extensionUtils.js
@@ -14,9 +14,6 @@ const ExtensionType = {
     PER_USER: 2
 };
 
-// GFile for user extensions
-var userExtensionsDir = null;
-
 // Maps uuid -> metadata object
 const extensions = {};
 
@@ -152,11 +149,6 @@ function installImporter(extension) {
     _extension = null;
 }
 
-function init() {
-    let userExtensionsPath = GLib.build_filenamev([global.userdatadir, 'extensions']);
-    userExtensionsDir = Gio.file_new_for_path(userExtensionsPath);
-}
-
 function scanExtensionsInDirectory(callback, dir, type) {
     let fileEnum;
     let file, info;
@@ -179,8 +171,10 @@ function scanExtensionsInDirectory(callback, dir, type) {
 }
 
 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);
+
+    let systemDataDirs = GLib.get_system_data_dirs();
     for (let i = 0; i < systemDataDirs.length; i++) {
         let dirPath = GLib.build_filenamev([systemDataDirs[i], 'gnome-shell', 'extensions']);
         let dir = Gio.file_new_for_path(dirPath);
diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js
index f83100d..eda3872 100644
--- a/js/ui/extensionDownloader.js
+++ b/js/ui/extensionDownloader.js
@@ -66,7 +66,7 @@ function gotExtensionZipFile(session, message, uuid) {
         return;
     }
 
-    let dir = ExtensionUtils.userExtensionsDir.get_child(uuid);
+    let dir = Gio.File.new_for_path(GLib.build_filenamev([global.userdatadir, 'extensions', uuid]));
     try {
         if (!dir.query_exists(null))
             dir.make_directory_with_parents(null);
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index fa2983a..efb9144 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -257,8 +257,6 @@ function onEnabledExtensionsChanged() {
 }
 
 function init() {
-    ExtensionUtils.init();
-
     global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
     enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]