Codebase list gnome-sound-recorder / cef6859
misc: make eslint happy & use newer APIs Bilal Elmoussaoui 2 years ago
5 changed file(s) with 21 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
1717 *
1818 */
1919
20 const { Gdk, Gio, GLib, GObject, Gst, Gtk, Adw } = imports.gi;
20 const { Adw, Gio, GLib, GObject, Gst, Gtk } = imports.gi;
2121
2222 var RecordingsDir = Gio.file_new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), pkg.name]));
2323 var CacheDir = Gio.file_new_for_path(GLib.build_filenamev([GLib.get_user_cache_dir(), pkg.name]));
103103 vfunc_activate() {
104104 this.window = new Window({ application: this });
105105 if (pkg.name.endsWith('Devel'))
106 this.window.get_style_context().add_class('devel');
106 this.window.add_css_class('devel');
107107 this.window.show();
108108 }
109109
00 /* exported RecorderState RecorderWidget */
1 const { Gdk, Gio, GObject, Gtk } = imports.gi;
1 const { Gio, GObject, Gtk } = imports.gi;
22 const { formatTime } = imports.utils;
33 const { WaveForm, WaveType } = imports.waveform;
44
9797 dialog.set_default_response(Gtk.ResponseType.NO);
9898 dialog.add_button(_('Resume'), Gtk.ResponseType.NO);
9999 dialog.add_button(_('Delete'), Gtk.ResponseType.YES)
100 .get_style_context().add_class('destructive-action');
100 .add_css_class('destructive-action');
101101
102102 dialog.set_transient_for(Gio.Application.get_default().get_active_window());
103103 dialog.connect('response', (_, response) => {
135135 this.actionsGroup.lookup('pause').enabled = false;
136136 this.actionsGroup.lookup('resume').enabled = true;
137137 this._resumeBtn.grab_focus();
138 this._recorderTime.get_style_context().add_class('paused');
138 this._recorderTime.add_css_class('paused');
139139 break;
140140 case RecorderState.RECORDING:
141141 this.actionsGroup.lookup('start').enabled = false;
143143 this.actionsGroup.lookup('resume').enabled = false;
144144 this.actionsGroup.lookup('pause').enabled = true;
145145 this._pauseBtn.grab_focus();
146 this._recorderTime.get_style_context().remove_class('paused');
146 this._recorderTime.remove_css_class('paused');
147147 break;
148148 case RecorderState.STOPPED:
149149 this.actionsGroup.lookup('start').enabled = true;
123123
124124 if (expanded) {
125125 if (current)
126 current.get_style_context().add_class('expanded');
126 current.add_css_class('expanded');
127127 if (before)
128 before.get_style_context().add_class('expanded-before');
128 before.add_css_class('expanded-before');
129129 if (after)
130 after.get_style_context().add_class('expanded-after');
130 after.add_css_class('expanded-after');
131131 } else {
132132 if (current)
133 current.get_style_context().remove_class('expanded');
133 current.remove_css_class('expanded');
134134 if (before)
135 before.get_style_context().remove_class('expanded-before');
135 before.remove_css_class('expanded-before');
136136 if (after)
137 after.get_style_context().remove_class('expanded-after');
137 after.remove_css_class('expanded-after');
138138 }
139139 }
140140 });
133133
134134 this.keyController = Gtk.EventControllerKey.new();
135135 this.keyController.connect('key-pressed', (controller, key, _code, _state) => {
136 this._entry.get_style_context().remove_class('error');
137
138 if (key === Gdk.KEY_Escape) {
136 this._entry.remove_css_class('error');
137
138 if (key === Gdk.KEY_Escape)
139139 this.editMode = false;
140 }
141140 });
142141 this._entry.add_controller(this.keyController);
143142
172171
173172 this.editMode = false;
174173 this.renameAction.enabled = true;
175 this._entry.get_style_context().remove_class('error');
174 this._entry.remove_css_class('error');
176175 } catch (e) {
177 this._entry.get_style_context().add_class('error');
176 this._entry.add_css_class('error');
178177 }
179178 }
180179
2222
2323 // based on code from Pitivi
2424
25 const { Gdk, Gio, GObject, Gtk } = imports.gi;
25 const { Gio, GObject, Gtk } = imports.gi;
2626 const Cairo = imports.cairo;
2727
2828 var WaveType = {
7979 this.show();
8080 }
8181
82 gesturePressed(n_press, x, y) {
82 gesturePressed(nPress, x) {
8383 this._startX = x;
8484 this.emit('gesture-pressed');
8585 }
8686
87 onMotion(x, y) {
87 onMotion(x) {
8888 this._position = this._clamped(x - this._startX + this._lastX);
8989 this.queue_draw();
9090 }
9191
92 gestureReleased(n_press, x, y) {
92 gestureReleased() {
9393 this._lastX = this._position;
9494 this.emit('position-changed', this.position);
9595 }