[gnome-sound-recorder/gnome-3-12] listview.js, play.js: Code cleanup



commit c372a2d31f84756eae104d687411e708e62ff9fc
Author: Meg Ford <megford gnome org>
Date:   Mon Jun 2 00:45:03 2014 -0500

    listview.js, play.js: Code cleanup

 src/listview.js |    6 ++++--
 src/play.js     |    8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/listview.js b/src/listview.js
index c4d62ab..847d4e5 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -198,7 +198,7 @@ const Listview = new Lang.Class({
                         
     _onDiscovererFinished: function(res, info, err) {
         this.result = res;
-        if (this.result == GstPbutils.DiscovererResult.OK) { 
+        if (this.result == GstPbutils.DiscovererResult.OK && allFilesInfo[this.idx]) { 
             this.tagInfo = info.get_tags(info);
             let appString = "";
             let dateTimeCreatedString = ""; 
@@ -227,6 +227,7 @@ const Listview = new Lang.Class({
             this._getCapsForList(info);
         } else {
             // don't index files we can't play
+            allFilesInfo.splice(this.idx, 1);
             log("File cannot be played");
         }
         
@@ -255,7 +256,8 @@ const Listview = new Lang.Class({
         
     _onDirChanged: function(dirMonitor, file1, file2, eventType) {
         if (eventType == Gio.FileMonitorEvent.DELETED || 
-            (eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT && MainWindow.recordPipeline == 
MainWindow.RecordPipelineStates.STOPPED)) {
+            (eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT 
+                && MainWindow.recordPipeline == MainWindow.RecordPipelineStates.STOPPED)) {
             stopVal = EnumeratorState.ACTIVE;
             allFilesInfo.length = 0;
             fileInfo.length = 0;
diff --git a/src/play.js b/src/play.js
index 5126428..94e0280 100644
--- a/src/play.js
+++ b/src/play.js
@@ -114,7 +114,8 @@ const _TENTH_SEC = 100000000;
             this.timeout = null;
         }
         
-        MainWindow.wave.endDrawing();
+        if (MainWindow.wave != null)
+            MainWindow.wave.endDrawing();
     },
     
     onEndOfStream: function() {
@@ -184,7 +185,9 @@ const _TENTH_SEC = 100000000;
  
         this.runTime = absoluteTime- this.baseTime;
         let approxTime = Math.round(this.runTime/_TENTH_SEC);
-        MainWindow.wave._drawEvent(approxTime);
+
+        if (MainWindow.wave != null)
+            MainWindow.wave._drawEvent(approxTime);
         
         return true;
     },
@@ -204,7 +207,6 @@ const _TENTH_SEC = 100000000;
                 this._updateTime));    
         }
     },
-
     
     setVolume: function(value) {
         this.play.set_volume(GstAudio.StreamVolumeFormat.CUBIC, value);


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