[gnome-sound-recorder] listview.js, play.js, record.js: More error handling



commit d26b28d1a48ed9550c6d37bddeed0f4941600f47
Author: Meg Ford <megford gnome org>
Date:   Mon Jun 2 00:51:46 2014 -0500

    listview.js, play.js, record.js: More error handling

 src/listview.js |   10 +++++-----
 src/play.js     |    4 ++--
 src/record.js   |    8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/listview.js b/src/listview.js
index 531e843..b115cdb 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -301,12 +301,12 @@ const Listview = new Lang.Class({
         } else if (audioCaps.can_intersect(this.capTypes(AudioProfile.audioCodecMap.FLAC))) {
             allFilesInfo[this.idx].mediaType = mediaTypeMap.FLAC;
                       
-        } else {
-            if (allFilesInfo[this.idx].mediaType == null) {
+        } 
+        
+        if (allFilesInfo[this.idx].mediaType == null) {
                 // Remove the file from the array if we don't recognize it    
-                allFilesInfo.splice(this.idx, 1);
-            }       
-        }       
+                allFilesInfo.splice(this.idx, 1);    
+        }      
     },
 
     capTypes: function(capString) {
diff --git a/src/play.js b/src/play.js
index 78530d8..24bab2b 100644
--- a/src/play.js
+++ b/src/play.js
@@ -78,8 +78,8 @@ const _TENTH_SEC = 100000000;
         this.playState = PipelineStates.PLAYING;
                 
         if (this.ret == Gst.StateChangeReturn.FAILURE) {
-            this._showErrorDialog(_('Unable to play recording')); 
-            this.onEndOfStream();
+            this._showErrorDialog(_('Unable to play recording'));
+            this.play.set_state(Gst.State.NULL); 
         } else if (this.ret == Gst.StateChangeReturn.SUCCESS) {        
             MainWindow.view.setVolume(); 
         }
diff --git a/src/record.js b/src/record.js
index 69f33fc..7b54c8c 100644
--- a/src/record.js
+++ b/src/record.js
@@ -154,8 +154,8 @@ const Record = new Lang.Class({
         this.pipeState = PipelineStates.PLAYING;
         
         if (ret == Gst.StateChangeReturn.FAILURE) {
-            this._showErrorDialog(_('Unable to set the pipeline \n to the recording state')); 
-            this._buildFileName.getTitle().delete_async(GLib.PRIORITY_DEFAULT, null, null);
+            this._showErrorDialog(_('Unable to set the pipeline \n to the recording state'));
+            this._buildFileName.getTitle().delete_async(GLib.PRIORITY_DEFAULT, null, null); 
         } else {        
             MainWindow.view.setVolume(); 
         }
@@ -204,8 +204,8 @@ const Record = new Lang.Class({
                    
                 if (description != null)
                     errorTwo = description; 
-                       
-                this._showErrorDialog(errorOne, errorTwo);                       
+                this.pipeline.set_state(Gst.State.NULL);      
+                log(errorOne, errorTwo);                       
             }
                 
             let s = message.get_structure();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]