[gnome-shell] shellDBus: Fix reloadExtension



commit 4ca26972714e9750bcf38fd47ac841aaba6cb714
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Aug 23 22:37:50 2012 -0300

    shellDBus: Fix reloadExtension
    
    We need to recreate and reimport the extension here, not just reimport
    the same exact code.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682578

 js/ui/extensionSystem.js |   13 +++++++++++++
 js/ui/shellDBus.js       |    7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
index ac4acbb..4eb49c1 100644
--- a/js/ui/extensionSystem.js
+++ b/js/ui/extensionSystem.js
@@ -171,6 +171,19 @@ function unloadExtension(extension) {
     return true;
 }
 
+function reloadExtension(oldExtension) {
+    // Grab the things we'll need to pass to createExtensionObject
+    // to reload it.
+    let { uuid: uuid, dir: dir, type: type } = oldExtension;
+
+    // Then unload the old extension.
+    unloadExtension(oldExtension);
+
+    // Now, recreate the extension and load it.
+    let newExtension = ExtensionUtils.createExtensionObject(uuid, dir, type);
+    loadExtension(newExtension);
+}
+
 function initExtension(uuid) {
     let extension = ExtensionUtils.extensions[uuid];
     let dir = extension.dir;
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 53a6523..78aebab 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -318,8 +318,11 @@ const GnomeShellExtensions = new Lang.Class({
     },
 
     ReloadExtension: function(uuid) {
-        ExtensionSystem.unloadExtension(uuid);
-        ExtensionSystem.loadExtension(uuid);
+        let extension = ExtensionUtils.extensions[uuid];
+        if (!extension)
+            return;
+
+        ExtensionSystem.reloadExtension(extension);
     },
 
     CheckForUpdates: function() {



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