[gnome-sound-recorder] play.js, record.js: improve error handling
- From: Meg Ford (Margaret) <megford src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] play.js, record.js: improve error handling
- Date: Mon, 2 Jun 2014 06:15:14 +0000 (UTC)
commit f35909455ed86925a618926d26b1fa581cf2c721
Author: Meg Ford <megford gnome org>
Date: Fri May 16 20:42:40 2014 -0500
play.js, record.js: improve error handling
src/play.js | 28 +++++++++++-----------------
src/record.js | 10 ++++++++--
2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/play.js b/src/play.js
index f1289d3..48bd76a 100644
--- a/src/play.js
+++ b/src/play.js
@@ -129,29 +129,23 @@ const _TENTH_SEC = 100000000;
case Gst.MessageType.EOS:
this.onEndOfStream();
break;
+
+ case Gst.MessageType.WARNING:
+ let warningMessage = message.parse_warning()[0];
+ log(warningMessage.toString());
+ break;
case Gst.MessageType.ERROR:
- let errorMessage = message.parse_error();
- this._showErrorDialog(errorMessage);
- this.play.set_state(Gst.State.NULL);
- this.playState = PipelineStates.STOPPED;
- this.playBus.remove_signal_watch();
- this._updateTime();
-
- if (this.timeout) {
- GLib.source_remove(this.timeout);
- this.timeout = null;
- }
-
- MainWindow.wave.endDrawing();
+ let errorMessage = message.parse_error()[0];
+ this._showErrorDialog(errorMessage.toString());
+ this.play.set_state(Gst.State.NULL);
break;
case Gst.MessageType.ASYNC_DONE:
if (this.sought) {
this.play.set_state(this._lastState);
MainWindow.view.setProgressScaleSensitive();
- }
-
+ }
this.updatePosition();
break;
@@ -229,9 +223,8 @@ const _TENTH_SEC = 100000000;
buttons: Gtk.ButtonsType.OK,
message_type: Gtk.MessageType.WARNING });
- if (errorStrOne != null) {
+ if (errorStrOne != null)
errorDialog.set_property('text', errorStrOne);
- }
if (errorStrTwo != null)
errorDialog.set_property('secondary-text', errorStrTwo);
@@ -240,6 +233,7 @@ const _TENTH_SEC = 100000000;
errorDialog.connect ('response', Lang.bind(this,
function() {
errorDialog.destroy();
+ this.onEndOfStream();
}));
errorDialog.show();
}
diff --git a/src/record.js b/src/record.js
index 2194ea6..69f33fc 100644
--- a/src/record.js
+++ b/src/record.js
@@ -102,8 +102,8 @@ const Record = new Lang.Class({
}
}
}));
- let ebinProfile = this.ebin.set_property("profile", this._mediaProfile);
this.pipeline.add(this.ebin);
+ let ebinProfile = this.ebin.set_property("profile", this._mediaProfile);
let srcpad = this.ebin.get_static_pad("src");
this.filesink = Gst.ElementFactory.make("filesink", "filesink");
this.filesink.set_property("location", this.initialFileName);
@@ -243,10 +243,16 @@ const Record = new Lang.Class({
case Gst.MessageType.EOS:
this.onEndOfStream();
break;
+
+ case Gst.MessageType.WARNING:
+ let warningMessage = message.parse_warning()[0];
+ log(warningMessage.toString());
+ break;
case Gst.MessageType.ERROR:
let errorMessage = message.parse_error();
- this._showErrorDialog(errorMessage);
+ this._showErrorDialog(errorMessage.toString());
+ this.pipeline.set_state(Gst.State.NULL);
break;
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]