[extensions-web/feature/uri-handler: 4/5] extension: added GNOME Software button.




commit db7b7cb08739065fcf043c7461fafda551a6d881
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sat Jul 23 17:58:51 2022 +0400

    extension: added GNOME Software button.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=772577
    
    # Conflicts:
    #       sweettooth/extensions/templates/extensions/detail.html
    #       sweettooth/static/css/sweettooth.css
    #       sweettooth/static/js/extensions.js

 sweettooth/extensions/templates/extensions/detail.html |   1 +
 sweettooth/static/css/sweettooth.css                   |  14 +++++++++++++-
 sweettooth/static/images/gnome-software.png            | Bin 0 -> 746 bytes
 sweettooth/static/js/extensions.js                     |  15 +++++++++++++++
 4 files changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail.html 
b/sweettooth/extensions/templates/extensions/detail.html
index 2433e30..9b8da88 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -22,6 +22,7 @@
       <div class="controls col-xs-12 col-sm-4 col-md-4 col-lg-4">
         <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 1b705e5..6c15117 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -345,7 +345,8 @@ li.extension:last-child,
 
 .extension.configurable .configure-button,
 .extension.upgradable .upgrade-button,
-.extension.installed .uninstall-button {
+.extension.installed .uninstall-button,
+.extension.gnome-software-button {
     float: left;
 
     display: block;
@@ -401,6 +402,17 @@ 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/images/gnome-software.png b/sweettooth/static/images/gnome-software.png
new file mode 100644
index 0000000..1e6d3af
Binary files /dev/null and b/sweettooth/static/images/gnome-software.png differ
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index ad20041..b215301 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -126,6 +126,7 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils',
                        }
 
                        $.fn.addExtensionSwitch = function () {
+                               enableSoftwareLink($(this), $(this).data('uuid'));
                                // Don't show our switches -- CSS styles define a clickable
                                // area even with no content.
                                return this.find('.switch').hide();
@@ -411,6 +412,18 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils',
                        elems[uuid] = $elem;
                }
 
+
+               function enableSoftwareLink(extension, uuid)
+               {
+                       extension
+                               .find('.gnome-software-button')
+                               .prop('title', 'Open in GNOME Software')
+                               .on('click', event => {
+                                       event.preventDefault();
+                                       window.open('web+gnomeshellextension://' + encodeURIComponent(uuid), 
'_self');
+                               });
+               }
+
                $.fn.addLocalExtensions = function () {
                        return this.each(function () {
                                var $container = $(this);
@@ -514,6 +527,8 @@ 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]