[extensions-web] js: Allow uninstallation of all extensions, just don't support undo



commit ae2d1c2fe67ebdb9ac11b8551049e7ec56bd405d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Apr 1 11:16:15 2012 -0400

    js: Allow uninstallation of all extensions, just don't support undo

 sweettooth/static/js/extensions.js |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 4e5019e..41ae4ab 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -199,13 +199,18 @@ function($, messages, dbusProxy, extensionUtils, templates) {
                         }
 
                         function uninstall() {
+                            var svm = extension.shell_version_map;
+                            var wantUndo = (extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion) !== null);
+
                             dbusProxy.UninstallExtension(uuid).done(function(result) {
                                 if (result) {
                                     $elem.fadeOut({ queue: false }).slideUp({ queue: false });
 
-                                    var $message = messages.addInfo(templates.extensions.uninstall(extension));
-                                    $message.delegate('a', 'click', reinstall);
-                                    $elem.data('undo-uninstall-message', $message);
+                                    if (wantUndo) {
+                                        var $message = messages.addInfo(templates.extensions.uninstall(extension));
+                                        $message.delegate('a', 'click', reinstall);
+                                        $elem.data('undo-uninstall-message', $message);
+                                    }
                                 }
                             });
                         }
@@ -215,9 +220,6 @@ function($, messages, dbusProxy, extensionUtils, templates) {
                         var $elem = $('<a>');
 
                         function renderExtension() {
-                            var svm = extension.shell_version_map;
-                            if (svm)
-                                extension.want_uninstall = (extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion) !== null);
                             extension.want_configure = (extension.hasPrefs && extension.state !== ExtensionState.OUT_OF_DATE);
 
                             $elem = $(templates.extensions.info(extension)).replaceAll($elem);



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