Skip to content

Commit 2b48d9b

Browse files
committed
pref/command: use bind_property_full()
#1099
1 parent 01aae31 commit 2b48d9b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

ddterm/pref/command.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,24 @@ export const CommandWidget = GObject.registerClass({
3333
_init(params) {
3434
super._init(params);
3535

36-
insert_settings_actions(this, this.settings, [
36+
const actions = insert_settings_actions(this, this.settings, [
3737
'command',
3838
'preserve-working-directory',
3939
]);
4040

4141
bind_widget(this.settings, 'custom-command', this.custom_command_entry);
4242

43-
const handler = this.settings.connect(
44-
'changed::command',
45-
this.enable_custom_command_entry.bind(this)
43+
actions.lookup_action('command').bind_property_full(
44+
'state',
45+
this.custom_command_entry.parent,
46+
'sensitive',
47+
GObject.BindingFlags.SYNC_CREATE,
48+
(binding, state) => [true, state?.unpack() === 'custom-command'],
49+
null
4650
);
47-
this.connect('destroy', () => this.settings.disconnect(handler));
48-
this.enable_custom_command_entry();
4951
}
5052

5153
get title() {
5254
return this.gettext_context.gettext('Command');
5355
}
54-
55-
enable_custom_command_entry() {
56-
this.custom_command_entry.parent.sensitive =
57-
this.settings.get_string('command') === 'custom-command';
58-
}
5956
});

0 commit comments

Comments
 (0)