[extensions-web] Hide uninstall button for system extensions.



commit a18e3854e7a556be868a6330c7a9385e66527d5e
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Thu Dec 1 22:45:51 2016 +0300

    Hide uninstall button for system extensions.
    
    Gnome-Bug: https://bugzilla.gnome.org/show_bug.cgi?id=772085

 .../extensions/templates/extensions/about.html     |    7 +++++++
 sweettooth/static/css/sweettooth.css               |    7 +++++++
 sweettooth/static/js/extensions.js                 |    7 ++++++-
 .../js/templates/extensions/info_contents.mustache |    7 +++++--
 sweettooth/static/js/templates/templatedata.js     |    2 +-
 5 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/about.html 
b/sweettooth/extensions/templates/extensions/about.html
index 1644d53..1832088 100644
--- a/sweettooth/extensions/templates/extensions/about.html
+++ b/sweettooth/extensions/templates/extensions/about.html
@@ -90,6 +90,13 @@ or the "Installed Extensions" page, and click the green update arrow. If
 there is no arrow, your extensions should be fully up to date.
 </p>
 
+<h2> What is «System extension»? How to uninstall it? </h2>
+<p>
+System extension is installed to system-wide location (usually «/usr/share/gnome-shell/extensions»).
+Such extension may be used by any PC user, however it can be uninstalled only by system administrator (root).
+To uninstall system extension use your distro's package manager or ask your system administrator.
+</p>
+
 {% endblock %}
 
 {% block navclass %}about{% endblock %}
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 8390511..7caa0db 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -346,6 +346,13 @@ li.extension:last-child {
     color: #445;
 }
 
+.extension .system-extension {
+    margin: 0;
+    margin-left: 8px;
+    font-size: 0.8em;
+    cursor: help;
+}
+
 .extension .author, .extension .author a {
     color: #888;
 }
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 868ab60..c136c56 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -217,7 +217,12 @@ function($, messages, dbusProxy, extensionUtils, templates) {
                         var $elem = $('<a>');
 
                         function renderExtension() {
-                            extension.want_uninstall = true;
+                            // https://git.gnome.org/browse/gnome-shell/tree/js/misc/extensionUtils.js#n16
+                            // ExtensionType.SYSTEM = 1
+                            if (extension.type === 1) {
+                                extension.system = true;
+                            }
+
                             if (extension.description)
                                 extension.first_line_of_description = extension.description.split('\n')[0];
 
diff --git a/sweettooth/static/js/templates/extensions/info_contents.mustache 
b/sweettooth/static/js/templates/extensions/info_contents.mustache
index 2f8e993..6c93e14 100644
--- a/sweettooth/static/js/templates/extensions/info_contents.mustache
+++ b/sweettooth/static/js/templates/extensions/info_contents.mustache
@@ -11,10 +11,13 @@
   {{name}}
   {{/link}}
 </h3>
+{{#system}}
+  <div class='system-extension' title='System extension should be uninstalled using package manager. See 
«About» page for more details.'>System extension</div>
+{{/system}}
 {{#creator}}
   <span class="author">by <a href="{{creator_url}}"> {{creator}} </a></span>
 {{/creator}}
 <p class="description">{{first_line_of_description}}</p>
-{{#want_uninstall}}
+{{^system}}
   <button class="uninstall" title="Uninstall">Uninstall</button>
-{{/want_uninstall}}
+{{/system}}
diff --git a/sweettooth/static/js/templates/templatedata.js b/sweettooth/static/js/templates/templatedata.js
index 601c1f2..f2a49f8 100644
--- a/sweettooth/static/js/templates/templatedata.js
+++ b/sweettooth/static/js/templates/templatedata.js
@@ -6,7 +6,7 @@ define({
   "extensions/comments_list": "{{#comments}}\n  {{>extensions/comment}}\n  
<hr>\n{{/comments}}\n{{^show_all}}\n<p class=\"show-all\">Show more 
reviews</p>\n{{/show_all}}\n\n{{^comments}}\n  <p>There are no comments. Be the first!</p>\n{{/comments}}",
   "extensions/error_report_template": "What's wrong?\n\n\n\nWhat have you tried?\n\n\n\nAutomatically 
detected errors:\n\n{{#errors}}\n  {{.}}\n\n================\n{{/errors}}\n{{^errors}}\nGNOME Shell 
Extensions did not detect any errors with this extension.\n{{/errors}}\n\nVersion information:\n\n    Shell 
version: {{sv}}\n    Extension version: {{#ev}}{{ev}}{{/ev}}{{^ev}}Unknown{{/ev}}",
   "extensions/info": "<div class=\"extension\" data-uuid=\"{{uuid}}\">\n  
{{>extensions/info_contents}}\n</div>",
-  "extensions/info_contents": "<div class=\"switch\"></div>\n<div class=\"extra-buttons\">\n  <div 
class=\"upgrade-button\" title=\"Upgrade this extension\"></div>\n  <div class=\"configure-button\" 
title=\"Configure this extension\"></div>\n</div>\n<h3 class=\"extension-name\">\n  {{#link}}\n    <a 
href=\"{{link}}\" class=\"title-link\"> <img src=\"{{icon}}\" class=\"icon\"> {{name}} </a>\n  {{/link}}\n  
{{^link}}\n  {{name}}\n  {{/link}}\n</h3>\n{{#creator}}\n  <span class=\"author\">by <a 
href=\"{{creator_url}}\"> {{creator}} </a></span>\n{{/creator}}\n<p 
class=\"description\">{{first_line_of_description}}</p>\n{{#want_uninstall}}\n  <button class=\"uninstall\" 
title=\"Uninstall\">Uninstall</button>\n{{/want_uninstall}}",
+  "extensions/info_contents": "<div class=\"switch\"></div>\n<div class=\"extra-buttons\">\n  <div 
class=\"upgrade-button\" title=\"Upgrade this extension\"></div>\n  <div class=\"configure-button\" 
title=\"Configure this extension\"></div>\n</div>\n<h3 class=\"extension-name\">\n  {{#link}}\n    <a 
href=\"{{link}}\" class=\"title-link\"> <img src=\"{{icon}}\" class=\"icon\"> {{name}} </a>\n  {{/link}}\n  
{{^link}}\n  {{name}}\n  {{/link}}\n</h3>\n{{#system}}\n  <div class='system-extension' title='System 
extension should be uninstalled using package manager. See \u00abAbout\u00bb page for more details.'>System 
extension</div>\n{{/system}}\n{{#creator}}\n  <span class=\"author\">by <a href=\"{{creator_url}}\"> 
{{creator}} </a></span>\n{{/creator}}\n<p 
class=\"description\">{{first_line_of_description}}</p>\n{{^system}}\n  <button class=\"uninstall\" 
title=\"Uninstall\">Uninstall</button>\n{{/system}}",
   "extensions/info_list": "<ul class=\"extensions\">\n{{#extensions}}\n  <li class=\"extension\" 
data-svm=\"{{shell_version_map}}\">\n    {{>extensions/info_contents}}\n  </li>\n{{/extensions}}\n</ul>",
   "extensions/uninstall": "You uninstalled <b>{{name}}</b>.",
   "messages/cannot_list_errors": "GNOME Shell Extensions cannot automatically detect any errors.",


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