[gnome-sound-recorder/bilelmoussaoui/fixes: 8/12] fix eslint warnings
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/bilelmoussaoui/fixes: 8/12] fix eslint warnings
- Date: Wed, 9 Sep 2020 04:44:11 +0000 (UTC)
commit 1d4c19123f02a76d82f85f905d9a5475caffc926
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Wed Sep 9 03:05:39 2020 +0200
fix eslint warnings
src/application.js | 6 +++---
src/recorderWidget.js | 52 +++++++++++++++++++++++++--------------------------
src/window.js | 6 ++----
3 files changed, 31 insertions(+), 33 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 0cfcd32..2d9249d 100644
--- a/src/application.js
+++ b/src/application.js
@@ -91,9 +91,9 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
RecordingsDir.make_directory_with_parents(null);
CacheDir.make_directory_with_parents(null);
} catch (e) {
- if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) {
- warn(`Failed to create directory ${e}`)
- }
+ if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS))
+ error(`Failed to create directory ${e}`);
+
}
this._initAppMenu();
}
diff --git a/src/recorderWidget.js b/src/recorderWidget.js
index 9d746fd..8d996f3 100644
--- a/src/recorderWidget.js
+++ b/src/recorderWidget.js
@@ -1,17 +1,17 @@
/* exported RecorderState RecorderWidget */
-const { Gdk, Gio, GObject, Gst, Gtk } = imports.gi;
-const { displayDateTime, formatTime } = imports.utils;
+const { Gio, GObject, Gtk } = imports.gi;
+const { formatTime } = imports.utils;
const { WaveForm, WaveType } = imports.waveform;
var RecorderState = {
RECORDING: 0,
PAUSED: 1,
STOPPED: 2,
-}
+};
var RecorderWidget = GObject.registerClass({
Template: 'resource:///org/gnome/SoundRecorder/ui/recorder.ui',
- InternalChildren: ['recorderBox', 'playbackStack', 'recorderTime', ],
+ InternalChildren: ['recorderBox', 'playbackStack', 'recorderTime'],
Signals: {
'canceled': {},
'paused': {},
@@ -37,24 +37,24 @@ var RecorderWidget = GObject.registerClass({
const actions = [
- { name: 'start', callback : this.onStart.bind(this), enabled: true },
- { name: 'pause', callback : this.onPause.bind(this), enabled: false },
- { name: 'stop', callback : this.onStop.bind(this), enabled: false, },
- { name: 'resume', callback : this.onResume.bind(this), enabled: false },
- { name: 'cancel', callback : this.onCancel.bind(this), enabled: false }
+ { name: 'start', callback: this.onStart.bind(this), enabled: true },
+ { name: 'pause', callback: this.onPause.bind(this), enabled: false },
+ { name: 'stop', callback: this.onStop.bind(this), enabled: false },
+ { name: 'resume', callback: this.onResume.bind(this), enabled: false },
+ { name: 'cancel', callback: this.onCancel.bind(this), enabled: false },
];
this.actionsGroup = new Gio.SimpleActionGroup();
- for ( let { name, callback, enabled } of actions) {
- const action = new Gio.SimpleAction({ name: name, enabled: enabled });
+ for (let { name, callback, enabled } of actions) {
+ const action = new Gio.SimpleAction({ name, enabled });
action.connect('activate', callback);
this.actionsGroup.add_action(action);
}
const cancelAction = this.actionsGroup.lookup('cancel');
const startAction = this.actionsGroup.lookup('start');
- startAction.bind_property("enabled", cancelAction, "enabled", GObject.BindingFlags.INVERT_BOOLEAN);
+ startAction.bind_property('enabled', cancelAction, 'enabled', GObject.BindingFlags.INVERT_BOOLEAN);
}
onPause() {
@@ -99,20 +99,20 @@ var RecorderWidget = GObject.registerClass({
set state(recorderState) {
switch (recorderState) {
- case RecorderState.PAUSED:
- this.actionsGroup.lookup('pause').set_enabled(false);
- this.actionsGroup.lookup('resume').set_enabled(true);
- break;
- case RecorderState.RECORDING:
- this.actionsGroup.lookup('start').set_enabled(false);
- this.actionsGroup.lookup('stop').set_enabled(true);
- this.actionsGroup.lookup('resume').set_enabled(false);
- this.actionsGroup.lookup('pause').set_enabled(true);
- break;
- case RecorderState.STOPPED:
- this.actionsGroup.lookup('start').set_enabled(true);
- this.actionsGroup.lookup('stop').set_enabled(false);
- break;
+ case RecorderState.PAUSED:
+ this.actionsGroup.lookup('pause').set_enabled(false);
+ this.actionsGroup.lookup('resume').set_enabled(true);
+ break;
+ case RecorderState.RECORDING:
+ this.actionsGroup.lookup('start').set_enabled(false);
+ this.actionsGroup.lookup('stop').set_enabled(true);
+ this.actionsGroup.lookup('resume').set_enabled(false);
+ this.actionsGroup.lookup('pause').set_enabled(true);
+ break;
+ case RecorderState.STOPPED:
+ this.actionsGroup.lookup('start').set_enabled(true);
+ this.actionsGroup.lookup('stop').set_enabled(false);
+ break;
}
}
});
diff --git a/src/window.js b/src/window.js
index 615f481..4dc0c41 100644
--- a/src/window.js
+++ b/src/window.js
@@ -18,13 +18,11 @@
*
*/
-const { Gio, GLib, GObject, GstPlayer, Gtk, Handy } = imports.gi;
+const { GLib, GObject, GstPlayer, Handy } = imports.gi;
const { Recorder } = imports.recorder;
const { RecordingList } = imports.recordingList;
const { RecordingsListBox } = imports.recordingsListBox;
-const { formatTime } = imports.utils;
-const { WaveForm, WaveType } = imports.waveform;
const { RecorderWidget } = imports.recorderWidget;
var WindowState = {
@@ -49,7 +47,7 @@ var Window = GObject.registerClass({
this.recorder = new Recorder();
this.recorderWidget = new RecorderWidget(this.recorder);
- this._mainStack.add_named(this.recorderWidget, "recorder");
+ this._mainStack.add_named(this.recorderWidget, 'recorder');
const dispatcher = GstPlayer.PlayerGMainContextSignalDispatcher.new(null);
this.player = GstPlayer.Player.new(null, dispatcher);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]