[gnome-shell] extensionPrefs: Include more extension details in expander



commit c6f297e4e5cf12a4aa7b5d70d37c52fd404e3e73
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 30 18:11:03 2019 +0100

    extensionPrefs: Include more extension details in expander
    
    The newly added expander gives us a place where we can display
    more details without cluttering the interface.
    
    Take advantage of that by including the extension website, version
    and author.
    
    (Author is in the mockups, but will not actually be shown until
    the extensions website is changed to include it in its metadata;
    however best to have UI and string in place for the freezes)
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1968

 js/extensionPrefs/main.js             | 30 ++++++++++++++-
 js/extensionPrefs/ui/extension-row.ui | 69 +++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 2 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 99dfddd9f2..e2babfe62f 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -290,7 +290,7 @@ var ExtensionsWindow = GObject.registerClass({
             label: _("Homepage"),
             tooltip_text: _("Visit extension homepage"),
             no_show_all: true,
-            visible: row.url != null,
+            visible: row.url !== '',
         });
         toolbar.add(urlButton);
 
@@ -483,6 +483,8 @@ var ExtensionRow = GObject.registerClass({
     InternalChildren: [
         'nameLabel',
         'descriptionLabel',
+        'versionLabel',
+        'authorLabel',
         'revealButton',
         'revealer',
     ],
@@ -505,6 +507,16 @@ var ExtensionRow = GObject.registerClass({
         action.connect('activate', () => this.get_toplevel().openPrefs(this.uuid));
         this._actionGroup.add_action(action);
 
+        action = new Gio.SimpleAction({
+            name: 'show-url',
+            enabled: this.url !== '',
+        });
+        action.connect('activate', () => {
+            Gio.AppInfo.launch_default_for_uri(
+                this.url, this.get_display().get_app_launch_context());
+        });
+        this._actionGroup.add_action(action);
+
         action = new Gio.SimpleAction({
             name: 'enabled',
             state: new GLib.Variant('b', false),
@@ -562,8 +574,16 @@ var ExtensionRow = GObject.registerClass({
         return this._extension.hasPrefs;
     }
 
+    get creator() {
+        return this._extension.metadata.creator || '';
+    }
+
     get url() {
-        return this._extension.metadata.url;
+        return this._extension.metadata.url || '';
+    }
+
+    get version() {
+        return this._extension.metadata.version || '';
     }
 
     _updateState() {
@@ -572,6 +592,12 @@ var ExtensionRow = GObject.registerClass({
         let action = this._actionGroup.lookup('enabled');
         action.set_state(new GLib.Variant('b', state));
         action.enabled = this._canToggle();
+
+        this._versionLabel.label = `${this.version}`;
+        this._versionLabel.visible = this.version !== '';
+
+        this._authorLabel.label = `${this.creator}`;
+        this._authorLabel.visible = this.creator !== '';
     }
 
     _onDestroy() {
diff --git a/js/extensionPrefs/ui/extension-row.ui b/js/extensionPrefs/ui/extension-row.ui
index 23231e2b91..0ec50802ea 100644
--- a/js/extensionPrefs/ui/extension-row.ui
+++ b/js/extensionPrefs/ui/extension-row.ui
@@ -100,6 +100,75 @@
                     <property name="yalign">0</property>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible"
+                              bind-source="versionLabel"
+                              bind-property="visible"
+                              bind-flags="sync-create"/>
+                    <property name="no_show_all">True</property>
+                    <property name="label" translatable="yes">Version</property>
+                    <property name="xalign">0</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="versionLabel">
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible"
+                              bind-source="authorLabel"
+                              bind-property="visible"
+                              bind-flags="sync-create"/>
+                    <property name="no_show_all">True</property>
+                    <property name="label" translatable="yes">Author</property>
+                    <property name="xalign">0</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="authorLabel">
+                    <property name="no_show_all">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Website</property>
+                    <property name="action_name">row.show-url</property>
+                    <property name="valign">end</property>
+                    <property name="margin-top">12</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">3</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>


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