Skip to content

Commit 16bbe12

Browse files
committed
prefs: remove RxJS
#389
1 parent 43dd877 commit 16bbe12

28 files changed

+1611
-1375
lines changed

ddterm/app/application.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,8 @@ const Application = backport.GObject.registerClass(
145145

146146
this.add_action(close_preferences_action);
147147

148-
const settings_source = Gio.SettingsSchemaSource.new_from_directory(
149-
Me.dir.get_child('schemas').get_path(),
150-
Gio.SettingsSchemaSource.get_default(),
151-
false
152-
);
153-
154148
this.settings = new settings.Settings({
155-
gsettings: new Gio.Settings({
156-
settings_schema: settings_source.lookup('com.github.amezin.ddterm', true),
157-
}),
149+
gsettings: imports.ddterm.util.settings.get_settings(),
158150
});
159151

160152
[
@@ -307,7 +299,7 @@ const Application = backport.GObject.registerClass(
307299
if (this.prefs_dialog === null) {
308300
this.prefs_dialog = new imports.ddterm.pref.dialog.PrefsDialog({
309301
transient_for: this.window,
310-
settings: this.settings,
302+
settings: this.settings.gsettings,
311303
});
312304

313305
this.rx.subscribe(

ddterm/pref/animation.js

+10-23
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919

2020
'use strict';
2121

22-
const { GObject, Gtk } = imports.gi;
22+
const { GObject, Gio, Gtk } = imports.gi;
2323
const Me = imports.misc.extensionUtils.getCurrentExtension();
2424
const { backport } = Me.imports.ddterm;
2525
const { util } = Me.imports.ddterm.pref;
26-
const { settings } = Me.imports.ddterm.rx;
2726
const { translations } = Me.imports.ddterm.util;
2827

2928
function get_seconds_format() {
@@ -50,6 +49,7 @@ var Widget = backport.GObject.registerClass(
5049
GTypeName: 'DDTermPrefsAnimation',
5150
Template: util.ui_file_uri('prefs-animation.ui'),
5251
Children: [
52+
'animation_prefs',
5353
'show_animation_combo',
5454
'hide_animation_combo',
5555
'show_animation_duration_scale',
@@ -61,39 +61,26 @@ var Widget = backport.GObject.registerClass(
6161
'',
6262
'',
6363
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
64-
settings.Settings
64+
Gio.Settings
6565
),
6666
},
6767
},
68-
class PrefsAnimation extends Gtk.Grid {
68+
class PrefsAnimation extends Gtk.Box {
6969
_init(params) {
7070
super._init(params);
7171

72-
const scope = util.scope(this, this.settings);
72+
util.insert_settings_actions(this, this.settings, ['override-window-animation']);
73+
util.bind_sensitive(this.settings, 'override-window-animation', this.animation_prefs);
7374

74-
scope.setup_widgets({
75+
util.bind_widgets(this.settings, {
7576
'show-animation': this.show_animation_combo,
76-
'hide-animation': this.hide_animation_combo,
7777
'show-animation-duration': this.show_animation_duration_scale,
78+
'hide-animation': this.hide_animation_combo,
7879
'hide-animation-duration': this.hide_animation_duration_scale,
7980
});
8081

81-
this.insert_action_group(
82-
'settings',
83-
scope.make_actions([
84-
'override-window-animation',
85-
])
86-
);
87-
88-
scope.set_scale_value_formatter(
89-
this.show_animation_duration_scale,
90-
seconds_formatter
91-
);
92-
93-
scope.set_scale_value_formatter(
94-
this.hide_animation_duration_scale,
95-
seconds_formatter
96-
);
82+
util.set_scale_value_formatter(this.show_animation_duration_scale, seconds_formatter);
83+
util.set_scale_value_formatter(this.hide_animation_duration_scale, seconds_formatter);
9784
}
9885

9986
get title() {

ddterm/pref/behavior.js

+13-21
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919

2020
'use strict';
2121

22-
const { GObject, Gtk } = imports.gi;
22+
const { GObject, Gio, Gtk } = imports.gi;
2323
const Me = imports.misc.extensionUtils.getCurrentExtension();
2424
const { backport } = Me.imports.ddterm;
2525
const { util } = Me.imports.ddterm.pref;
26-
const { settings } = Me.imports.ddterm.rx;
2726
const { translations } = Me.imports.ddterm.util;
2827

2928
var Widget = backport.GObject.registerClass(
@@ -39,33 +38,26 @@ var Widget = backport.GObject.registerClass(
3938
'',
4039
'',
4140
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
42-
settings.Settings
41+
Gio.Settings
4342
),
4443
},
4544
},
4645
class PrefsBehavior extends Gtk.Grid {
4746
_init(params) {
4847
super._init(params);
4948

50-
const scope = util.scope(this, this.settings);
49+
util.insert_settings_actions(this, this.settings, [
50+
'window-resizable',
51+
'window-above',
52+
'window-stick',
53+
'window-skip-taskbar',
54+
'hide-when-focus-lost',
55+
'hide-window-on-esc',
56+
'pointer-autohide',
57+
'force-x11-gdk-backend',
58+
]);
5159

52-
scope.setup_widgets({
53-
'window-type-hint': this.window_type_hint_combo,
54-
});
55-
56-
this.insert_action_group(
57-
'settings',
58-
scope.make_actions([
59-
'window-resizable',
60-
'window-above',
61-
'window-stick',
62-
'window-skip-taskbar',
63-
'hide-when-focus-lost',
64-
'hide-window-on-esc',
65-
'pointer-autohide',
66-
'force-x11-gdk-backend',
67-
])
68-
);
60+
util.bind_widget(this.settings, 'window-type-hint', this.window_type_hint_combo);
6961
}
7062

7163
get title() {

0 commit comments

Comments
 (0)