[gnome-sound-recorder/wip/christopherdavis/use-var-instead-of-let-or-const] sound-recorder: Use var instead of let or const



commit b6ca7244012fa4c8e6340ff052067f4dd0b6ce05
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Jan 10 18:19:50 2019 -0500

    sound-recorder: Use var instead of let or const
    
    As per #32, let/const are not appropriate for ES6 code,
    and are replaced by let. While the code worked before, it's
    not guaranteed to work in the future and thus has been updated.

 src/application.js  |  46 +++++------
 src/audioProfile.js |  30 +++----
 src/fileUtil.js     |  50 ++++++------
 src/info.js         |  36 ++++-----
 src/listview.js     | 104 ++++++++++++------------
 src/main.js         |   2 +-
 src/mainWindow.js   | 222 ++++++++++++++++++++++++++--------------------------
 src/params.js       |  10 +--
 src/play.js         |  56 ++++++-------
 src/preferences.js  |  38 ++++-----
 src/record.js       | 120 ++++++++++++++--------------
 src/util.js         |  10 +--
 src/waveform.js     | 100 +++++++++++------------
 13 files changed, 412 insertions(+), 412 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index dc2982e..78635ec 100644
--- a/src/application.js
+++ b/src/application.js
@@ -17,24 +17,24 @@
 *
 */
 
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gst = imports.gi.Gst;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gst = imports.gi.Gst;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
 
-const MainWindow = imports.mainWindow;
-const Preferences = imports.preferences;
-const Util = imports.util;
+var MainWindow = imports.mainWindow;
+var Preferences = imports.preferences;
+var Util = imports.util;
 
-const SIGINT = 2;
-const SIGTERM = 15;
+var SIGINT = 2;
+var SIGTERM = 15;
 
-let application = null;
-let settings = null;
+var application = null;
+var settings = null;
 
 
-const Application = new Lang.Class({
+var Application = new Lang.Class({
     Name: 'Application',
     Extends: Gtk.Application,
 
@@ -44,21 +44,21 @@ const Application = new Lang.Class({
     },
 
     _initAppMenu: function() {
-        let preferences = new Gio.SimpleAction({ name: 'preferences' });
+        var preferences = new Gio.SimpleAction({ name: 'preferences' });
         preferences.connect('activate', Lang.bind(this,
             function() {
                 this._showPreferences();
             }));
         this.add_action(preferences);
 
-        let aboutAction = new Gio.SimpleAction({ name: 'about' });
+        var aboutAction = new Gio.SimpleAction({ name: 'about' });
         aboutAction.connect('activate', Lang.bind(this,
             function() {
                 this._showAbout();
             }));
         this.add_action(aboutAction);
 
-        let quitAction = new Gio.SimpleAction({ name: 'quit' });
+        var quitAction = new Gio.SimpleAction({ name: 'quit' });
         quitAction.connect('activate', Lang.bind(this,
             function() {
                 this.quit();
@@ -81,7 +81,7 @@ const Application = new Lang.Class({
 
     ensure_directory: function() {
         /* Translators: "Recordings" here refers to the name of the directory where the application places 
files */
-        let path = GLib.build_filenamev([GLib.get_home_dir(), _("Recordings")]);
+        var path = GLib.build_filenamev([GLib.get_home_dir(), _("Recordings")]);
 
         // Ensure Recordings directory
         GLib.mkdir_with_parents(path, parseInt("0755", 8));
@@ -103,7 +103,7 @@ const Application = new Lang.Class({
     },
 
     _showPreferences: function() {
-        let preferencesDialog = new Preferences.Preferences();
+        var preferencesDialog = new Preferences.Preferences();
 
         preferencesDialog.widget.connect('response', Lang.bind(this,
             function(widget, response) {
@@ -112,7 +112,7 @@ const Application = new Lang.Class({
     },
 
     getPreferences: function() {
-        let set = settings.get_int("media-type-preset");
+        var set = settings.get_int("media-type-preset");
         return set;
      },
 
@@ -121,7 +121,7 @@ const Application = new Lang.Class({
     },
 
     getChannelsPreferences: function() {
-        let set = settings.get_int("channel");
+        var set = settings.get_int("channel");
         return set;
     },
 
@@ -130,7 +130,7 @@ const Application = new Lang.Class({
     },
 
     getMicVolume: function() {
-        let micVolLevel = settings.get_double("mic-volume");
+        var micVolLevel = settings.get_double("mic-volume");
         return micVolLevel;
     },
 
@@ -139,7 +139,7 @@ const Application = new Lang.Class({
     },
 
     getSpeakerVolume: function() {
-        let speakerVolLevel = settings.get_double("speaker-volume");
+        var speakerVolLevel = settings.get_double("speaker-volume");
         return speakerVolLevel;
     },
 
@@ -148,7 +148,7 @@ const Application = new Lang.Class({
     },
 
     _showAbout: function() {
-        let aboutDialog = new Gtk.AboutDialog();
+        var aboutDialog = new Gtk.AboutDialog();
         aboutDialog.artists = [ 'Reda Lazri <the red shortcut gmail com>',
                                 'Garrett LeSage <garrettl gmail com>',
                                 'Hylke Bons <hylkebons gmail com>',
diff --git a/src/audioProfile.js b/src/audioProfile.js
index 5143701..d5bacb8 100644
--- a/src/audioProfile.js
+++ b/src/audioProfile.js
@@ -17,17 +17,17 @@
  *
  */
 
-const _ = imports.gettext.gettext;
-const Gio = imports.gi.Gio;
-const Gst = imports.gi.Gst;
-const GstPbutils = imports.gi.GstPbutils;
-const Lang = imports.lang;
-const Mainloop = imports.mainloop;
+var _ = imports.gettext.gettext;
+var Gio = imports.gi.Gio;
+var Gst = imports.gi.Gst;
+var GstPbutils = imports.gi.GstPbutils;
+var Lang = imports.lang;
+var Mainloop = imports.mainloop;
 
-const MainWindow = imports.mainWindow;
-const Preferences = imports.preferences;
+var MainWindow = imports.mainWindow;
+var Preferences = imports.preferences;
 
-const comboBoxMap = {
+var comboBoxMap = {
     OGG_VORBIS: 0,
     OPUS: 1,
     FLAC: 2,
@@ -35,7 +35,7 @@ const comboBoxMap = {
     MP4: 4
 };
 
-const containerProfileMap = {
+var containerProfileMap = {
     OGG: "application/ogg",
     ID3: "application/x-id3",
     MP4: "video/quicktime,variant=(string)iso",
@@ -43,7 +43,7 @@ const containerProfileMap = {
 };
 
 
-const audioCodecMap = {
+var audioCodecMap = {
     FLAC: "audio/x-flac",
     MP3: "audio/mpeg,mpegversion=(int)1,layer=(int)3",
     MP4: "audio/mpeg,mpegversion=(int)4",
@@ -52,7 +52,7 @@ const audioCodecMap = {
 };
 
 
-const AudioProfile = new Lang.Class({
+var AudioProfile = new Lang.Class({
     Name: 'AudioProfile',
 
     profile: function(profileName){
@@ -89,10 +89,10 @@ const AudioProfile = new Lang.Class({
     },
 
     mediaProfile: function(){
-        let audioCaps;
+        var audioCaps;
         this._containerProfile = null;
         if (this._values.audio && this._values.container) {
-            let caps = Gst.Caps.from_string(this._values.container);
+            var caps = Gst.Caps.from_string(this._values.container);
             this._containerProfile = GstPbutils.EncodingContainerProfile.new("record", null, caps, null);
             audioCaps = Gst.Caps.from_string(this._values.audio);
             this.encodingProfile = GstPbutils.EncodingAudioProfile.new(audioCaps, null, null, 1);
@@ -108,7 +108,7 @@ const AudioProfile = new Lang.Class({
     },
 
     fileExtensionReturner: function() {
-        let suffixName;
+        var suffixName;
 
         if (this._values.audio) {
             if (this._containerProfile != null)
diff --git a/src/fileUtil.js b/src/fileUtil.js
index f4364ef..2eca15f 100644
--- a/src/fileUtil.js
+++ b/src/fileUtil.js
@@ -17,25 +17,25 @@
  *
  */
 
-const Gettext = imports.gettext;
-const _ = imports.gettext.gettext;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gst = imports.gi.Gst;
-const GstPbutils = imports.gi.GstPbutils;
-const Lang = imports.lang;
-const Signals = imports.signals;
+var Gettext = imports.gettext;
+var _ = imports.gettext.gettext;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var GObject = imports.gi.GObject;
+var Gst = imports.gi.Gst;
+var GstPbutils = imports.gi.GstPbutils;
+var Lang = imports.lang;
+var Signals = imports.signals;
 
-const Listview = imports.listview;
-const MainWindow = imports.mainWindow;
-const Record = imports.record;
+var Listview = imports.listview;
+var MainWindow = imports.mainWindow;
+var Record = imports.record;
 
-const _OFFSET_STEP = 20;
-let CurrentEndIdx;
-let totItems;
+var _OFFSET_STEP = 20;
+var CurrentEndIdx;
+var totItems;
 
-const OffsetController = new Lang.Class({
+var OffsetController = new Lang.Class({
     Name: 'OffsetController',
 
     _init: function(context) {
@@ -69,18 +69,18 @@ const OffsetController = new Lang.Class({
     }
 });
 
-const DisplayTime = new Lang.Class({
+var DisplayTime = new Lang.Class({
     Name: 'DisplayTime',
 
     getDisplayTime: function(mtime) {
-        let text = "";
-        let DAY = 86400000000;
-        let now = GLib.DateTime.new_now_local();
-        let difference = now.difference(mtime);
-        let days = Math.floor(difference / DAY);
-        let weeks = Math.floor(difference / (7 * DAY));
-        let months = Math.floor(difference / (30 * DAY));
-        let years = Math.floor(difference / (365 * DAY));
+        var text = "";
+        var DAY = 86400000000;
+        var now = GLib.DateTime.new_now_local();
+        var difference = now.difference(mtime);
+        var days = Math.floor(difference / DAY);
+        var weeks = Math.floor(difference / (7 * DAY));
+        var months = Math.floor(difference / (30 * DAY));
+        var years = Math.floor(difference / (365 * DAY));
 
         if (difference < DAY) {
             text = mtime.format('%X');
diff --git a/src/info.js b/src/info.js
index 5a4e298..3bc27e8 100644
--- a/src/info.js
+++ b/src/info.js
@@ -18,21 +18,21 @@
  *
  */
 
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
 
-const _ = imports.gettext.gettext;
-const C_ = imports.gettext.pgettext;
+var _ = imports.gettext.gettext;
+var C_ = imports.gettext.pgettext;
 
-const MainWindow = imports.mainWindow;
+var MainWindow = imports.mainWindow;
 
-const InfoDialog = new Lang.Class({
+var InfoDialog = new Lang.Class({
     Name: 'InfoDialog',
 
     _init: function(fileNav) {
-        let fileName = fileNav;
+        var fileName = fileNav;
 
         this._file = Gio.File.new_for_uri(fileNav.uri);
 
@@ -41,26 +41,26 @@ const InfoDialog = new Lang.Class({
                                         destroy_with_parent: true,
                                         default_width: 400 });
         this.widget.set_transient_for(Gio.Application.get_default().get_active_window());
-        let header = new Gtk.HeaderBar({ title: _("Info") });
+        var header = new Gtk.HeaderBar({ title: _("Info") });
         header.set_show_close_button(false);
         this.widget.set_titlebar(header);
 
-        let cancelButton = new Gtk.Button({ label: _("Cancel") });
+        var cancelButton = new Gtk.Button({ label: _("Cancel") });
         cancelButton.connect("clicked", Lang.bind(this, this.onCancelClicked));
 
         header.pack_start(cancelButton);
 
-        let doneButton = new Gtk.Button({ label: _("Done") });
+        var doneButton = new Gtk.Button({ label: _("Done") });
         doneButton.connect("clicked", Lang.bind(this, this.onDoneClicked));
 
         header.pack_end(doneButton);
 
-        let headerBarSizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.HORIZONTAL });
+        var headerBarSizeGroup = new Gtk.SizeGroup({ mode: Gtk.SizeGroupMode.HORIZONTAL });
 
         headerBarSizeGroup.add_widget(cancelButton);
         headerBarSizeGroup.add_widget(doneButton);
 
-        let grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
+        var grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
                                    row_homogeneous: true,
                                    column_homogeneous: true,
                                    halign: Gtk.Align.CENTER,
@@ -71,7 +71,7 @@ const InfoDialog = new Lang.Class({
                                    margin_start: 18,
                                    margin_top: 18 });
 
-        let contentArea = this.widget.get_content_area();
+        var contentArea = this.widget.get_content_area();
         contentArea.pack_start(grid, true, true, 2);
 
         // File Name item
@@ -125,8 +125,8 @@ const InfoDialog = new Lang.Class({
         grid.attach_next_to(this._fileNameEntry, this._name, Gtk.PositionType.RIGHT, 2, 1);
 
         // Source value
-        let sourceLink = this._file.get_parent();
-        let sourcePath = sourceLink.get_path();
+        var sourceLink = this._file.get_parent();
+        var sourcePath = sourceLink.get_path();
 
         this._sourceData = new Gtk.LinkButton({ label: sourcePath,
                                                 uri: sourceLink.get_uri(),
@@ -157,7 +157,7 @@ const InfoDialog = new Lang.Class({
     },
 
     onDoneClicked: function() {
-        let newFileName = this._fileNameEntry.get_text();
+        var newFileName = this._fileNameEntry.get_text();
         this._file.set_display_name_async(newFileName, GLib.PRIORITY_DEFAULT, null, null);
         this.widget.destroy();
     },
diff --git a/src/listview.js b/src/listview.js
index afe508a..c39a3f5 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -18,25 +18,25 @@
  *
  */
 
-const _ = imports.gettext.gettext;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gst = imports.gi.Gst;
-const GstPbutils = imports.gi.GstPbutils;
-const Lang = imports.lang;
-const Signals = imports.signals;
-
-const AudioProfile = imports.audioProfile;
-const MainWindow = imports.mainWindow;
-const Record = imports.record;
-
-const EnumeratorState = {
+var _ = imports.gettext.gettext;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var GObject = imports.gi.GObject;
+var Gst = imports.gi.Gst;
+var GstPbutils = imports.gi.GstPbutils;
+var Lang = imports.lang;
+var Signals = imports.signals;
+
+var AudioProfile = imports.audioProfile;
+var MainWindow = imports.mainWindow;
+var Record = imports.record;
+
+var EnumeratorState = {
     ACTIVE: 0,
     CLOSED: 1
 };
 
-const mediaTypeMap = {
+var mediaTypeMap = {
     FLAC: "FLAC",
     OGG_VORBIS: "Ogg Vorbis",
     OPUS: "Opus",
@@ -44,25 +44,25 @@ const mediaTypeMap = {
     MP4: "MP4"
 };
 
-const ListType = {
+var ListType = {
     NEW: 0,
     REFRESH: 1
 };
 
-const CurrentlyEnumerating = {
+var CurrentlyEnumerating = {
     TRUE: 0,
     FALSE: 1
 };
 
-let allFilesInfo = null;
-let currentlyEnumerating = null;
-let fileInfo = null;
-let listType = null;
-let startRecording = false;
-let stopVal = null;
+var allFilesInfo = null;
+var currentlyEnumerating = null;
+var fileInfo = null;
+var listType = null;
+var startRecording = false;
+var stopVal = null;
 var trackNumber = 0;
 
-const Listview = new Lang.Class({
+var Listview = new Lang.Class({
     Name: "Listview",
 
     _init: function() {
@@ -100,14 +100,14 @@ const Listview = new Lang.Class({
         try{
             this._enumerator.next_files_async(20, GLib.PRIORITY_DEFAULT, null, Lang.bind(this,
                 function(obj, res) {
-                    let files = obj.next_files_finish(res);
+                    var files = obj.next_files_finish(res);
 
                     if (files.length) {
                         files.forEach(Lang.bind(this,
                             function(file) {
-                                let returnedName = file.get_attribute_as_string("standard::display-name");
+                                var returnedName = file.get_attribute_as_string("standard::display-name");
                                 try {
-                                    let returnedNumber = parseInt(returnedName.split(" ")[1]);
+                                    var returnedNumber = parseInt(returnedName.split(" ")[1]);
                                     if (returnedNumber > trackNumber)
                                         trackNumber = returnedNumber;
 
@@ -118,19 +118,19 @@ const Listview = new Lang.Class({
                                     log("Tracknumber not returned");
                                     // Don't handle the error
                                 }
-                                let finalFileName = GLib.build_filenamev([this._saveDir.get_path(),
+                                var finalFileName = GLib.build_filenamev([this._saveDir.get_path(),
                                                                           returnedName]);
-                                let fileUri = GLib.filename_to_uri(finalFileName, null);
-                                let timeVal = file.get_modification_time();
-                                let date = GLib.DateTime.new_from_timeval_local(timeVal);
-                                let dateModifiedSortString = date.format("%Y%m%d%H%M%S");
-                                let dateTime = GLib.DateTime.new_from_timeval_local(timeVal);
-                                let dateModifiedDisplayString = 
MainWindow.displayTime.getDisplayTime(dateTime);
-                                let dateCreatedYes = file.has_attribute("time::created");
-                                let dateCreatedString = null;
+                                var fileUri = GLib.filename_to_uri(finalFileName, null);
+                                var timeVal = file.get_modification_time();
+                                var date = GLib.DateTime.new_from_timeval_local(timeVal);
+                                var dateModifiedSortString = date.format("%Y%m%d%H%M%S");
+                                var dateTime = GLib.DateTime.new_from_timeval_local(timeVal);
+                                var dateModifiedDisplayString = 
MainWindow.displayTime.getDisplayTime(dateTime);
+                                var dateCreatedYes = file.has_attribute("time::created");
+                                var dateCreatedString = null;
                                 if (this.dateCreatedYes) {
-                                    let dateCreatedVal = file.get_attribute_uint64("time::created");
-                                    let dateCreated = GLib.DateTime.new_from_timeval_local(dateCreatedVal);
+                                    var dateCreatedVal = file.get_attribute_uint64("time::created");
+                                    var dateCreated = GLib.DateTime.new_from_timeval_local(dateCreatedVal);
                                     dateCreatedString = MainWindow.displayTime.getDisplayTime(dateCreated);
                                 }
 
@@ -191,9 +191,9 @@ const Listview = new Lang.Class({
         this.idx = 0;
         this._discoverer = new GstPbutils.Discoverer();
         this._discoverer.start();
-        for (let i = 0; i <= this.endIdx; i++) {
-            let file = allFilesInfo[i];
-            let uri = file.uri;
+        for (var i = 0; i <= this.endIdx; i++) {
+            var file = allFilesInfo[i];
+            var uri = file.uri;
             this._discoverer.discover_uri_async(uri);
         }
         this._runDiscover();
@@ -202,7 +202,7 @@ const Listview = new Lang.Class({
      _runDiscover: function() {
           this._discoverer.connect('discovered', Lang.bind(this,
             function(_discoverer, info, error) {
-                let result = info.get_result();
+                var result = info.get_result();
                 this._onDiscovererFinished(result, info, error);
              }));
     },
@@ -211,16 +211,16 @@ const Listview = new Lang.Class({
         this.result = res;
         if (this.result == GstPbutils.DiscovererResult.OK && allFilesInfo[this.idx]) {
             this.tagInfo = info.get_tags();
-            let appString = "";
+            var appString = "";
             appString = this.tagInfo.get_value_index(Gst.TAG_APPLICATION_NAME, 0);
-            let dateTimeTag = this.tagInfo.get_date_time('datetime')[1];
-            let durationInfo = info.get_duration();
+            var dateTimeTag = this.tagInfo.get_date_time('datetime')[1];
+            var durationInfo = info.get_duration();
             allFilesInfo[this.idx].duration = durationInfo;
 
             /* this.file.dateCreated will usually be null since time::created it doesn't usually exist.
                Therefore, we prefer to set it with tags */
             if (dateTimeTag != null) {
-                let dateTimeCreatedString = dateTimeTag.to_g_date_time();
+                var dateTimeCreatedString = dateTimeTag.to_g_date_time();
 
                 if (dateTimeCreatedString) {
                     allFilesInfo[this.idx].dateCreated = 
MainWindow.displayTime.getDisplayTime(dateTimeCreatedString);
@@ -312,12 +312,12 @@ const Listview = new Lang.Class({
     },
 
     _getCapsForList: function(info) {
-        let discovererStreamInfo = null;
+        var discovererStreamInfo = null;
         discovererStreamInfo = info.get_stream_info();
-        let containerStreams = info.get_container_streams()[0];
-        let containerCaps = discovererStreamInfo.get_caps();
-        let audioStreams = info.get_audio_streams()[0];
-        let audioCaps =  audioStreams.get_caps();
+        var containerStreams = info.get_container_streams()[0];
+        var containerCaps = discovererStreamInfo.get_caps();
+        var audioStreams = info.get_audio_streams()[0];
+        var audioCaps =  audioStreams.get_caps();
 
         if (containerCaps.can_intersect(this.capTypes(AudioProfile.containerProfileMap.AUDIO_OGG))) {
 
@@ -348,7 +348,7 @@ const Listview = new Lang.Class({
     },
 
     capTypes: function(capString) {
-       let caps = Gst.Caps.from_string(capString);
+       var caps = Gst.Caps.from_string(capString);
        return caps;
     },
 
diff --git a/src/main.js b/src/main.js
index 80e4f2a..8e44f1f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -36,7 +36,7 @@ pkg.require({ 'Gdk': '3.0',
               'GstAudio': '1.0',
               'GstPbutils': '1.0' });
 
-const Application = imports.application;
+var Application = imports.application;
 
 function main(argv) {
     return (new Application.Application()).run(argv);
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 3bd0da5..540ff23 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -17,77 +17,77 @@
 *
 */
 
-const Gettext = imports.gettext;
-const _ = imports.gettext.gettext;
-const Gdk = imports.gi.Gdk;
-const GdkPixbuf = imports.gi.GdkPixbuf;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gst = imports.gi.Gst;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
-const Pango = imports.gi.Pango;
-
-const Application = imports.application;
-const AudioProfile = imports.audioProfile;
-const FileUtil = imports.fileUtil;
-const Info = imports.info;
-const Listview = imports.listview;
-const Params = imports.params;
-const Play = imports.play;
-const Preferences = imports.preferences;
-const Record = imports.record;
-const Waveform = imports.waveform;
-
-let activeProfile = null;
-let audioProfile = null;
-let displayTime = null;
-let grid = null;
-let groupGrid;
-let header;
-let list = null;
-let loadMoreButton = null;
-let offsetController = null;
-let play = null;
-let previousSelRow = null;
-let recordPipeline = null;
-let recordButton = null;
-let appMenuButton = null;
-let selectable = null;
-let setVisibleID = null;
-let UpperBoundVal = 182;
-let view = null;
-let volumeValue = [];
+var Gettext = imports.gettext;
+var _ = imports.gettext.gettext;
+var Gdk = imports.gi.Gdk;
+var GdkPixbuf = imports.gi.GdkPixbuf;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gst = imports.gi.Gst;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
+var Pango = imports.gi.Pango;
+
+var Application = imports.application;
+var AudioProfile = imports.audioProfile;
+var FileUtil = imports.fileUtil;
+var Info = imports.info;
+var Listview = imports.listview;
+var Params = imports.params;
+var Play = imports.play;
+var Preferences = imports.preferences;
+var Record = imports.record;
+var Waveform = imports.waveform;
+
+var activeProfile = null;
+var audioProfile = null;
+var displayTime = null;
+var grid = null;
+var groupGrid;
+var header;
+var list = null;
+var loadMoreButton = null;
+var offsetController = null;
+var play = null;
+var previousSelRow = null;
+var recordPipeline = null;
+var recordButton = null;
+var appMenuButton = null;
+var selectable = null;
+var setVisibleID = null;
+var UpperBoundVal = 182;
+var view = null;
+var volumeValue = [];
 var wave = null;
 
-const rtl = Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL;
+var rtl = Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL;
 
-const ActiveArea = {
+var ActiveArea = {
     RECORD: 0,
     PLAY: 1
 };
 
-const ListColumns = {
+var ListColumns = {
     NAME: 0,
     MENU: 1
 };
 
-const PipelineStates = {
+var PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
     STOPPED: 2
 };
 
-const RecordPipelineStates = {
+var RecordPipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
     STOPPED: 2
 };
 
-const _TIME_DIVISOR = 60;
-const _SEC_TIMEOUT = 100;
+var _TIME_DIVISOR = 60;
+var _SEC_TIMEOUT = 100;
 
-const MainWindow = new Lang.Class({
+var MainWindow = new Lang.Class({
     Name: 'MainWindow',
     Extends: Gtk.ApplicationWindow,
 
@@ -122,7 +122,7 @@ const MainWindow = new Lang.Class({
     },
 
     _addAppMenu: function() {
-        let menu = new Gio.Menu();
+        var menu = new Gio.Menu();
         menu.append(_("Preferences"), 'app.preferences');
         menu.append(_("About Sound Recorder"), 'app.about');
 
@@ -134,7 +134,7 @@ const MainWindow = new Lang.Class({
     }
 });
 
-const MainView = new Lang.Class({
+var MainView = new Lang.Class({
     Name: 'MainView',
     Extends: Gtk.Stack,
 
@@ -157,16 +157,16 @@ const MainView = new Lang.Class({
                                         valign: Gtk.Align.CENTER });
         this._scrolledWin.add(this.emptyGrid);
 
-        let emptyPageImage = new Gtk.Image({ icon_name: 'audio-input-microphone-symbolic',
+        var emptyPageImage = new Gtk.Image({ icon_name: 'audio-input-microphone-symbolic',
                                              icon_size: Gtk.IconSize.DIALOG });
         emptyPageImage.get_style_context().add_class('dim-label');
         this.emptyGrid.add(emptyPageImage);
-        let emptyPageTitle = new Gtk.Label({ label: _("Add Recordings"),
+        var emptyPageTitle = new Gtk.Label({ label: _("Add Recordings"),
                                              halign: Gtk.Align.CENTER,
                                              valign: Gtk.Align.CENTER });
         emptyPageTitle.get_style_context().add_class('dim-label');
         this.emptyGrid.add(emptyPageTitle);
-        let emptyPageDirections = new Gtk.Label({ label: _("Use the <b>Record</b> button to make sound 
recordings"),
+        var emptyPageDirections = new Gtk.Label({ label: _("Use the <b>Record</b> button to make sound 
recordings"),
                                                   use_markup: true,
                                                   max_width_chars: 30,
                                                   halign: Gtk.Align.CENTER,
@@ -191,8 +191,8 @@ const MainView = new Lang.Class({
     onPlayStopClicked: function() {
         if (play.getPipeStates() == PipelineStates.PLAYING) {
             play.stopPlaying();
-            let listRow = this.listBox.get_selected_row();
-            let rowWidget = listRow.get_child(this.widget);
+            var listRow = this.listBox.get_selected_row();
+            var rowWidget = listRow.get_child(this.widget);
             rowWidget.foreach(Lang.bind(this,
                 function(child) {
 
@@ -232,18 +232,18 @@ const MainView = new Lang.Class({
 
     _formatTime: function(unformattedTime) {
         this.unformattedTime = unformattedTime;
-        let seconds = Math.floor(this.unformattedTime);
-        let hours = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
-        let hoursString = ""
+        var seconds = Math.floor(this.unformattedTime);
+        var hours = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
+        var hoursString = ""
 
         if (hours > 10)
             hoursString = hours + ":"
         else if (hours < 10 && hours > 0)
             hoursString = "0" + hours + ":"
 
-        let minuteString = parseInt(seconds / _TIME_DIVISOR) % _TIME_DIVISOR;
-        let secondString = parseInt(seconds % _TIME_DIVISOR);
-        let timeString =
+        var minuteString = parseInt(seconds / _TIME_DIVISOR) % _TIME_DIVISOR;
+        var secondString = parseInt(seconds % _TIME_DIVISOR);
+        var timeString =
             hoursString +
             (minuteString < 10 ? "0" + minuteString : minuteString)+
             ":" +
@@ -253,7 +253,7 @@ const MainView = new Lang.Class({
     },
 
     _updatePositionCallback: function() {
-        let position = MainWindow.play.queryPosition();
+        var position = MainWindow.play.queryPosition();
 
         if (position >= 0) {
             this.progressScale.set_value(position);
@@ -280,7 +280,7 @@ const MainView = new Lang.Class({
     },
 
     getVolume: function() {
-        let volumeValue = this.playVolume.get_value();
+        var volumeValue = this.playVolume.get_value();
 
         return volumeValue;
     },
@@ -288,8 +288,8 @@ const MainView = new Lang.Class({
     listBoxAdd: function() {
         selectable = true;
         this.groupGrid = groupGrid;
-        let playVolume = Application.application.getSpeakerVolume();
-        let micVolume = Application.application.getMicVolume();
+        var playVolume = Application.application.getSpeakerVolume();
+        var micVolume = Application.application.getMicVolume();
         volumeValue.push({ record: micVolume, play: playVolume });
         activeProfile = Application.application.getPreferences();
 
@@ -326,7 +326,7 @@ const MainView = new Lang.Class({
         this.toolbarStart.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
 
         // finish button (stop recording)
-        let stopRecord = new Gtk.Button({ label: _("Done"),
+        var stopRecord = new Gtk.Button({ label: _("Done"),
                                           halign: Gtk.Align.FILL,
                                           valign: Gtk.Align.CENTER,
                                           hexpand: true,
@@ -360,8 +360,8 @@ const MainView = new Lang.Class({
 
         this.groupGrid.add(this._scrolledWin);
         this._scrolledWin.show();
-        let sounds = list.getItemCount();
-        let title;
+        var sounds = list.getItemCount();
+        var title;
         if (sounds > 0) {
             // Translators: This is the title in the headerbar
             title = Gettext.ngettext("%d Recorded Sound",
@@ -394,7 +394,7 @@ const MainView = new Lang.Class({
             this._files = [];
             this._files = list.getFilesInfoForList();
 
-            for (let i = this._startIdx; i <= this._endIdx; i++) {
+            for (var i = this._startIdx; i <= this._endIdx; i++) {
                 this.rowGrid = new Gtk.Grid({ name: i.toString(),
                                               height_request: 45,
                                               orientation: Gtk.Orientation.VERTICAL,
@@ -418,12 +418,12 @@ const MainView = new Lang.Class({
                 this._playListButton.show();
                 this._playListButton.connect('clicked', Lang.bind(this,
                     function(button){
-                        let row = button.get_parent().get_parent();
+                        var row = button.get_parent().get_parent();
                         this.listBox.select_row(row);
                         play.passSelected(row);
-                        let gridForName = row.get_child();
-                        let idx = parseInt(gridForName.name);
-                        let file = this._files[idx];
+                        var gridForName = row.get_child();
+                        var idx = parseInt(gridForName.name);
+                        var file = this._files[idx];
                         this.onPlayPauseToggled(row, file);
                     }));
 
@@ -439,7 +439,7 @@ const MainView = new Lang.Class({
                 this._pauseListButton.hide();
                 this._pauseListButton.connect('clicked', Lang.bind(this,
                     function(button){
-                        let row = button.get_parent().get_parent();
+                        var row = button.get_parent().get_parent();
                         this.listBox.select_row(row);
                         this.onPause(row);
                     }));
@@ -453,7 +453,7 @@ const MainView = new Lang.Class({
                                                  use_markup: true,
                                                  width_chars: 35,
                                                  xalign: 0 });
-                let markup = ('<b>'+ this._files[i].fileName + '</b>');
+                var markup = ('<b>'+ this._files[i].fileName + '</b>');
                 this._fileName.label = markup;
                 this._fileName.set_no_show_all(true);
                 this.rowGrid.attach(this._fileName, 3, 0, 10, 3);
@@ -520,11 +520,11 @@ const MainView = new Lang.Class({
                 this._info.image = Gtk.Image.new_from_icon_name("dialog-information-symbolic", 
Gtk.IconSize.BUTTON);
                 this._info.connect("clicked", Lang.bind(this,
                     function(button) {
-                        let row = button.get_parent().get_parent();
+                        var row = button.get_parent().get_parent();
                         this.listBox.select_row(row);
-                        let gridForName = row.get_child();
-                        let idx = parseInt(gridForName.name);
-                        let file = this._files[idx];
+                        var gridForName = row.get_child();
+                        var idx = parseInt(gridForName.name);
+                        var file = this._files[idx];
                         this._onInfoButton(file);
                     }));
                 this._info.set_tooltip_text(_("Info"));
@@ -538,7 +538,7 @@ const MainView = new Lang.Class({
                 this._delete.image = Gtk.Image.new_from_icon_name("user-trash-symbolic", 
Gtk.IconSize.BUTTON);
                 this._delete.connect("clicked", Lang.bind(this,
                     function(button) {
-                        let row = button.get_parent().get_parent();
+                        var row = button.get_parent().get_parent();
                         this.listBox.select_row(row);
                         this._deleteFile(row);
                     }));
@@ -593,10 +593,10 @@ const MainView = new Lang.Class({
     hasPreviousSelRow: function() {
        this.destroyLoadMoreButton();
            if (previousSelRow != null) {
-              let rowWidget = previousSelRow.get_child(this.widget);
+              var rowWidget = previousSelRow.get_child(this.widget);
               rowWidget.foreach(Lang.bind(this,
                 function(child) {
-                    let alwaysShow = child.get_no_show_all();
+                    var alwaysShow = child.get_no_show_all();
 
                     if (!alwaysShow)
                         child.hide();
@@ -633,7 +633,7 @@ const MainView = new Lang.Class({
     },
 
     rowGridCallback: function() {
-        let selectedRow = this.listBox.get_selected_row();
+        var selectedRow = this.listBox.get_selected_row();
         this.destroyLoadMoreButton();
 
         if (selectedRow) {
@@ -643,11 +643,11 @@ const MainView = new Lang.Class({
             }
 
             previousSelRow = selectedRow;
-            let selectedRowWidget = previousSelRow.get_child(this.widget);
+            var selectedRowWidget = previousSelRow.get_child(this.widget);
             selectedRowWidget.show_all();
             selectedRowWidget.foreach(Lang.bind(this,
                 function(child) {
-                    let alwaysShow = child.get_no_show_all();
+                    var alwaysShow = child.get_no_show_all();
 
                     if (!alwaysShow)
                         child.sensitive = true;
@@ -664,14 +664,14 @@ const MainView = new Lang.Class({
     },
 
     _getFileFromRow: function(selected) {
-        let fileForAction = null;
-        let rowWidget = selected.get_child(this.fileName);
+        var fileForAction = null;
+        var rowWidget = selected.get_child(this.fileName);
         rowWidget.foreach(Lang.bind(this,
             function(child) {
 
                 if (child.name == "FileNameLabel") {
-                    let name = child.get_text();
-                    let application = Gio.Application.get_default();
+                    var name = child.get_text();
+                    var application = Gio.Application.get_default();
                     fileForAction = application.saveDir.get_child_for_display_name(name);
                 }
              }));
@@ -680,18 +680,18 @@ const MainView = new Lang.Class({
     },
 
     _deleteFile: function(selected) {
-        let fileToDelete = this._getFileFromRow(selected);
+        var fileToDelete = this._getFileFromRow(selected);
         fileToDelete.trash_async(GLib.PRIORITY_DEFAULT, null, null);
     },
 
     loadPlay: function(selected) {
-        let fileToPlay = this._getFileFromRow(selected);
+        var fileToPlay = this._getFileFromRow(selected);
 
         return fileToPlay;
     },
 
     _onInfoButton: function(selected) {
-        let infoDialog = new Info.InfoDialog(selected);
+        var infoDialog = new Info.InfoDialog(selected);
 
         infoDialog.widget.connect('response', Lang.bind(this,
             function(widget, response) {
@@ -713,14 +713,14 @@ const MainView = new Lang.Class({
     },
 
     setNameLabel: function(newName, oldName, index) {
-        let selected = this.listBox.get_row_at_index(index);
-        let rowWidget = selected.get_child(oldName);
+        var selected = this.listBox.get_row_at_index(index);
+        var rowWidget = selected.get_child(oldName);
         rowWidget.foreach(Lang.bind(this,
             function(child) {
 
                 if (child.name == "FileNameLabel") {
-                    let name = child.get_text();
-                    let markup = ('<b>'+ newName + '</b>');
+                    var name = child.get_text();
+                    var markup = ('<b>'+ newName + '</b>');
                     child.label = markup;
                 }
              }));
@@ -728,11 +728,11 @@ const MainView = new Lang.Class({
     },
 
     onPause: function(listRow) {
-        let activeState = play.getPipeStates();
+        var activeState = play.getPipeStates();
 
         if (activeState == PipelineStates.PLAYING) {
             play.pausePlaying();
-            let rowWidget = listRow.get_child(this.widget);
+            var rowWidget = listRow.get_child(this.widget);
             rowWidget.foreach(Lang.bind(this,
                 function(child) {
 
@@ -751,12 +751,12 @@ const MainView = new Lang.Class({
 
     onPlayPauseToggled: function(listRow, selFile) {
         setVisibleID = ActiveArea.PLAY;
-        let activeState = play.getPipeStates();
+        var activeState = play.getPipeStates();
 
         if (activeState != PipelineStates.PLAYING) {
             play.startPlaying();
 
-            let rowWidget = listRow.get_child(this.widget);
+            var rowWidget = listRow.get_child(this.widget);
             rowWidget.foreach(Lang.bind(this,
                 function(child) {
 
@@ -797,7 +797,7 @@ const MainView = new Lang.Class({
     }
 });
 
-const RecordButton = new Lang.Class({
+var RecordButton = new Lang.Class({
     Name: "RecordButton",
     Extends: Gtk.Button,
 
@@ -834,16 +834,16 @@ const RecordButton = new Lang.Class({
     }
 });
 
-const EncoderComboBox = new Lang.Class({
+var EncoderComboBox = new Lang.Class({
     Name: "EncoderComboBox",
     Extends: Gtk.ComboBoxText,
 
     // encoding setting labels in combobox
     _init: function() {
         this.parent();
-        let combo = [_("Ogg Vorbis"), _("Opus"), _("FLAC"), _("MP3"), _("MOV")];
+        var combo = [_("Ogg Vorbis"), _("Opus"), _("FLAC"), _("MP3"), _("MOV")];
 
-        for (let i = 0; i < combo.length; i++)
+        for (var i = 0; i < combo.length; i++)
             this.append_text(combo[i]);
         this.set_property('valign', Gtk.Align.CENTER);
         this.set_sensitive(true);
@@ -858,31 +858,31 @@ const EncoderComboBox = new Lang.Class({
     }
 });
 
-const ChannelsComboBox = new Lang.Class({
+var ChannelsComboBox = new Lang.Class({
     Name: "ChannelsComboBox",
     Extends: Gtk.ComboBoxText,
 
     // channel setting labels in combobox
     _init: function() {
         this.parent();
-        let combo = [_("Mono"), _("Stereo")];
+        var combo = [_("Mono"), _("Stereo")];
 
-        for (let i = 0; i < combo.length; i++)
+        for (var i = 0; i < combo.length; i++)
             this.append_text(combo[i]);
         this.set_property('valign', Gtk.Align.CENTER);
         this.set_sensitive(true);
-        let chanProfile = Application.application.getChannelsPreferences();
+        var chanProfile = Application.application.getChannelsPreferences();
         this.set_active(chanProfile);
         this.connect("changed", Lang.bind(this, this._onChannelComboBoxTextChanged));
     },
 
     _onChannelComboBoxTextChanged: function() {
-        let channelProfile = this.get_active();
+        var channelProfile = this.get_active();
         Application.application.setChannelsPreferences(channelProfile);
     }
 });
 
-const LoadMoreButton = new Lang.Class({
+var LoadMoreButton = new Lang.Class({
     Name: 'LoadMoreButton',
     Extends: Gtk.Button,
 
diff --git a/src/params.js b/src/params.js
index 4074ef9..e8d5663 100644
--- a/src/params.js
+++ b/src/params.js
@@ -24,10 +24,10 @@ var $API_VERSION = [1, 0];
 // Extend a method to allow more params in a subclass
 // The superclass can safely use Params.parse(), it won't see
 // the extensions.
-// const MyClass = new Lang.Class({
+// var MyClass = new Lang.Class({
 //       ...
 //       method: function(params) {
-//           let mine = Params.filter(params, { anInt: 42 });
+//           var mine = Params.filter(params, { anInt: 42 });
 //           this.parent(params);
 //           ... mine.anInt ...
 //       }
@@ -48,7 +48,7 @@ var $API_VERSION = [1, 0];
 // Return value: a new object, containing the merged parameters from
 // @params and @defaults
 function parse(params, defaults) {
-    let ret = {}, prop;
+    var ret = {}, prop;
     params = params || {};
 
     for (prop in params) {
@@ -78,7 +78,7 @@ function parse(params, defaults) {
 // Return value: a new object, containing the merged parameters from
 // @params and @defaults
 function fill(params, defaults) {
-    let ret = {}, prop;
+    var ret = {}, prop;
     params = params || {};
 
     for (prop in params)
@@ -109,7 +109,7 @@ function fill(params, defaults) {
 // Return value: a new object, containing the merged parameters from
 // @params and @defaults
 function filter(params, defaults) {
-    let ret = {}, prop;
+    var ret = {}, prop;
     params = params || {};
 
     for (prop in defaults) {
diff --git a/src/play.js b/src/play.js
index 017042f..ca5af70 100644
--- a/src/play.js
+++ b/src/play.js
@@ -17,42 +17,42 @@
  *
  */
 
-const _ = imports.gettext.gettext;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gst = imports.gi.Gst;
-const GstAudio = imports.gi.GstAudio;
-const GstPbutils = imports.gi.GstPbutils;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
-const Mainloop = imports.mainloop;
-
-const Application = imports.application;
-const MainWindow = imports.mainWindow;
-const Waveform = imports.waveform;
-
-const PipelineStates = {
+var _ = imports.gettext.gettext;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gst = imports.gi.Gst;
+var GstAudio = imports.gi.GstAudio;
+var GstPbutils = imports.gi.GstPbutils;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
+var Mainloop = imports.mainloop;
+
+var Application = imports.application;
+var MainWindow = imports.mainWindow;
+var Waveform = imports.waveform;
+
+var PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
     STOPPED: 2,
     NULL: 3
 };
 
-const ErrState = {
+var ErrState = {
     OFF: 0,
     ON: 1
 }
 
-let errorDialogState;
+var errorDialogState;
 
-const _TENTH_SEC = 100000000;
+var _TENTH_SEC = 100000000;
 
-const Play = new Lang.Class({
+var Play = new Lang.Class({
     Name: "Play",
 
     _playPipeline: function() {
         errorDialogState = ErrState.OFF;
-        let uri = this._fileToPlay.get_uri();
+        var uri = this._fileToPlay.get_uri();
         this.play = Gst.ElementFactory.make("playbin", "play");
         this.play.set_property("uri", uri);
         this.sink = Gst.ElementFactory.make("pulsesink", "sink");
@@ -134,7 +134,7 @@ const Play = new Lang.Class({
 
     _onMessageReceived: function(message) {
         this.localMsg = message;
-        let msg = message.type;
+        var msg = message.type;
         switch(msg) {
 
         case Gst.MessageType.EOS:
@@ -142,12 +142,12 @@ const Play = new Lang.Class({
             break;
 
         case Gst.MessageType.WARNING:
-            let warningMessage = message.parse_warning()[0];
+            var warningMessage = message.parse_warning()[0];
             log(warningMessage.toString());
             break;
 
         case Gst.MessageType.ERROR:
-            let errorMessage = message.parse_error()[0];
+            var errorMessage = message.parse_error()[0];
             this._showErrorDialog(errorMessage.toString());
             errorDialogState = ErrState.ON;
             break;
@@ -178,7 +178,7 @@ const Play = new Lang.Class({
     },
 
     _updateTime: function() {
-        let time = this.play.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
+        var time = this.play.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
         this.trackDuration = this.play.query_duration(Gst.Format.TIME, null)[1];
         this.trackDurationSecs = this.trackDuration/Gst.SECOND;
 
@@ -188,7 +188,7 @@ const Play = new Lang.Class({
             MainWindow.view.setLabel(0);
         }
 
-        let absoluteTime = 0;
+        var absoluteTime = 0;
 
         if  (this.clock == null) {
             this.clock = this.play.get_clock();
@@ -203,7 +203,7 @@ const Play = new Lang.Class({
             this.baseTime = absoluteTime;
 
         this.runTime = absoluteTime- this.baseTime;
-        let approxTime = Math.round(this.runTime/_TENTH_SEC);
+        var approxTime = Math.round(this.runTime/_TENTH_SEC);
 
         if (MainWindow.wave != null) {
             MainWindow.wave._drawEvent(approxTime);
@@ -213,7 +213,7 @@ const Play = new Lang.Class({
     },
 
     queryPosition: function() {
-        let position = 0;
+        var position = 0;
         while (position == 0) {
             position = this.play.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
         }
@@ -239,7 +239,7 @@ const Play = new Lang.Class({
 
     _showErrorDialog: function(errorStrOne, errorStrTwo) {
         if (errorDialogState == ErrState.OFF) {
-            let errorDialog = new Gtk.MessageDialog ({ destroy_with_parent: true,
+            var errorDialog = new Gtk.MessageDialog ({ destroy_with_parent: true,
                                                        buttons: Gtk.ButtonsType.OK,
                                                        message_type: Gtk.MessageType.WARNING });
 
diff --git a/src/preferences.js b/src/preferences.js
index 800902f..e0b56fd 100644
--- a/src/preferences.js
+++ b/src/preferences.js
@@ -17,23 +17,23 @@
 *
 */
 
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
 
-const _ = imports.gettext.gettext;
-const C_ = imports.gettext.pgettext;
+var _ = imports.gettext.gettext;
+var C_ = imports.gettext.pgettext;
 
-const MainWindow = imports.mainWindow;
-const Main = imports.main;
+var MainWindow = imports.mainWindow;
+var Main = imports.main;
 
-let formatComboBoxText = null;
-let channelsComboBoxText = null;
-let recordVolume= null;
-let playVolume = null;
+var formatComboBoxText = null;
+var channelsComboBoxText = null;
+var recordVolume= null;
+var playVolume = null;
 
-const Preferences = new Lang.Class({
+var Preferences = new Lang.Class({
     Name: 'Preferences',
     
      _init: function() {    
@@ -48,7 +48,7 @@ const Preferences = new Lang.Class({
                                         
         this.widget.set_transient_for(Gio.Application.get_default().get_active_window());
         
-        let grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
+        var grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
                                    row_homogeneous: true,
                                    column_homogeneous: true,
                                    halign: Gtk.Align.CENTER,
@@ -58,10 +58,10 @@ const Preferences = new Lang.Class({
                                    margin_end: 24,
                                    margin_start: 24,
                                    margin_top: 12 });
-        let contentArea = this.widget.get_content_area();
+        var contentArea = this.widget.get_content_area();
         contentArea.pack_start(grid, true, true, 2);
         
-        let formatLabel = new Gtk.Label({ label: _("Preferred format"),
+        var formatLabel = new Gtk.Label({ label: _("Preferred format"),
                                           halign: Gtk.Align.END });
         formatLabel.get_style_context().add_class('dim-label');
         grid.attach(formatLabel, 0, 0, 2, 1);
@@ -69,7 +69,7 @@ const Preferences = new Lang.Class({
         formatComboBoxText = new MainWindow.EncoderComboBox();
         grid.attach(formatComboBoxText, 2, 0, 2, 1);
         
-        let channelsLabel = new Gtk.Label({ label: _("Default mode"),
+        var channelsLabel = new Gtk.Label({ label: _("Default mode"),
                                             halign: Gtk.Align.END });
         channelsLabel.get_style_context().add_class('dim-label');
         grid.attach(channelsLabel, 0, 1, 2, 1);
@@ -77,7 +77,7 @@ const Preferences = new Lang.Class({
         channelsComboBoxText = new MainWindow.ChannelsComboBox();
         grid.attach(channelsComboBoxText, 2, 1, 2, 1);
 
-        let volumeLabel = new Gtk.Label({ label: _("Volume"),
+        var volumeLabel = new Gtk.Label({ label: _("Volume"),
                                           halign: Gtk.Align.END });
         volumeLabel.get_style_context().add_class('dim-label');
         grid.attach(volumeLabel, 0, 2, 2, 1);
@@ -92,7 +92,7 @@ const Preferences = new Lang.Class({
             }));
         grid.attach(playVolume, 2, 2, 2, 1);
         
-        let micVolLabel = new Gtk.Label({ label: _("Microphone"),
+        var micVolLabel = new Gtk.Label({ label: _("Microphone"),
                                           halign: Gtk.Align.END });
         micVolLabel.get_style_context().add_class('dim-label');
         grid.attach(micVolLabel, 0, 3, 2, 1);
diff --git a/src/record.js b/src/record.js
index cf86718..e25ddd7 100644
--- a/src/record.js
+++ b/src/record.js
@@ -17,45 +17,45 @@
  *
  */
 
-const _ = imports.gettext.gettext;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gst = imports.gi.Gst;
-const GstAudio = imports.gi.GstAudio;
-const GstPbutils = imports.gi.GstPbutils;
-const Gtk = imports.gi.Gtk;
-const Pango = imports.gi.Pango;
-const Lang = imports.lang;
-const Mainloop = imports.mainloop;
-const Signals = imports.signals;
-
-const Application = imports.application;
-const AudioProfile = imports.audioProfile;
-const MainWindow = imports.mainWindow;
-const Listview = imports.listview;
-
-const PipelineStates = {
+var _ = imports.gettext.gettext;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var GObject = imports.gi.GObject;
+var Gst = imports.gi.Gst;
+var GstAudio = imports.gi.GstAudio;
+var GstPbutils = imports.gi.GstPbutils;
+var Gtk = imports.gi.Gtk;
+var Pango = imports.gi.Pango;
+var Lang = imports.lang;
+var Mainloop = imports.mainloop;
+var Signals = imports.signals;
+
+var Application = imports.application;
+var AudioProfile = imports.audioProfile;
+var MainWindow = imports.mainWindow;
+var Listview = imports.listview;
+
+var PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
     STOPPED: 2
 };
 
-const ErrState = {
+var ErrState = {
     OFF: 0,
     ON: 1
 }
 
-const Channels = {
+var Channels = {
     MONO: 0,
     STEREO: 1
 }
 
-const _TENTH_SEC = 100000000;
+var _TENTH_SEC = 100000000;
 
-let errorDialogState;
+var errorDialogState;
 
-const Record = new Lang.Class({
+var Record = new Lang.Class({
     Name: "Record",
 
     _recordPipeline: function() {
@@ -64,7 +64,7 @@ const Record = new Lang.Class({
         this._view = MainWindow.view;
         this._buildFileName = new BuildFileName();
         this.initialFileName = this._buildFileName.buildInitialFilename();
-        let localDateTime = this._buildFileName.getOrigin();
+        var localDateTime = this._buildFileName.getOrigin();
         this.gstreamerDateTime = Gst.DateTime.new_from_g_date_time(localDateTime);
 
         if (this.initialFileName == -1) {
@@ -77,9 +77,9 @@ const Record = new Lang.Class({
         this.srcElement = Gst.ElementFactory.make("pulsesrc", "srcElement");
 
         if (this.srcElement == null) {
-            let inspect = "gst-inspect-1.0 pulseaudio";
-            let [res, out, err, status] =  GLib.spawn_command_line_sync(inspect);
-            let err_str = String(err)
+            var inspect = "gst-inspect-1.0 pulseaudio";
+            var [res, out, err, status] =  GLib.spawn_command_line_sync(inspect);
+            var err_str = String(err)
             if (err_str.replace(/\W/g, ''))
                 this._showErrorDialog(_("Please install the GStreamer 1.0 PulseAudio plugin."));
             else
@@ -111,7 +111,7 @@ const Record = new Lang.Class({
         this.ebin = Gst.ElementFactory.make("encodebin", "ebin");
         this.ebin.connect("element-added", Lang.bind(this,
             function(ebin, element) {
-                let factory = element.get_factory();
+                var factory = element.get_factory();
 
                 if (factory != null) {
                         this.hasTagSetter = factory.has_interface("GstTagSetter");
@@ -127,8 +127,8 @@ const Record = new Lang.Class({
                 }
             }));
         this.pipeline.add(this.ebin);
-        let ebinProfile = this.ebin.set_property("profile", this._mediaProfile);
-        let srcpad = this.ebin.get_static_pad("src");
+        var ebinProfile = this.ebin.set_property("profile", this._mediaProfile);
+        var srcpad = this.ebin.get_static_pad("src");
         this.filesink = Gst.ElementFactory.make("filesink", "filesink");
         this.filesink.set_property("location", this.initialFileName);
         this.pipeline.add(this.filesink);
@@ -139,11 +139,11 @@ const Record = new Lang.Class({
             this.onEndOfStream();
         }
 
-        let srcLink = this.srcElement.link(this.audioConvert);
-        let audioConvertLink = this.audioConvert.link_filtered(this.level, this.caps);
-        let levelLink = this.level.link(this.volume);
-        let volLink = this.volume.link(this.ebin);
-        let ebinLink = this.ebin.link(this.filesink);
+        var srcLink = this.srcElement.link(this.audioConvert);
+        var audioConvertLink = this.audioConvert.link_filtered(this.level, this.caps);
+        var levelLink = this.level.link(this.volume);
+        var volLink = this.volume.link(this.ebin);
+        var ebinLink = this.ebin.link(this.filesink);
 
         if (!srcLink || !audioConvertLink || !levelLink || !ebinLink) {
             this._showErrorDialog(_("Not all of the elements were linked."));
@@ -156,7 +156,7 @@ const Record = new Lang.Class({
     },
 
     _updateTime: function() {
-        let time = this.pipeline.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
+        var time = this.pipeline.query_position(Gst.Format.TIME, null)[1]/Gst.SECOND;
 
         if (time >= 0) {
             this._view.setLabel(time, 0);
@@ -178,7 +178,7 @@ const Record = new Lang.Class({
         if (!this.pipeline || this.pipeState == PipelineStates.STOPPED )
             this._recordPipeline();
 
-        let ret = this.pipeline.set_state(Gst.State.PLAYING);
+        var ret = this.pipeline.set_state(Gst.State.PLAYING);
         this.pipeState = PipelineStates.PLAYING;
 
         if (ret == Gst.StateChangeReturn.FAILURE) {
@@ -195,7 +195,7 @@ const Record = new Lang.Class({
     },
 
     stopRecording: function() {
-        let sent = this.pipeline.send_event(Gst.Event.new_eos());
+        var sent = this.pipeline.send_event(Gst.Event.new_eos());
 
         if (this.timeout) {
             GLib.source_remove(this.timeout);
@@ -219,19 +219,19 @@ const Record = new Lang.Class({
 
     _onMessageReceived: function(message) {
         this.localMsg = message;
-        let msg = message.type;
+        var msg = message.type;
         switch(msg) {
 
         case Gst.MessageType.ELEMENT:
             if (GstPbutils.is_missing_plugin_message(this.localMsg)) {
-                let errorOne = null;
-                let errorTwo = null;
-                let detail = GstPbutils.missing_plugin_message_get_installer_detail(this.localMsg);
+                var errorOne = null;
+                var errorTwo = null;
+                var 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);
+                var description = GstPbutils.missing_plugin_message_get_description(this.localMsg);
 
                 if (description != null)
                     errorTwo = description;
@@ -241,23 +241,23 @@ const Record = new Lang.Class({
                 break;
             }
 
-            let s = message.get_structure();
+            var s = message.get_structure();
                 if (s) {
                     if (s.has_name("level")) {
-                        let p = null;
-                        let peakVal = 0;
-                        let val = 0;
-                        let st = s.get_value("timestamp");
-                        let dur = s.get_value("duration");
-                        let runTime = s.get_value("running-time");
+                        var p = null;
+                        var peakVal = 0;
+                        var val = 0;
+                        var st = s.get_value("timestamp");
+                        var dur = s.get_value("duration");
+                        var runTime = s.get_value("running-time");
                         peakVal = s.get_value("peak");
 
                         if (peakVal) {
-                            let val = peakVal.get_nth(0);
+                            var val = peakVal.get_nth(0);
 
                             if (val > 0)
                                            val = 0;
-                            let value = Math.pow(10, val/20);
+                            var value = Math.pow(10, val/20);
                             this.peak = value;
 
 
@@ -275,7 +275,7 @@ const Record = new Lang.Class({
                                 this.baseTime = this.absoluteTime;
 
                             this.runTime = this.absoluteTime- this.baseTime;
-                            let approxTime = Math.round(this.runTime/_TENTH_SEC);
+                            var approxTime = Math.round(this.runTime/_TENTH_SEC);
                             MainWindow.wave._drawEvent(approxTime, this.peak);
                             }
                         }
@@ -287,12 +287,12 @@ const Record = new Lang.Class({
             break;
 
         case Gst.MessageType.WARNING:
-            let warningMessage = message.parse_warning()[0];
+            var warningMessage = message.parse_warning()[0];
             log(warningMessage.toString());
             break;
 
         case Gst.MessageType.ERROR:
-            let errorMessage = message.parse_error();
+            var errorMessage = message.parse_error();
             this._showErrorDialog(errorMessage.toString());
             errorDialogState = ErrState.ON;
             break;
@@ -307,8 +307,8 @@ const Record = new Lang.Class({
 
     _getChannels: function() {
 
-        let channels = null;
-        let channelsPref = Application.application.getChannelsPreferences();
+        var channels = null;
+        var channelsPref = Application.application.getChannelsPreferences();
 
         switch(channelsPref) {
         case Channels.MONO:
@@ -328,7 +328,7 @@ const Record = new Lang.Class({
 
     _showErrorDialog: function(errorStrOne, errorStrTwo) {
         if (errorDialogState == ErrState.OFF) {
-            let errorDialog = new Gtk.MessageDialog ({ modal: true,
+            var errorDialog = new Gtk.MessageDialog ({ modal: true,
                                                        destroy_with_parent: true,
                                                        buttons: Gtk.ButtonsType.OK,
                                                        message_type: Gtk.MessageType.WARNING });
@@ -351,7 +351,7 @@ const Record = new Lang.Class({
     }
 });
 
-const BuildFileName = new Lang.Class({
+var BuildFileName = new Lang.Class({
     Name: "BuildFileName",
 
     buildInitialFilename: function() {
diff --git a/src/util.js b/src/util.js
index a398f7e..33a7269 100644
--- a/src/util.js
+++ b/src/util.js
@@ -25,13 +25,13 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-const Gdk = imports.gi.Gdk;
-const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
+var Gdk = imports.gi.Gdk;
+var GLib = imports.gi.GLib;
+var Gtk = imports.gi.Gtk;
 
 function loadStyleSheet() {
-    let file = 'application.css';
-    let provider = new Gtk.CssProvider();
+    var file = 'application.css';
+    var provider = new Gtk.CssProvider();
     provider.load_from_path(GLib.build_filenamev([pkg.pkgdatadir,
                                                   file]));
     Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
diff --git a/src/waveform.js b/src/waveform.js
index 49e3e85..0cf3ace 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -19,40 +19,40 @@
 
 // based on code from Pitivi
 
-const Cairo = imports.cairo;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gst = imports.gi.Gst;
-const GstAudio = imports.gi.GstAudio;
-const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
-const Mainloop = imports.mainloop;
-
-const _ = imports.gettext.gettext;
-const C_ = imports.gettext.pgettext;
-
-const MainWindow = imports.mainWindow;
-const Application = imports.application;
-
-const INTERVAL = 100000000;
-const peaks = [];
-const pauseVal = 10;
-const waveSamples = 40;
-
-const WaveType = {
+var Cairo = imports.cairo;
+var Gio = imports.gi.Gio;
+var GLib = imports.gi.GLib;
+var GObject = imports.gi.GObject;
+var Gst = imports.gi.Gst;
+var GstAudio = imports.gi.GstAudio;
+var Gtk = imports.gi.Gtk;
+var Lang = imports.lang;
+var Mainloop = imports.mainloop;
+
+var _ = imports.gettext.gettext;
+var C_ = imports.gettext.pgettext;
+
+var MainWindow = imports.mainWindow;
+var Application = imports.application;
+
+var INTERVAL = 100000000;
+var peaks = [];
+var pauseVal = 10;
+var waveSamples = 40;
+
+var WaveType = {
     RECORD: 0,
     PLAY: 1
 };
 
-const WaveForm = new Lang.Class({
+var WaveForm = new Lang.Class({
     Name: 'WaveForm',
 
     _init: function(grid, file) {
         this._grid = grid;
 
-        let placeHolder = -100;
-        for (let i = 0; i < 40; i++)
+        var placeHolder = -100;
+        for (var i = 0; i < 40; i++)
             peaks.push(placeHolder);
         if (file) {
             this.waveType = WaveType.PLAY;
@@ -63,9 +63,9 @@ const WaveForm = new Lang.Class({
           this.waveType = WaveType.RECORD;
         }
 
-        let gridWidth = 0;
-        let drawingWidth = 0;
-        let drawingHeight = 0;
+        var gridWidth = 0;
+        var drawingWidth = 0;
+        var drawingHeight = 0;
         this.drawing = Gtk.DrawingArea.new();
         if (this.waveType == WaveType.RECORD) {
             this.drawing.set_property("valign", Gtk.Align.FILL);
@@ -92,8 +92,8 @@ const WaveForm = new Lang.Class({
         this.pipeline =
             Gst.parse_launch("uridecodebin name=decode uri=" + this._uri + " ! audioconvert ! 
audio/x-raw,channels=2 ! level name=level interval=100000000 post-messages=true ! fakesink qos=false");
         this._level = this.pipeline.get_by_name("level");
-        let decode = this.pipeline.get_by_name("decode");
-        let bus = this.pipeline.get_bus();
+        var decode = this.pipeline.get_by_name("decode");
+        var bus = this.pipeline.get_bus();
         bus.add_signal_watch();
         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);
@@ -110,28 +110,28 @@ const WaveForm = new Lang.Class({
     },
 
     _messageCb: function(message) {
-        let msg = message.type;
+        var msg = message.type;
 
         switch(msg) {
         case Gst.MessageType.ELEMENT:
-            let s = message.get_structure();
+            var s = message.get_structure();
 
             if (s) {
 
                 if (s.has_name("level")) {
-                    let peaknumber = 0;
-                    let st = s.get_value("timestamp");
-                    let dur = s.get_value("duration");
-                    let runTime = s.get_value("running-time");
-                    let peakVal = s.get_value("peak");
+                    var peaknumber = 0;
+                    var st = s.get_value("timestamp");
+                    var dur = s.get_value("duration");
+                    var runTime = s.get_value("running-time");
+                    var peakVal = s.get_value("peak");
 
                     if (peakVal) {
-                        let val = peakVal.get_nth(0);
+                        var val = peakVal.get_nth(0);
 
                         if (val > 0)
                             val = 0;
 
-                        let value = Math.pow(10, val/20);
+                        var value = Math.pow(10, val/20);
                         peaks.push(value);
                     }
                 }
@@ -161,7 +161,7 @@ const WaveForm = new Lang.Class({
     },
 
     fillSurface: function(drawing, cr) {
-        let start = 0;
+        var start = 0;
 
         if (this.waveType == WaveType.PLAY) {
 
@@ -175,14 +175,14 @@ const WaveForm = new Lang.Class({
             start = this.recordTime;
         }
 
-        let i = 0;
-        let xAxis = 0;
-        let end = start + 40;
-        let width = this.drawing.get_allocated_width();
-        let waveheight = this.drawing.get_allocated_height();
-        let length = this.nSamples;
-        let pixelsPerSample = width/waveSamples;
-        let gradient = new Cairo.LinearGradient(0, 0, width , waveheight);
+        var i = 0;
+        var xAxis = 0;
+        var end = start + 40;
+        var width = this.drawing.get_allocated_width();
+        var waveheight = this.drawing.get_allocated_height();
+        var length = this.nSamples;
+        var pixelsPerSample = width/waveSamples;
+        var gradient = new Cairo.LinearGradient(0, 0, width , waveheight);
         if (this.waveType == WaveType.PLAY) {
               gradient.addColorStopRGBA(0.75, 0.94, 1.0, 0.94, 0.75);
               gradient.addColorStopRGBA(0.0, 0.94, 1.0, 0.94, 0.22);
@@ -204,7 +204,7 @@ const WaveForm = new Lang.Class({
 
             // Start drawing when we reach the first non-null array member
             if (peaks[i] != null && peaks[i] >= 0) {
-                let idx = i - 1;
+                var idx = i - 1;
 
                 if (start >= 40 && xAxis == 0) {
                      cr.moveTo((xAxis * pixelsPerSample), waveheight);
@@ -224,7 +224,7 @@ const WaveForm = new Lang.Class({
     },
 
     _drawEvent: function(playTime, recPeaks) {
-        let lastTime;
+        var lastTime;
 
         if (this.waveType == WaveType.PLAY) {
             lastTime = this.playTime;


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