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
This commit is contained in:
Florian Müllner 2019-11-30 18:11:03 +01:00
parent 1067642300
commit c6f297e4e5
2 changed files with 97 additions and 2 deletions

View File

@ -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() {

View File

@ -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>