[gnome-sound-recorder/issue_17: 6/6] Coding error and style fixes
- From: Meg Ford <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder/issue_17: 6/6] Coding error and style fixes
- Date: Tue, 19 Feb 2019 06:12:17 +0000 (UTC)
commit 94cbcfdd31d593c2a6446e86760594a85dc7563f
Author: Meg Ford <megford gnome org>
Date: Tue Feb 19 00:09:32 2019 -0600
Coding error and style fixes
src/application.js | 1 +
src/listview.js | 5 ++---
src/mainWindow.js | 1 +
src/record.js | 5 ++---
src/waveform.js | 7 +++----
5 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index f918e10..b206400 100644
--- a/src/application.js
+++ b/src/application.js
@@ -30,6 +30,7 @@ const Util = imports.util;
var SIGINT = 2;
var SIGTERM = 15;
+var application = null;
var Application = GObject.registerClass(class Application extends Gtk.Application {
_init() {
diff --git a/src/listview.js b/src/listview.js
index 28466c4..76319d6 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -103,14 +103,13 @@ var Listview = class Listview {
files.forEach((file) => {
let returnedName = file.get_attribute_as_string("standard::display-name");
try {
- let returnedNumber = parseInt(returnedName.split(" ")[1]);
+ let returnedNumber = parseInt(returnedName.split(" ").pop());
if (returnedNumber > trackNumber)
trackNumber = returnedNumber;
} catch (e) {
if (!e instanceof TypeError)
throw e;
-
log("Tracknumber not returned");
// Don't handle the error
}
@@ -348,4 +347,4 @@ var Listview = class Listview {
getFilesInfoForList() {
return allFilesInfo;
}
-}
+}
\ No newline at end of file
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7c9fd7c..3f7272e 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -222,6 +222,7 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
this.recordGrid.hide();
recordPipeline = RecordPipelineStates.STOPPED;
recordButton.set_sensitive(true);
+
if (this.listBox != null)
this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
}
diff --git a/src/record.js b/src/record.js
index ca3fbc2..3eaaf7b 100644
--- a/src/record.js
+++ b/src/record.js
@@ -55,7 +55,7 @@ let errorDialogState;
var Record = class Record {
_recordPipeline() {
errorDialogState = ErrorDialog.ErrState.OFF;
- this.fbaseTime = 0;
+ this.baseTime = 0;
this._buildFileName = new fileUtil.BuildFileName();
this.initialFileName = this._buildFileName.buildInitialFilename();
let localDateTime = this._buildFileName.getOrigin();
@@ -261,7 +261,7 @@ var Record = class Record {
if (this.baseTime == 0)
this.baseTime = this.absoluteTime;
- this.runTime = this.absoluteTime- this.baseTime;
+ this.runTime = this.absoluteTime - this.baseTime;
let approxTime = Math.round(this.runTime/_TENTH_SEC);
MainWindow.wave._drawEvent(approxTime, this.peak);
}
@@ -292,7 +292,6 @@ var Record = class Record {
}
_getChannels() {
-
let channels = null;
let channelsPref = Application.application.getChannelsPreferences();
diff --git a/src/waveform.js b/src/waveform.js
index 6813884..d0346cb 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -50,6 +50,7 @@ var WaveForm = class WaveForm {
this._grid = grid;
let placeHolder = -100;
+ this.recordTime = placeHolder;
for (let i = 0; i < 40; i++)
peaks.push(placeHolder);
if (file) {
@@ -166,7 +167,7 @@ var WaveForm = class WaveForm {
}
start = Math.floor(this.playTime);
} else {
- if (this.recordTime >= 0) {
+ if (this.recordTime && this.recordTime >= 0) {
start = this.recordTime;
}
}
@@ -191,7 +192,7 @@ var WaveForm = class WaveForm {
cr.setSourceRGBA(0.0, 185, 161, 255);
}
- for(i = start; i <= end; i++) {
+ for(i = start; i < end; i++) {
// Keep moving until we get to a non-null array member
if (peaks[i] < 0) {
@@ -236,11 +237,9 @@ var WaveForm = class WaveForm {
} else {
peaks.push(recPeaks);
- lastTime = this.recordTime;
this.recordTime = playTime;
if (peaks.length < this.recordTime) {
- log("error");
return true;
}
if (this.drawing)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]