[extensions-web/bugfix/incompatible-extensions/776460: 2/2] extension: hide control buttons for incompatible extensions.



commit 50411e5ea790462d3584b762d630bc37db02f1b5
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Apr 9 13:39:31 2017 +0400

    extension: hide control buttons for incompatible extensions.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=776460

 sweettooth/static/css/switch.css   |    9 +++++++++
 sweettooth/static/js/extensions.js |   12 ++++++++++++
 sweettooth/static/js/switch.js     |    9 ++++++++-
 3 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/static/css/switch.css b/sweettooth/static/css/switch.css
index 85c81d0..8ed769c 100644
--- a/sweettooth/static/css/switch.css
+++ b/sweettooth/static/css/switch.css
@@ -8,6 +8,10 @@
     line-height: 1.6;
 }
 
+._gnome-switch.incompatible {
+    width: auto;
+}
+
 /* create a new BFC to have floating label work correctly.
  * http://colinaarts.com/articles/float-containment/ */
 ._gnome-switch:before, ._gnome-switch:after {
@@ -98,6 +102,11 @@
     border-radius: 4px;
 }
 
+._gnome-switch.customized .custom-content.incompatible {
+    width: auto;
+    cursor: help;
+}
+
 ._gnome-switch .off {
     float: right;
     border-color: #2e3436;
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 33c2cac..77b304d 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -283,6 +283,18 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils', 'templates', 'paginato
                                        $switch.switchify('customize');
                                        $switch.switchify('activate', false);
                                        $elem.removeClass('out-of-date');
+
+                                       if(newState == ExtensionState.UNINSTALLED && !latest)
+                                       {
+                                               $switch.switchify(
+                                                       'customize',
+                                                       "INCOMPATIBLE",
+                                                       'incompatible',
+                                                       "This extension is incompatible with your GNOME Shell 
version. For GNOME Shell 3.12 " +
+                                                       " or newer you can set 
\"disable-extension-version-validation\" dconf setting to true" +
+                                                       " to force installation of incompatible extensions."
+                                               );
+                                       }
                                }
                                else if (newState == ExtensionState.ENABLED)
                                {
diff --git a/sweettooth/static/js/switch.js b/sweettooth/static/js/switch.js
index 5869067..7d7043e 100644
--- a/sweettooth/static/js/switch.js
+++ b/sweettooth/static/js/switch.js
@@ -1,6 +1,7 @@
 /*
     GNOME Shell extensions repository
     Copyright (C) 2011-2012  Jasper St. Pierre <jstpierre mecheye net>
+    Copyright (C) 2017  Yuri Konotopov <ykonotopov gnome org>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU Affero General Public License as published by
@@ -164,7 +165,7 @@ define(['jquery'], function ($) {
                        });
                },
 
-               customize: function (label, styleClass) {
+               customize: function (label, styleClass, title) {
                        return this.each(function () {
                                var $elem = $(this);
                                var $customContent = $elem.find('.custom-content');
@@ -176,6 +177,7 @@ define(['jquery'], function ($) {
                                {
                                        $customContent.text('').removeClass(data.customized.styleClass);
                                        
$elem.removeClass('customized').removeClass(data.customized.styleClass);
+                                       $elem.removeProp('title');
                                        data.customized = null;
                                }
 
@@ -185,6 +187,11 @@ define(['jquery'], function ($) {
                                        $elem.addClass('customized').addClass(styleClass);
                                        data.customized = {label: label, styleClass: styleClass};
                                }
+
+                               if(title)
+                               {
+                                       $elem.prop('title', title);
+                               }
                        });
                }
        };


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