From 57f7f21ecb621fadbc595f73d8b7aaed987ea722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 13 Feb 2022 14:53:13 +0100 Subject: [PATCH] workspace-indicator: Bind name to action target Since we now have an override for bind_properties_full(), we can use that instead of an explicit notify handler. Part-of: --- extensions/workspace-indicator/prefs.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index bf64fed7..3cffbcfe 100644 --- a/extensions/workspace-indicator/prefs.js +++ b/extensions/workspace-indicator/prefs.js @@ -112,12 +112,17 @@ class WorkspaceRow extends Adw.PreferencesRow { const button = new Gtk.Button({ action_name: 'workspaces.remove', - action_target: new GLib.Variant('s', name), icon_name: 'edit-delete-symbolic', has_frame: false, }); box.append(button); + this.bind_property_full('name', + button, 'action-target', + GObject.BindingFlags.SYNC_CREATE, + (bind, target) => [true, new GLib.Variant('s', target)], + null); + this._entry = new Gtk.Entry({ max_width_chars: 25, }); @@ -147,10 +152,8 @@ class WorkspaceRow extends Adw.PreferencesRow { this._stopEdit(); }); - this.connect('notify::name', () => { - button.action_target = new GLib.Variant('s', this.name); - this.activate_action('workspaces.update', null); - }); + this.connect('notify::name', + () => this.activate_action('workspaces.update', null); } edit() {