[gnome-sound-recorder/wip/cdavis/gtk4] misc: make eslint happy & use newer APIs
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/wip/cdavis/gtk4] misc: make eslint happy & use newer APIs
- Date: Thu, 18 Nov 2021 20:44:36 +0000 (UTC)
commit cef685968ee33e7b0a0d60eb9e4e4c19df821366
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Thu Nov 18 21:23:26 2021 +0100
misc: make eslint happy & use newer APIs
src/application.js | 4 ++--
src/recorderWidget.js | 8 ++++----
src/recordingListWidget.js | 12 ++++++------
src/row.js | 9 ++++-----
src/waveform.js | 8 ++++----
5 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index bf61ef2..cda25b7 100644
--- a/src/application.js
+++ b/src/application.js
@@ -18,7 +18,7 @@
*
*/
-const { Gdk, Gio, GLib, GObject, Gst, Gtk, Adw } = imports.gi;
+const { Adw, Gio, GLib, GObject, Gst, Gtk } = imports.gi;
var RecordingsDir = Gio.file_new_for_path(GLib.build_filenamev([GLib.get_user_data_dir(), pkg.name]));
var CacheDir = Gio.file_new_for_path(GLib.build_filenamev([GLib.get_user_cache_dir(), pkg.name]));
@@ -104,7 +104,7 @@ var Application = GObject.registerClass(class Application extends Adw.Applicatio
vfunc_activate() {
this.window = new Window({ application: this });
if (pkg.name.endsWith('Devel'))
- this.window.get_style_context().add_class('devel');
+ this.window.add_css_class('devel');
this.window.show();
}
diff --git a/src/recorderWidget.js b/src/recorderWidget.js
index a8470e2..d40e5d3 100644
--- a/src/recorderWidget.js
+++ b/src/recorderWidget.js
@@ -1,5 +1,5 @@
/* exported RecorderState RecorderWidget */
-const { Gdk, Gio, GObject, Gtk } = imports.gi;
+const { Gio, GObject, Gtk } = imports.gi;
const { formatTime } = imports.utils;
const { WaveForm, WaveType } = imports.waveform;
@@ -98,7 +98,7 @@ var RecorderWidget = GObject.registerClass({
dialog.set_default_response(Gtk.ResponseType.NO);
dialog.add_button(_('Resume'), Gtk.ResponseType.NO);
dialog.add_button(_('Delete'), Gtk.ResponseType.YES)
- .get_style_context().add_class('destructive-action');
+ .add_css_class('destructive-action');
dialog.set_transient_for(Gio.Application.get_default().get_active_window());
dialog.connect('response', (_, response) => {
@@ -136,7 +136,7 @@ var RecorderWidget = GObject.registerClass({
this.actionsGroup.lookup('pause').enabled = false;
this.actionsGroup.lookup('resume').enabled = true;
this._resumeBtn.grab_focus();
- this._recorderTime.get_style_context().add_class('paused');
+ this._recorderTime.add_css_class('paused');
break;
case RecorderState.RECORDING:
this.actionsGroup.lookup('start').enabled = false;
@@ -144,7 +144,7 @@ var RecorderWidget = GObject.registerClass({
this.actionsGroup.lookup('resume').enabled = false;
this.actionsGroup.lookup('pause').enabled = true;
this._pauseBtn.grab_focus();
- this._recorderTime.get_style_context().remove_class('paused');
+ this._recorderTime.remove_css_class('paused');
break;
case RecorderState.STOPPED:
this.actionsGroup.lookup('start').enabled = true;
diff --git a/src/recordingListWidget.js b/src/recordingListWidget.js
index 74f5562..c0bce5b 100644
--- a/src/recordingListWidget.js
+++ b/src/recordingListWidget.js
@@ -124,18 +124,18 @@ var RecordingsListWidget = new GObject.registerClass({
if (expanded) {
if (current)
- current.get_style_context().add_class('expanded');
+ current.add_css_class('expanded');
if (before)
- before.get_style_context().add_class('expanded-before');
+ before.add_css_class('expanded-before');
if (after)
- after.get_style_context().add_class('expanded-after');
+ after.add_css_class('expanded-after');
} else {
if (current)
- current.get_style_context().remove_class('expanded');
+ current.remove_css_class('expanded');
if (before)
- before.get_style_context().remove_class('expanded-before');
+ before.remove_css_class('expanded-before');
if (after)
- after.get_style_context().remove_class('expanded-after');
+ after.remove_css_class('expanded-after');
}
}
});
diff --git a/src/row.js b/src/row.js
index 67a2a6d..4214408 100644
--- a/src/row.js
+++ b/src/row.js
@@ -134,11 +134,10 @@ var Row = GObject.registerClass({
this.keyController = Gtk.EventControllerKey.new();
this.keyController.connect('key-pressed', (controller, key, _code, _state) => {
- this._entry.get_style_context().remove_class('error');
+ this._entry.remove_css_class('error');
- if (key === Gdk.KEY_Escape) {
+ if (key === Gdk.KEY_Escape)
this.editMode = false;
- }
});
this._entry.add_controller(this.keyController);
@@ -173,9 +172,9 @@ var Row = GObject.registerClass({
this.editMode = false;
this.renameAction.enabled = true;
- this._entry.get_style_context().remove_class('error');
+ this._entry.remove_css_class('error');
} catch (e) {
- this._entry.get_style_context().add_class('error');
+ this._entry.add_css_class('error');
}
}
diff --git a/src/waveform.js b/src/waveform.js
index f8570df..3737bd0 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -23,7 +23,7 @@
// based on code from Pitivi
-const { Gdk, Gio, GObject, Gtk } = imports.gi;
+const { Gio, GObject, Gtk } = imports.gi;
const Cairo = imports.cairo;
var WaveType = {
@@ -80,17 +80,17 @@ var WaveForm = GObject.registerClass({
this.show();
}
- gesturePressed(n_press, x, y) {
+ gesturePressed(nPress, x) {
this._startX = x;
this.emit('gesture-pressed');
}
- onMotion(x, y) {
+ onMotion(x) {
this._position = this._clamped(x - this._startX + this._lastX);
this.queue_draw();
}
- gestureReleased(n_press, x, y) {
+ gestureReleased() {
this._lastX = this._position;
this.emit('position-changed', this.position);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]