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: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/218>
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user