[extensions-web/feature/uri-handler: 453/453] extensions: allow to install extensions using URI handler




commit cba77c40a0390f659760fdba8b274bd7e025e5e9
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sat Jul 23 22:17:32 2022 +0400

    extensions: allow to install extensions using URI handler
    
    GNOME browser connector 42.0+ is needed for this feature to work

 .../extensions/templates/extensions/detail.html    |   2 +-
 sweettooth/static/css/sweettooth.css               |  21 +++++++--------------
 sweettooth/static/images/gnome-software.png        | Bin 746 -> 0 bytes
 sweettooth/static/js/extensions.js                 |  13 +++++--------
 4 files changed, 13 insertions(+), 23 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail.html 
b/sweettooth/extensions/templates/extensions/detail.html
index 9b8da88..b0eb3f2 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -20,9 +20,9 @@
       </div>
 
       <div class="controls col-xs-12 col-sm-4 col-md-4 col-lg-4">
+        <button type="button" class="btn btn-primary install-button">{% trans 'Install' %}</button>
         <div class="switch"></div>
         <div class="extra-buttons">
-          <div class="gnome-software-button"></div>
           <div class="upgrade-button" title="{% trans 'Upgrade this extension' %}"></div>
           <div class="configure-button" title="{% trans 'Configure this extension' %}"></div>
           <div class="uninstall-button" title="{% trans 'Uninstall this extension' %}"></div>
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 6c15117..13547cb 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -339,14 +339,18 @@ li.extension:last-child,
 
 .extension .configure-button,
 .extension .upgrade-button,
-.extension .uninstall-button {
+.extension .uninstall-button,
+.extension .install-button {
     display: none;
 }
 
+.extension.dummy .install-button {
+    display: block;
+}
+
 .extension.configurable .configure-button,
 .extension.upgradable .upgrade-button,
-.extension.installed .uninstall-button,
-.extension.gnome-software-button {
+.extension.installed .uninstall-button {
     float: left;
 
     display: block;
@@ -402,17 +406,6 @@ li.extension:last-child,
     border-color: #d92400;
 }
 
-.extension .gnome-software-button {
-    background-color: #d9c128;
-    background-image: url(../images/gnome-software.png);
-    border-color: #a6921f;
-}
-
-.extension .gnome-software-button:hover {
-    background-color: #e6ca2e;
-    border-color: #bfa524;
-}
-
 /* Extension switch */
 
 .extension ._gnome-switch {
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index b215301..7d0a6a1 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -126,7 +126,7 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils',
                        }
 
                        $.fn.addExtensionSwitch = function () {
-                               enableSoftwareLink($(this), $(this).data('uuid'));
+                               enableInstallButton($(this), $(this).data('uuid'));
                                // Don't show our switches -- CSS styles define a clickable
                                // area even with no content.
                                return this.find('.switch').hide();
@@ -412,15 +412,14 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils',
                        elems[uuid] = $elem;
                }
 
-
-               function enableSoftwareLink(extension, uuid)
+               function enableInstallButton(extension, uuid)
                {
                        extension
-                               .find('.gnome-software-button')
-                               .prop('title', 'Open in GNOME Software')
+                               .addClass('dummy')
+                               .find('.install-button')
                                .on('click', event => {
                                        event.preventDefault();
-                                       window.open('web+gnomeshellextension://' + encodeURIComponent(uuid), 
'_self');
+                                       
window.open(`gnome-extensions://${encodeURIComponent(uuid)}?action=install`, '_self');
                                });
                }
 
@@ -527,8 +526,6 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils',
                                var $extension = $(this);
                                var uuid = $extension.data('uuid');
 
-                               enableSoftwareLink($extension, uuid);
-
                                $extension.on('out-of-date', function () {
                                        var svm = $extension.data('svm');
                                        var nhvOperation = extensionUtils.findNextHighestVersion(svm, 
dbusProxy.ShellVersion);


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