extensionPrefs: Use a single line for description

The current fixed two-line label requires a custom widget, which
make moving to a widget template harder.

As the description will soon move elsewhere anyway, just go back
to a single line with a standard label for now.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1968
This commit is contained in:
Florian Müllner 2019-11-30 03:33:27 +01:00
parent 8795668c41
commit 5b92e3a9a8

View File

@ -471,16 +471,6 @@ var Expander = GObject.registerClass({
} }
}); });
var DescriptionLabel = GObject.registerClass(
class DescriptionLabel extends Gtk.Label {
vfunc_get_preferred_height_for_width(width) {
// Hack: Request the maximum height allowed by the line limit
if (this.lines > 0)
return super.vfunc_get_preferred_height_for_width(0);
return super.vfunc_get_preferred_height_for_width(width);
}
});
var ExtensionRow = GObject.registerClass( var ExtensionRow = GObject.registerClass(
class ExtensionRow extends Gtk.ListBoxRow { class ExtensionRow extends Gtk.ListBoxRow {
_init(extension) { _init(extension) {
@ -552,10 +542,13 @@ class ExtensionRow extends Gtk.ListBoxRow {
vbox.add(label); vbox.add(label);
let desc = this._extension.metadata.description.split('\n')[0]; let desc = this._extension.metadata.description.split('\n')[0];
label = new DescriptionLabel({ label: desc, wrap: true, lines: 2, label = new Gtk.Label({
ellipsize: Pango.EllipsizeMode.END, label: desc,
max_width_chars: 60, ellipsize: Pango.EllipsizeMode.END,
xalign: 0, yalign: 0 }); max_width_chars: 60,
xalign: 0,
yalign: 0,
});
vbox.add(label); vbox.add(label);
let button = new Gtk.Button({ valign: Gtk.Align.CENTER, let button = new Gtk.Button({ valign: Gtk.Align.CENTER,