From c6f297e4e5cf12a4aa7b5d70d37c52fd404e3e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 30 Nov 2019 18:11:03 +0100 Subject: [PATCH] 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 99dfddd9f..e2babfe62 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 23231e2b9..0ec50802e 100644 --- a/js/extensionPrefs/ui/extension-row.ui +++ b/js/extensionPrefs/ui/extension-row.ui @@ -100,6 +100,75 @@ 0 + + + + True + Version + 0 + + + + 0 + 1 + + + + + True + 0 + + + 1 + 1 + + + + + + True + Author + 0 + + + + 0 + 2 + + + + + True + 0 + + + 1 + 2 + + + + + True + Website + row.show-url + end + 12 + + + 0 + 3 + +