[gnome-shell-extensions] auto-move-windows: Use libadwaita's row widgets
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] auto-move-windows: Use libadwaita's row widgets
- Date: Sat, 12 Feb 2022 02:08:32 +0000 (UTC)
commit ffb2b27477191dc625a7b180fdddc1941d1467e5
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Feb 10 08:38:50 2022 +0100
auto-move-windows: Use libadwaita's row widgets
We get to remove a bunch of boring code, and get something better
looking and more standardized in return.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/213>
extensions/auto-move-windows/prefs.js | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index 998f3f7..03efd9b 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -128,7 +128,7 @@ const RuleRow = GObject.registerClass({
GObject.ParamFlags.READWRITE,
1, WORKSPACE_MAX, 1),
},
-}, class RuleRow extends Gtk.ListBoxRow {
+}, class RuleRow extends Adw.ActionRow {
_init(appInfo, value) {
const box = new Gtk.Box({
spacing: 6,
@@ -140,26 +140,17 @@ const RuleRow = GObject.registerClass({
super._init({
activatable: false,
+ title: appInfo.get_display_name(),
value,
- child: box,
});
this._appInfo = appInfo;
const icon = new Gtk.Image({
+ css_classes: ['icon-dropshadow'],
gicon: appInfo.get_icon(),
pixel_size: 32,
});
- icon.get_style_context().add_class('icon-dropshadow');
- box.append(icon);
-
- const label = new Gtk.Label({
- label: appInfo.get_display_name(),
- halign: Gtk.Align.START,
- hexpand: true,
- max_width_chars: 20,
- ellipsize: Pango.EllipsizeMode.END,
- });
- box.append(label);
+ this.add_prefix(icon);
const spinButton = new Gtk.SpinButton({
adjustment: new Gtk.Adjustment({
@@ -169,19 +160,21 @@ const RuleRow = GObject.registerClass({
}),
snap_to_ticks: true,
margin_end: 6,
+ valign: Gtk.Align.CENTER,
});
this.bind_property('value',
spinButton, 'value',
GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.BIDIRECTIONAL);
- box.append(spinButton);
+ this.add_suffix(spinButton);
const button = new Gtk.Button({
action_name: 'rules.remove',
action_target: new GLib.Variant('s', this.id),
icon_name: 'edit-delete-symbolic',
has_frame: false,
+ valign: Gtk.Align.CENTER,
});
- box.append(button);
+ this.add_suffix(button);
this.connect('notify::value',
() => this.activate_action('rules.update', null));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]