[gnome-sound-recorder] Style and whitespace fixes



commit 7c1f1d6c62a8084f3d45ecb7faebae5adf74fbf8
Author: Meg Ford <megford gnome org>
Date:   Mon Dec 29 22:55:03 2014 -0600

    Style and whitespace fixes

 src/record.js |  170 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 85 insertions(+), 85 deletions(-)
---
diff --git a/src/record.js b/src/record.js
index 3fd4111..a9ef43a 100644
--- a/src/record.js
+++ b/src/record.js
@@ -49,42 +49,42 @@ const ErrState = {
 const _TENTH_SEC = 100000000;
 
 let errorDialogState;
-   
+
 const Record = new Lang.Class({
     Name: "Record",
-    
+
     _recordPipeline: function() {
         errorDialogState = ErrState.OFF;
         this.baseTime = 0;
-        this._view = MainWindow.view; 
+        this._view = MainWindow.view;
         this._buildFileName = new BuildFileName();
         this.initialFileName = this._buildFileName.buildInitialFilename();
         let localDateTime = this._buildFileName.getOrigin();
         this.gstreamerDateTime = Gst.DateTime.new_from_g_date_time(localDateTime);
-        
+
         if (this.initialFileName == -1) {
-            this._showErrorDialog(_('Unable to create Recordings directory.'));
+            this._showErrorDialog(_("Unable to create Recordings directory."));
             errorDialogState = ErrState.ON;
             this.onEndOfStream();
         }
-                      
-        this.pipeline = new Gst.Pipeline({ name: 'pipe' });
+
+        this.pipeline = new Gst.Pipeline({ name: "pipe" });
         this.srcElement = Gst.ElementFactory.make("pulsesrc", "srcElement");
-        
+
         if(this.srcElement == null) {
-          this._showErrorDialog(_('Your audio capture settings are invalid.'));
+          this._showErrorDialog(_("Your audio capture settings are invalid."));
           errorDialogState = ErrState.ON;
           this.onEndOfStream();
           return;
         }
-        
+
         this.pipeline.add(this.srcElement);
         this.clock = this.pipeline.get_clock();
         this.recordBus = this.pipeline.get_bus();
         this.recordBus.add_signal_watch();
         this.recordBus.connect("message", Lang.bind(this,
             function(recordBus, message) {
-            
+
                 if (message != null) {
                     this._onMessageReceived(message);
                 }
@@ -92,12 +92,12 @@ const Record = new Lang.Class({
         this.level = Gst.ElementFactory.make("level", "level");
         this.pipeline.add(this.level);
         this.volume = Gst.ElementFactory.make("volume", "volume");
-        this.pipeline.add(this.volume);  
+        this.pipeline.add(this.volume);
         this.ebin = Gst.ElementFactory.make("encodebin", "ebin");
         this.ebin.connect("element-added", Lang.bind(this,
             function(ebin, element) {
                 let factory = element.get_factory();
-                
+
                 if (factory != null) {
                         this.hasTagSetter = factory.has_interface("GstTagSetter");
                         if (this.hasTagSetter == true) {
@@ -117,113 +117,113 @@ const Record = new Lang.Class({
         this.filesink = Gst.ElementFactory.make("filesink", "filesink");
         this.filesink.set_property("location", this.initialFileName);
         this.pipeline.add(this.filesink);
-        
+
         if (!this.pipeline || !this.filesink) {
-            this._showErrorDialog(_('Not all elements could be created.'));
+            this._showErrorDialog(_("Not all elements could be created."));
             errorDialogState = ErrState.ON;
             this.onEndOfStream();
         }
-            
+
         let srcLink = this.srcElement.link(this.level);
         let levelLink = this.level.link(this.volume);
         let volLink = this.volume.link(this.ebin);
         let ebinLink = this.ebin.link(this.filesink);
-        
+
         if (!srcLink || !levelLink || !ebinLink) {
-            this._showErrorDialog(_('Not all of the elements were linked'));
+            this._showErrorDialog(_("Not all of the elements were linked."));
             errorDialogState = ErrState.ON;
             this.onEndOfStream();
         }
-        
+
         GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, Application.SIGINT, 
Application.application.onWindowDestroy, this.pipeline);
         GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, Application.SIGTERM, 
Application.application.onWindowDestroy, this.pipeline);
     },
-                   
-    _updateTime: function() {          
+
+    _updateTime: function() {
         let time = this.pipeline.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
-        
+
         if (time >= 0) {
-            this._view.setLabel(time, 0);            
-        }        
-        
+            this._view.setLabel(time, 0);
+        }
+
         return true;
     },
-       
+
     startRecording: function(profile) {
         this.profile = profile;
         this._audioProfile = MainWindow.audioProfile;
         this._mediaProfile = this._audioProfile.mediaProfile();
-        
+
         if (this._mediaProfile == -1) {
-            this._showErrorDialog(_('No Media Profile was set.'));
+            this._showErrorDialog(_("No Media Profile was set."));
             errorDialogState = ErrState.ON;
         }
-        
+
         if (!this.pipeline || this.pipeState == PipelineStates.STOPPED )
             this._recordPipeline();
-            
+
         let ret = this.pipeline.set_state(Gst.State.PLAYING);
         this.pipeState = PipelineStates.PLAYING;
-        
+
         if (ret == Gst.StateChangeReturn.FAILURE) {
-            this._showErrorDialog(_('Unable to set the pipeline \n to the recording state'));
+            this._showErrorDialog(_("Unable to set the pipeline \n to the recording state."));
             errorDialogState = ErrState.ON;
-            this._buildFileName.getTitle().delete_async(GLib.PRIORITY_DEFAULT, null, null); 
-        } else {        
-            MainWindow.view.setVolume(); 
+            this._buildFileName.getTitle().delete_async(GLib.PRIORITY_DEFAULT, null, null);
+        } else {
+            MainWindow.view.setVolume();
         }
-           
+
         if (!this.timeout) {
-            this.timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MainWindow._SEC_TIMEOUT, Lang.bind(this, 
this._updateTime));    
+            this.timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MainWindow._SEC_TIMEOUT, Lang.bind(this, 
this._updateTime));
         }
     },
 
     stopRecording: function() {
         let sent = this.pipeline.send_event(Gst.Event.new_eos());
-        
+
         if (this.timeout) {
             GLib.source_remove(this.timeout);
             this.timeout = null;
         }
-         
-        if (MainWindow.wave != null)    
+
+        if (MainWindow.wave != null)
             MainWindow.wave.endDrawing();
     },
-    
-    onEndOfStream: function() { 
+
+    onEndOfStream: function() {
         this.pipeline.set_state(Gst.State.NULL);
         this.pipeState = PipelineStates.STOPPED;
-        
-        if (this.recordBus) 
+
+        if (this.recordBus)
                this.recordBus.remove_signal_watch();
-               
-        this._updateTime(); 
+
+        this._updateTime();
         errorDialogState = ErrState.OFF;
     },
-        
+
     _onMessageReceived: function(message) {
         this.localMsg = message;
         let msg = message.type;
         switch(msg) {
-            
+
         case Gst.MessageType.ELEMENT:
             if (GstPbutils.is_missing_plugin_message(this.localMsg)) {
                 let errorOne = null;
-                let errorTwo = null; 
+                let errorTwo = null;
                 let detail = GstPbutils.missing_plugin_message_get_installer_detail(this.localMsg);
-                       
+
                 if (detail != null)
                     errorOne = detail;
-                                                   
+
                 let description = GstPbutils.missing_plugin_message_get_description(this.localMsg);
-                   
+
                 if (description != null)
-                    errorTwo = description; 
-    
-                this._showErrorDialog(errorOne, errorTwo); 
-                errorDialogState = ErrState.ON;                          
+                    errorTwo = description;
+
+                this._showErrorDialog(errorOne, errorTwo);
+                errorDialogState = ErrState.ON;
             }
-                
+
             let s = message.get_structure();
                 if (s) {
                     if (s.has_name("level")) {
@@ -234,51 +234,51 @@ const Record = new Lang.Class({
                         let dur = s.get_value("duration");
                         let runTime = s.get_value("running-time");
                         peakVal = s.get_value("peak");
-                        
+
                         if (peakVal) {
                             let val = peakVal.get_nth(0);
-                            
+
                             if (val > 0)
                                            val = 0;
                             let value = Math.pow(10, val/20);
                             this.peak = value;
-                            
+
                             this.absoluteTime = this.clock.get_time();
 
                             if (this.baseTime == 0)
                                 this.baseTime = this.absoluteTime;
- 
+
                             this.runTime = this.absoluteTime- this.baseTime;
                             let approxTime = Math.round(this.runTime/_TENTH_SEC);
                             MainWindow.wave._drawEvent(approxTime, this.peak);
-                            }                          
+                            }
                         }
                     }
             break;
-                    
-        case Gst.MessageType.EOS:                  
-            this.onEndOfStream(); 
+
+        case Gst.MessageType.EOS:
+            this.onEndOfStream();
             break;
-            
-        case Gst.MessageType.WARNING:               
+
+        case Gst.MessageType.WARNING:
             let warningMessage = message.parse_warning()[0];
-            log(warningMessage.toString()); 
+            log(warningMessage.toString());
             break;
-                                        
+
         case Gst.MessageType.ERROR:
             let errorMessage = message.parse_error();
-            this._showErrorDialog(errorMessage.toString()); 
-            errorDialogState = ErrState.ON;               
+            this._showErrorDialog(errorMessage.toString());
+            errorDialogState = ErrState.ON;
             break;
         }
     },
-    
+
     setVolume: function(value) {
         if (this.volume) {
             this.volume.set_volume(GstAudio.StreamVolumeFormat.CUBIC, value);
         }
     },
-    
+
     _showErrorDialog: function(errorStrOne, errorStrTwo) {
         if (errorDialogState == ErrState.OFF) {
             let errorDialog = new Gtk.MessageDialog ({ modal: true,
@@ -286,26 +286,26 @@ const Record = new Lang.Class({
                                                        buttons: Gtk.ButtonsType.OK,
                                                        message_type: Gtk.MessageType.WARNING });
             if (errorStrOne != null) {
-                errorDialog.set_property('text', errorStrOne);
+                errorDialog.set_property("text", errorStrOne);
             }
-             
+
             if (errorStrTwo != null)
-                errorDialog.set_property('secondary-text', errorStrTwo);
-                
+                errorDialog.set_property("secondary-text", errorStrTwo);
+
             errorDialog.set_transient_for(Gio.Application.get_default().get_active_window());
-            errorDialog.connect('response', Lang.bind(this,
+            errorDialog.connect("response", Lang.bind(this,
                 function() {
                     errorDialog.destroy();
                     MainWindow.view.onRecordStopClicked();
                     this.onEndOfStream();
                 }));
             errorDialog.show();
-        } 
-    } 
+        }
+    }
 });
 
-const BuildFileName = new Lang.Class({ 
-    Name: 'BuildFileName',
+const BuildFileName = new Lang.Class({
+    Name: "BuildFileName",
 
     buildInitialFilename: function() {
         let fileExtensionName = MainWindow.audioProfile.fileExtensionReturner();
@@ -320,14 +320,14 @@ const BuildFileName = new Lang.Class({
         let file = this.clip.get_path();
         return file;
     },
-    
+
     getTitle: function() {
         return this.clip;
     },
-    
+
     getOrigin: function() {
         return this.dateTime;
-    } 
+    }
 });
 
 


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