[gnome-sound-recorder] source: Fix style using eslint



commit d84b2a3668850faf8a8005e31210cb56ba4acb40
Author: Gaurav Agrawal <agrawalgaurav1999 gmail com>
Date:   Mon Mar 2 23:22:42 2020 +0530

    source: Fix style using eslint

 src/application.js  |  52 +++----
 src/audioProfile.js |  34 ++--
 src/fileUtil.js     |  46 +++---
 src/info.js         | 100 ++++++------
 src/listview.js     | 112 +++++++-------
 src/main.js         |  16 +-
 src/mainWindow.js   | 434 ++++++++++++++++++++++++++--------------------------
 src/play.js         |  70 ++++-----
 src/preferences.js  |  60 ++++----
 src/record.js       | 166 ++++++++++----------
 src/util.js         |   6 +-
 src/waveform.js     | 100 ++++++------
 12 files changed, 594 insertions(+), 602 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 4f496f5..35d4a41 100644
--- a/src/application.js
+++ b/src/application.js
@@ -37,11 +37,11 @@ let settings = null;
 var Application = GObject.registerClass(class Application extends Gtk.Application {
     _init() {
         super._init({ application_id: pkg.name });
-        GLib.set_application_name(_("SoundRecorder"));
-        GLib.set_prgname("gnome-sound-recorder");
+        GLib.set_application_name(_('SoundRecorder'));
+        GLib.set_prgname('gnome-sound-recorder');
 
         this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
-                             "Print version information and exit", null);
+            'Print version information and exit', null);
 
         this.connect('handle-local-options', (app, options) => {
             if (options.contains('version')) {
@@ -80,7 +80,7 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         super.vfunc_startup();
 
         this._loadStyleSheet();
-        log(_("Sound Recorder started"));
+        log(_('Sound Recorder started'));
         Gst.init(null);
         this._initAppMenu();
         application = this;
@@ -90,17 +90,17 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
 
     ensure_directory() {
         /* 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")]);
+        let path = GLib.build_filenamev([GLib.get_home_dir(), _('Recordings')]);
 
         // Ensure Recordings directory
-        GLib.mkdir_with_parents(path, parseInt("0755", 8));
+        GLib.mkdir_with_parents(path, 0o0755);
         this.saveDir = Gio.file_new_for_path(path);
     }
 
     vfunc_activate() {
         (this.window = new MainWindow.MainWindow({ application: this })).show();
         if (pkg.name.endsWith('Devel'))
-            this.window.get_style_context().add_class("devel");
+            this.window.get_style_context().add_class('devel');
     }
 
     onWindowDestroy() {
@@ -122,60 +122,60 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
     }
 
     getPreferences() {
-        let set = settings.get_int("media-type-preset");
+        let set = settings.get_int('media-type-preset');
         return set;
     }
 
     setPreferences(profileName) {
-        settings.set_int("media-type-preset", profileName);
+        settings.set_int('media-type-preset', profileName);
     }
 
     getChannelsPreferences() {
-        let set = settings.get_int("channel");
+        let set = settings.get_int('channel');
         return set;
     }
 
     setChannelsPreferences(channel) {
-        settings.set_int("channel", channel);
+        settings.set_int('channel', channel);
     }
 
     getMicVolume() {
-        let micVolLevel = settings.get_double("mic-volume");
+        let micVolLevel = settings.get_double('mic-volume');
         return micVolLevel;
     }
 
     setMicVolume(level) {
-         settings.set_double("mic-volume", level);
+        settings.set_double('mic-volume', level);
     }
 
     getSpeakerVolume() {
-        let speakerVolLevel = settings.get_double("speaker-volume");
+        let speakerVolLevel = settings.get_double('speaker-volume');
         return speakerVolLevel;
     }
 
     setSpeakerVolume(level) {
-         settings.set_double("speaker-volume", level);
+        settings.set_double('speaker-volume', level);
     }
 
     _loadStyleSheet() {
         let provider = new Gtk.CssProvider();
         provider.load_from_resource('/org/gnome/SoundRecorder/application.css');
         Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
-                                                 provider,
-                                                 Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+            provider,
+            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
     }
 
     _showAbout() {
         let aboutDialog = new Gtk.AboutDialog();
-        aboutDialog.artists = [ 'Reda Lazri <the red shortcut gmail com>',
-                                'Garrett LeSage <garrettl gmail com>',
-                                'Hylke Bons <hylkebons gmail com>',
-                                'Sam Hewitt <hewittsamuel gmail com>' ];
-        aboutDialog.authors = [ 'Meg Ford <megford gnome org>' ];
+        aboutDialog.artists = ['Reda Lazri <the red shortcut gmail com>',
+            'Garrett LeSage <garrettl gmail com>',
+            'Hylke Bons <hylkebons gmail com>',
+            'Sam Hewitt <hewittsamuel gmail com>'];
+        aboutDialog.authors = ['Meg Ford <megford gnome org>'];
         /* Translators: Replace "translator-credits" with your names, one name per line */
-        aboutDialog.translator_credits = _("translator-credits");
-        aboutDialog.program_name = _("Sound Recorder");
-        aboutDialog.copyright = 'Copyright ' + String.fromCharCode(0x00A9) + ' 2013' + 
String.fromCharCode(0x2013) + 'Meg Ford';
+        aboutDialog.translator_credits = _('translator-credits');
+        aboutDialog.program_name = _('Sound Recorder');
+        aboutDialog.copyright = `Copyright ${String.fromCharCode(0x00A9)} 
2013${String.fromCharCode(0x2013)}Meg Ford`;
         aboutDialog.license_type = Gtk.License.GPL_2_0;
         aboutDialog.logo_icon_name = pkg.name;
         aboutDialog.version = pkg.version;
@@ -185,7 +185,7 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         aboutDialog.transient_for = this.window;
 
         aboutDialog.show();
-        aboutDialog.connect('response', function() {
+        aboutDialog.connect('response', () => {
             aboutDialog.destroy();
         });
     }
diff --git a/src/audioProfile.js b/src/audioProfile.js
index 090d976..36fe872 100644
--- a/src/audioProfile.js
+++ b/src/audioProfile.js
@@ -33,34 +33,34 @@ const comboBoxMap = {
     OPUS: 1,
     FLAC: 2,
     MP3: 3,
-    MP4: 4
+    MP4: 4,
 };
 
 var containerProfileMap = {
-    OGG: "application/ogg",
-    ID3: "application/x-id3",
-    MP4: "video/quicktime,variant=(string)iso",
-    AUDIO_OGG: "application/ogg;audio/ogg;video/ogg"
+    OGG: 'application/ogg',
+    ID3: 'application/x-id3',
+    MP4: 'video/quicktime,variant=(string)iso',
+    AUDIO_OGG: 'application/ogg;audio/ogg;video/ogg',
 };
 
 
 var audioCodecMap = {
-    FLAC: "audio/x-flac",
-    MP3: "audio/mpeg,mpegversion=(int)1,layer=(int)3",
-    MP4: "audio/mpeg,mpegversion=(int)4",
-    OPUS: "audio/x-opus",
-    VORBIS: "audio/x-vorbis"
+    FLAC: 'audio/x-flac',
+    MP3: 'audio/mpeg,mpegversion=(int)1,layer=(int)3',
+    MP4: 'audio/mpeg,mpegversion=(int)4',
+    OPUS: 'audio/x-opus',
+    VORBIS: 'audio/x-vorbis',
 };
 
 var AudioProfile = class AudioProfile {
     profile(profileName) {
-        if (profileName) {
+        if (profileName)
             this._profileName = profileName;
-        } else {
+        else
             this._profileName = comboBoxMap.OGG_VORBIS;
-        }
 
-        switch(this._profileName) {
+
+        switch (this._profileName) {
 
         case comboBoxMap.OGG_VORBIS:
             this._values = { container: containerProfileMap.OGG, audio: audioCodecMap.VORBIS };
@@ -92,7 +92,7 @@ var AudioProfile = class AudioProfile {
         this._containerProfile = null;
         if (this._values.audio && this._values.container) {
             let caps = Gst.Caps.from_string(this._values.container);
-            this._containerProfile = GstPbutils.EncodingContainerProfile.new("record", null, caps, null);
+            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);
             this._containerProfile.add_profile(this.encodingProfile);
@@ -117,7 +117,7 @@ var AudioProfile = class AudioProfile {
                 suffixName = this.encodingProfile.get_file_extension();
         }
 
-        this.audioSuffix = ("." + suffixName);
+        this.audioSuffix = `.${suffixName}`;
         return this.audioSuffix;
     }
-}
+};
diff --git a/src/fileUtil.js b/src/fileUtil.js
index c21f1e0..11b88f3 100644
--- a/src/fileUtil.js
+++ b/src/fileUtil.js
@@ -49,11 +49,11 @@ var OffsetController = class OffsetController {
 
     getEndIdx() {
         totItems = MainWindow.list.getItemCount();
-        if (CurrentEndIdx < totItems) {
-            this.endIdx = CurrentEndIdx -1;
-        } else {
+        if (CurrentEndIdx < totItems)
+            this.endIdx = CurrentEndIdx - 1;
+        else
             this.endIdx = totItems - 1;
-        }
+
 
         return this.endIdx;
     }
@@ -65,11 +65,11 @@ var OffsetController = class OffsetController {
     getcidx() {
         return CurrentEndIdx;
     }
-}
+};
 
 var DisplayTime = class DisplayTime {
     getDisplayTime(mtime) {
-        let text = "";
+        let text = '';
         let DAY = 86400000000;
         let now = GLib.DateTime.new_now_local();
         let difference = now.difference(mtime);
@@ -81,30 +81,30 @@ var DisplayTime = class DisplayTime {
         if (difference < DAY) {
             text = mtime.format('%X');
         } else if (difference < 2 * DAY) {
-            text = _("Yesterday");
+            text = _('Yesterday');
         } else if (difference < 7 * DAY) {
-            text = Gettext.ngettext("%d day ago",
-                                    "%d days ago",
-                                     days).format(days);
+            text = Gettext.ngettext('%d day ago',
+                '%d days ago',
+                days).format(days);
         } else if (difference < 14 * DAY) {
-            text = _("Last week");
+            text = _('Last week');
         } else if (difference < 28 * DAY) {
-            text = Gettext.ngettext("%d week ago",
-                                     "%d weeks ago",
-                                     weeks).format(weeks);
+            text = Gettext.ngettext('%d week ago',
+                '%d weeks ago',
+                weeks).format(weeks);
         } else if (difference < 60 * DAY) {
-            text = _("Last month");
+            text = _('Last month');
         } else if (difference < 360 * DAY) {
-            text = Gettext.ngettext("%d month ago",
-                                     "%d months ago",
-                                     months).format(months);
+            text = Gettext.ngettext('%d month ago',
+                '%d months ago',
+                months).format(months);
         } else if (difference < 730 * DAY) {
-            text = _("Last year");
+            text = _('Last year');
         } else {
-            text = Gettext.ngettext("%d year ago",
-                                    "%d years ago",
-                                    years).format(years);
+            text = Gettext.ngettext('%d year ago',
+                '%d years ago',
+                years).format(years);
         }
         return text;
     }
-}
+};
diff --git a/src/info.js b/src/info.js
index 4dc867e..7d87a45 100644
--- a/src/info.js
+++ b/src/info.js
@@ -34,23 +34,23 @@ var InfoDialog = class InfoDialog {
 
         this._file = Gio.File.new_for_uri(fileNav.uri);
 
-        this.widget = new Gtk.Dialog ({ resizable: false,
-                                        modal: true,
-                                        destroy_with_parent: true,
-                                        default_width: 400 });
+        this.widget = new Gtk.Dialog({ resizable: false,
+            modal: true,
+            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") });
+        let header = new Gtk.HeaderBar({ title: _('Info') });
         header.set_show_close_button(false);
         this.widget.set_titlebar(header);
 
 
-        let cancelButton = new Gtk.Button({ label: _("Cancel") });
-        cancelButton.connect("clicked", () => this.onCancelClicked());
+        let cancelButton = new Gtk.Button({ label: _('Cancel') });
+        cancelButton.connect('clicked', () => this.onCancelClicked());
 
         header.pack_start(cancelButton);
 
-        let doneButton = new Gtk.Button({ label: _("Done") });
-        doneButton.connect("clicked", () => this.onDoneClicked());
+        let doneButton = new Gtk.Button({ label: _('Done') });
+        doneButton.connect('clicked', () => this.onDoneClicked());
 
         header.pack_end(doneButton);
 
@@ -59,16 +59,16 @@ var InfoDialog = class InfoDialog {
         headerBarSizeGroup.add_widget(cancelButton);
         headerBarSizeGroup.add_widget(doneButton);
 
-        let grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
-                                   row_homogeneous: true,
-                                   column_homogeneous: true,
-                                   halign: Gtk.Align.CENTER,
-                                   row_spacing: 6,
-                                   column_spacing: 12,
-                                   margin_bottom: 18,
-                                   margin_end: 18,
-                                   margin_start: 18,
-                                   margin_top: 18 });
+        let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
+            row_homogeneous: true,
+            column_homogeneous: true,
+            halign: Gtk.Align.CENTER,
+            row_spacing: 6,
+            column_spacing: 12,
+            margin_bottom: 18,
+            margin_end: 18,
+            margin_start: 18,
+            margin_top: 18 });
 
         let contentArea = this.widget.get_content_area();
         contentArea.pack_start(grid, true, true, 2);
@@ -76,51 +76,51 @@ var InfoDialog = class InfoDialog {
         // File Name item
         // Translators: "File Name" is the label next to the file name
         // in the info dialog
-        this._name = new Gtk.Label({ label: C_("File Name", "Name"),
-                                     halign: Gtk.Align.END });
-        this._name.get_style_context ().add_class('dim-label');
+        this._name = new Gtk.Label({ label: C_('File Name', 'Name'),
+            halign: Gtk.Align.END });
+        this._name.get_style_context().add_class('dim-label');
         grid.add(this._name);
 
 
         // Source item
-        this._source = new Gtk.Label({ label: _("Source"),
-                                       halign: Gtk.Align.END });
-        this._source.get_style_context ().add_class('dim-label');
+        this._source = new Gtk.Label({ label: _('Source'),
+            halign: Gtk.Align.END });
+        this._source.get_style_context().add_class('dim-label');
 
-        if (fileName.appName != null) {
+        if (fileName.appName != null)
             grid.add(this._source);
-        }
+
 
         // Date Modified item
-        this._dateModifiedLabel = new Gtk.Label({ label: _("Date Modified"),
-                                                  halign: Gtk.Align.END });
-        this._dateModifiedLabel.get_style_context ().add_class('dim-label');
+        this._dateModifiedLabel = new Gtk.Label({ label: _('Date Modified'),
+            halign: Gtk.Align.END });
+        this._dateModifiedLabel.get_style_context().add_class('dim-label');
         grid.add(this._dateModifiedLabel);
 
         // Date Created item
-        this._dateCreatedLabel = new Gtk.Label({ label: _("Date Created"),
-                                                 halign: Gtk.Align.END });
-        this._dateCreatedLabel.get_style_context ().add_class('dim-label');
+        this._dateCreatedLabel = new Gtk.Label({ label: _('Date Created'),
+            halign: Gtk.Align.END });
+        this._dateCreatedLabel.get_style_context().add_class('dim-label');
 
-        if (fileName.dateCreated != null) {
+        if (fileName.dateCreated != null)
             grid.add(this._dateCreatedLabel);
-        }
+
 
         // Media type item
         // Translators: "Type" is the label next to the media type
         // (Ogg Vorbis, AAC, ...) in the info dialog
-        this._mediaType = new Gtk.Label({ label: C_("Media Type", "Type"),
-                                          halign: Gtk.Align.END });
-        this._mediaType.get_style_context ().add_class('dim-label');
+        this._mediaType = new Gtk.Label({ label: C_('Media Type', 'Type'),
+            halign: Gtk.Align.END });
+        this._mediaType.get_style_context().add_class('dim-label');
         grid.add(this._mediaType);
 
         // File name value
         this._fileNameEntry = new Gtk.Entry({ activates_default: true,
-                                              text: fileName.fileName,
-                                              editable: true,
-                                              hexpand: true,
-                                              width_chars: 40,
-                                              halign: Gtk.Align.START });
+            text: fileName.fileName,
+            editable: true,
+            hexpand: true,
+            width_chars: 40,
+            halign: Gtk.Align.START });
         grid.attach_next_to(this._fileNameEntry, this._name, Gtk.PositionType.RIGHT, 2, 1);
 
         // Source value
@@ -128,28 +128,28 @@ var InfoDialog = class InfoDialog {
         let sourcePath = sourceLink.get_path();
 
         this._sourceData = new Gtk.LinkButton({ label: sourcePath,
-                                                uri: sourceLink.get_uri(),
-                                                halign: Gtk.Align.START });
+            uri: sourceLink.get_uri(),
+            halign: Gtk.Align.START });
         if (fileName.appName != null)
             grid.attach_next_to(this._sourceData, this._source, Gtk.PositionType.RIGHT, 2, 1);
 
         // Date Modified value
         if (fileName.dateModified != null) {
             this._dateModifiedData = new Gtk.Label({ label: fileName.dateModified,
-                                                     halign: Gtk.Align.START });
+                halign: Gtk.Align.START });
             grid.attach_next_to(this._dateModifiedData, this._dateModifiedLabel, Gtk.PositionType.RIGHT, 2, 
1);
         }
 
         // Date Created value
         if (fileName.dateCreated) {
             this._dateCreatedData = new Gtk.Label({ label: fileName.dateCreated,
-                                                    halign: Gtk.Align.START });
+                halign: Gtk.Align.START });
             grid.attach_next_to(this._dateCreatedData, this._dateCreatedLabel, Gtk.PositionType.RIGHT, 2, 1);
         }
 
         // Media type data
-        this._mediaTypeData = new Gtk.Label({ label: fileName.mediaType || _("Unknown"),
-                                              halign: Gtk.Align.START });
+        this._mediaTypeData = new Gtk.Label({ label: fileName.mediaType || _('Unknown'),
+            halign: Gtk.Align.START });
         grid.attach_next_to(this._mediaTypeData, this._mediaType, Gtk.PositionType.RIGHT, 2, 1);
 
         this.widget.show_all();
@@ -164,4 +164,4 @@ var InfoDialog = class InfoDialog {
     onCancelClicked() {
         this.widget.destroy();
     }
-}
+};
diff --git a/src/listview.js b/src/listview.js
index 05d32f2..b74899c 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -33,25 +33,25 @@ const Record = imports.record;
 
 const EnumeratorState = {
     ACTIVE: 0,
-    CLOSED: 1
+    CLOSED: 1,
 };
 
 const mediaTypeMap = {
-    FLAC: "FLAC",
-    OGG_VORBIS: "Ogg Vorbis",
-    OPUS: "Opus",
-    MP3: "MP3",
-    MP4: "MP4"
+    FLAC: 'FLAC',
+    OGG_VORBIS: 'Ogg Vorbis',
+    OPUS: 'Opus',
+    MP3: 'MP3',
+    MP4: 'MP4',
 };
 
 const ListType = {
     NEW: 0,
-    REFRESH: 1
+    REFRESH: 1,
 };
 
 const CurrentlyEnumerating = {
     TRUE: 0,
-    FALSE: 1
+    FALSE: 1,
 };
 
 let allFilesInfo = null;
@@ -78,32 +78,32 @@ var Listview = class Listview {
 
     enumerateDirectory() {
         this._saveDir.enumerate_children_async('standard::display-name,time::created,time::modified',
-                                     Gio.FileQueryInfoFlags.NONE,
-                                     GLib.PRIORITY_LOW,
-                                     null,
-                                     (obj, res) => this._onEnumerator(obj, res));
+            Gio.FileQueryInfoFlags.NONE,
+            GLib.PRIORITY_LOW,
+            null,
+            (obj, res) => this._onEnumerator(obj, res));
     }
 
     _onEnumerator(obj, res) {
         this._enumerator = obj.enumerate_children_finish(res);
 
         if (this._enumerator == null)
-            log("The contents of the Recordings directory were not indexed.");
+            log('The contents of the Recordings directory were not indexed.');
         else
             this._onNextFileComplete();
     }
 
-    _onNextFileComplete () {
+    _onNextFileComplete() {
         fileInfo = [];
-        try{
+        try {
             this._enumerator.next_files_async(20, GLib.PRIORITY_DEFAULT, null, (obj, res) => {
                 let files = obj.next_files_finish(res);
 
                 if (files.length) {
-                    files.forEach((file) => {
-                        let returnedName = file.get_attribute_as_string("standard::display-name");
+                    files.forEach(file => {
+                        let returnedName = file.get_attribute_as_string('standard::display-name');
                         try {
-                            let returnedNumber = parseInt(returnedName.split(" ")[1]);
+                            let returnedNumber = parseInt(returnedName.split(' ')[1]);
                             if (returnedNumber > trackNumber)
                                 trackNumber = returnedNumber;
 
@@ -111,11 +111,11 @@ var Listview = class Listview {
                             if (!e instanceof TypeError)
                                 throw e;
 
-                            log("Tracknumber not returned");
+                            log('Tracknumber not returned');
                             // Don't handle the error
                         }
                         let finalFileName = GLib.build_filenamev([this._saveDir.get_path(),
-                                                                  returnedName]);
+                            returnedName]);
                         let fileUri = GLib.filename_to_uri(finalFileName, null);
                         let timeVal = file.get_modification_date_time();
                         let timeModified = file.get_attribute_uint64("time::modified");
@@ -123,7 +123,7 @@ var Listview = class Listview {
                         let dateModifiedSortString = date.format("%Y%m%d%H%M%S");
                         let dateTime = GLib.DateTime.new_from_unix_local(timeModified);
                         let dateModifiedDisplayString = MainWindow.displayTime.getDisplayTime(dateTime);
-                        let dateCreatedYes = file.has_attribute("time::created");
+                        let dateCreatedYes = file.has_attribute('time::created');
                         let dateCreatedString = null;
                         if (this.dateCreatedYes) {
                             let dateCreatedVal = file.get_attribute_uint64("time::created");
@@ -133,14 +133,14 @@ var Listview = class Listview {
 
                         fileInfo =
                             fileInfo.concat({ appName: null,
-                                              dateCreated: dateCreatedString,
-                                              dateForSort: dateModifiedSortString,
-                                              dateModified: dateModifiedDisplayString,
-                                              duration: null,
-                                              fileName: returnedName,
-                                              mediaType: null,
-                                              title: null,
-                                              uri: fileUri });
+                                dateCreated: dateCreatedString,
+                                dateForSort: dateModifiedSortString,
+                                dateModified: dateModifiedDisplayString,
+                                duration: null,
+                                fileName: returnedName,
+                                mediaType: null,
+                                title: null,
+                                uri: fileUri });
                     });
                     this._sortItems(fileInfo);
                 } else {
@@ -148,7 +148,7 @@ var Listview = class Listview {
                     this._enumerator.close(null);
 
                     if (MainWindow.offsetController.getEndIdx() == -1) {
-                         if (listType == ListType.NEW) {
+                        if (listType == ListType.NEW) {
                             MainWindow.view.listBoxAdd();
                             MainWindow.view.scrolledWinAdd();
                         } else if (listType == ListType.REFRESH) {
@@ -158,23 +158,23 @@ var Listview = class Listview {
                     } else {
                         this._setDiscover();
                     }
-                    return;
-               }
+
+                }
             });
-        } catch(e) {
+        } catch (e) {
             log(e);
         }
     }
 
     _sortItems(fileArr) {
         allFilesInfo = allFilesInfo.concat(fileArr);
-        allFilesInfo.sort(function(a, b) {
+        allFilesInfo.sort((a, b) => {
             return b.dateForSort - a.dateForSort;
         });
 
-        if (stopVal == EnumeratorState.ACTIVE) {
+        if (stopVal == EnumeratorState.ACTIVE)
             this._onNextFileComplete();
-        }
+
     }
 
     getItemCount() {
@@ -195,7 +195,7 @@ var Listview = class Listview {
         this._runDiscover();
     }
 
-     _runDiscover() {
+    _runDiscover() {
         this._discoverer.connect('discovered', (_discoverer, info, error) => {
             let result = info.get_result();
             this._onDiscovererFinished(result, info, error);
@@ -206,7 +206,7 @@ var Listview = class Listview {
         this.result = res;
         if (this.result == GstPbutils.DiscovererResult.OK && allFilesInfo[this.idx]) {
             this.tagInfo = info.get_tags();
-            let appString = "";
+            let 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();
@@ -217,20 +217,20 @@ var Listview = class Listview {
             if (dateTimeTag != null) {
                 let dateTimeCreatedString = dateTimeTag.to_g_date_time();
 
-                if (dateTimeCreatedString) {
+                if (dateTimeCreatedString)
                     allFilesInfo[this.idx].dateCreated = 
MainWindow.displayTime.getDisplayTime(dateTimeCreatedString);
-                }
+
             }
 
-            if (appString == GLib.get_application_name()) {
+            if (appString == GLib.get_application_name())
                 allFilesInfo[this.idx].appName = appString;
-            }
+
 
             this._getCapsForList(info);
         } else {
             // don't index files we can't play
             allFilesInfo.splice(this.idx, 1);
-            log("File cannot be played");
+            log('File cannot be played');
         }
 
         if (this.idx == this.endIdx) {
@@ -243,7 +243,7 @@ var Listview = class Listview {
                 MainWindow.view.scrolledWinDelete();
                 currentlyEnumerating = CurrentlyEnumerating.FALSE;
             }
-            //return false;
+            // return false;
         }
         this.idx++;
     }
@@ -261,9 +261,9 @@ var Listview = class Listview {
             Gio.Application.get_default().ensure_directory();
             this._saveDir = Gio.Application.get_default().saveDir;
         }
-        if ((eventType == Gio.FileMonitorEvent.MOVED_OUT) ||
-            (eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT
-                && MainWindow.recordPipeline == MainWindow.RecordPipelineStates.STOPPED) || (eventType == 
Gio.FileMonitorEvent.RENAMED)) {
+        if (eventType == Gio.FileMonitorEvent.MOVED_OUT ||
+            eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT &&
+                MainWindow.recordPipeline == MainWindow.RecordPipelineStates.STOPPED || eventType == 
Gio.FileMonitorEvent.RENAMED) {
             stopVal = EnumeratorState.ACTIVE;
             allFilesInfo.length = 0;
             fileInfo.length = 0;
@@ -274,9 +274,7 @@ var Listview = class Listview {
                 currentlyEnumerating = CurrentlyEnumerating.TRUE;
                 MainWindow.view.listBoxRefresh();
             }
-        }
-
-        else if (eventType == Gio.FileMonitorEvent.CREATED) {
+        } else if (eventType == Gio.FileMonitorEvent.CREATED) {
             startRecording = true;
         }
     }
@@ -287,8 +285,8 @@ var Listview = class Listview {
             Gio.Application.get_default().ensure_directory();
             this._saveDir = Gio.Application.get_default().saveDir;
         }
-        if ((eventType == Gio.FileMonitorEvent.DELETED) ||
-            (eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT && MainWindow.recordPipeline == 
MainWindow.RecordPipelineStates.STOPPED)) {
+        if (eventType == Gio.FileMonitorEvent.DELETED ||
+            eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT && MainWindow.recordPipeline == 
MainWindow.RecordPipelineStates.STOPPED) {
             stopVal = EnumeratorState.ACTIVE;
             allFilesInfo.length = 0;
             fileInfo.length = 0;
@@ -299,9 +297,7 @@ var Listview = class Listview {
                 currentlyEnumerating = CurrentlyEnumerating.TRUE;
                 MainWindow.view.listBoxRefresh();
             }
-        }
-
-        else if (eventType == Gio.FileMonitorEvent.CREATED) {
+        } else if (eventType == Gio.FileMonitorEvent.CREATED) {
             startRecording = true;
         }
     }
@@ -337,8 +333,8 @@ var Listview = class Listview {
         }
 
         if (allFilesInfo[this.idx].mediaType == null) {
-                // Remove the file from the array if we don't recognize it
-                allFilesInfo.splice(this.idx, 1);
+            // Remove the file from the array if we don't recognize it
+            allFilesInfo.splice(this.idx, 1);
         }
     }
 
@@ -350,4 +346,4 @@ var Listview = class Listview {
     getFilesInfoForList() {
         return allFilesInfo;
     }
-}
+};
diff --git a/src/main.js b/src/main.js
index 80e4f2a..a196735 100644
--- a/src/main.js
+++ b/src/main.js
@@ -28,16 +28,16 @@
 pkg.initGettext();
 pkg.initFormat();
 pkg.require({ 'Gdk': '3.0',
-              'GdkPixbuf': '2.0',
-              'GLib': '2.0',
-              'GObject': '2.0',
-              'Gtk': '3.0',
-              'Gst': '1.0',
-              'GstAudio': '1.0',
-              'GstPbutils': '1.0' });
+    'GdkPixbuf': '2.0',
+    'GLib': '2.0',
+    'GObject': '2.0',
+    'Gtk': '3.0',
+    'Gst': '1.0',
+    'GstAudio': '1.0',
+    'GstPbutils': '1.0' });
 
 const Application = imports.application;
 
 function main(argv) {
-    return (new Application.Application()).run(argv);
+    return new Application.Application().run(argv);
 }
diff --git a/src/mainWindow.js b/src/mainWindow.js
index b517c15..f917276 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -65,34 +65,34 @@ var wave = null;
 
 var ActiveArea = {
     RECORD: 0,
-    PLAY: 1
+    PLAY: 1,
 };
 
 const ListColumns = {
     NAME: 0,
-    MENU: 1
+    MENU: 1,
 };
 
 const PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
-    STOPPED: 2
+    STOPPED: 2,
 };
 
 var RecordPipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
-    STOPPED: 2
+    STOPPED: 2,
 };
 
 const _TIME_DIVISOR = 60;
 var _SEC_TIMEOUT = 100;
 
 var MainWindow = GObject.registerClass(class MainWindow extends Gtk.ApplicationWindow {
-     _init(params) {
+    _init(params) {
         audioProfile = new AudioProfile.AudioProfile();
-        offsetController = new FileUtil.OffsetController;
-        displayTime = new FileUtil.DisplayTime;
+        offsetController = new FileUtil.OffsetController();
+        displayTime = new FileUtil.DisplayTime();
         view = new MainView();
         play = new Play.Play();
 
@@ -104,15 +104,15 @@ var MainWindow = GObject.registerClass(class MainWindow extends Gtk.ApplicationW
             width_request: 640,
             hexpand: true,
             vexpand: true,
-            icon_name: pkg.name
+            icon_name: pkg.name,
         }, params));
 
         header = new Gtk.HeaderBar({ hexpand: true,
-                                     show_close_button: true });
+            show_close_button: true });
         this.set_titlebar(header);
         header.get_style_context().add_class('titlebar');
 
-        recordButton = new RecordButton({ label: _("Record") });
+        recordButton = new RecordButton({ label: _('Record') });
         recordButton.get_style_context().add_class('suggested-action');
         header.pack_start(recordButton);
 
@@ -124,12 +124,12 @@ var MainWindow = GObject.registerClass(class MainWindow extends Gtk.ApplicationW
 
     _addAppMenu() {
         let menu = new Gio.Menu();
-        menu.append(_("Preferences"), 'app.preferences');
-        menu.append(_("About Sound Recorder"), 'app.about');
+        menu.append(_('Preferences'), 'app.preferences');
+        menu.append(_('About Sound Recorder'), 'app.about');
 
         appMenuButton = new Gtk.MenuButton({
-          image: new Gtk.Image({ icon_name: 'open-menu-symbolic' }),
-          menu_model: menu
+            image: new Gtk.Image({ icon_name: 'open-menu-symbolic' }),
+            menu_model: menu,
         });
         header.pack_end(appMenuButton);
     }
@@ -141,7 +141,7 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
             vexpand: true,
             transition_type: Gtk.StackTransitionType.CROSSFADE,
             transition_duration: 100,
-            visible: true
+            visible: true,
         }, params));
 
         this._addListviewPage('listviewPage');
@@ -150,26 +150,26 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
 
     _addEmptyPage() {
         this.emptyGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
-                                        hexpand: true,
-                                        vexpand: true,
-                                        halign: Gtk.Align.CENTER,
-                                        valign: Gtk.Align.CENTER });
+            hexpand: true,
+            vexpand: true,
+            halign: Gtk.Align.CENTER,
+            valign: Gtk.Align.CENTER });
         this._scrolledWin.add(this.emptyGrid);
 
         let emptyPageImage = new Gtk.Image({ icon_name: 'audio-input-microphone-symbolic',
-                                             icon_size: Gtk.IconSize.DIALOG });
+            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"),
-                                             halign: Gtk.Align.CENTER,
-                                             valign: Gtk.Align.CENTER });
+        let 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"),
-                                                  use_markup: true,
-                                                  max_width_chars: 30,
-                                                  halign: Gtk.Align.CENTER,
-                                                  valign: Gtk.Align.CENTER });
+        let 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,
+            valign: Gtk.Align.CENTER });
         emptyPageDirections.get_style_context().add_class('dim-label');
         this.emptyGrid.add(emptyPageDirections);
         this.emptyGrid.show_all();
@@ -182,9 +182,9 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this._record = new Record.Record(audioProfile);
 
         groupGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
-                                   hexpand: true,
-                                   vexpand: true });
-        this.add_titled(groupGrid, name, "View");
+            hexpand: true,
+            vexpand: true });
+        this.add_titled(groupGrid, name, 'View');
     }
 
     onPlayStopClicked() {
@@ -192,24 +192,22 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
             play.stopPlaying();
             let listRow = this.listBox.get_selected_row();
             let rowGrid = listRow.get_child();
-            rowGrid.foreach((child) => {
-                if (child.name == "PauseButton") {
+            rowGrid.foreach(child => {
+                if (child.name == 'PauseButton') {
                     child.hide();
                     child.sensitive = false;
-                }
-                else if (child.name == "PlayLabelBox") {
+                } else if (child.name == 'PlayLabelBox') {
                     child.show();
-                    child.foreach((grandchild) => {
-                        if (grandchild.name == "PlayTimeLabel") {
+                    child.foreach(grandchild => {
+                        if (grandchild.name == 'PlayTimeLabel')
                             grandchild.hide();
-                        }
 
-                        if (grandchild.name == "DividerLabel") {
+
+                        if (grandchild.name == 'DividerLabel')
                             grandchild.hide();
-                        }
+
                     });
-                }
-                else {
+                } else {
                     child.show();
                     child.sensitive = true;
                 }
@@ -230,20 +228,20 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.unformattedTime = unformattedTime;
         let seconds = Math.floor(this.unformattedTime);
         let hours = parseInt(seconds / Math.pow(_TIME_DIVISOR, 2));
-        let hoursString = ""
+        let hoursString = '';
 
         if (hours > 10)
-            hoursString = hours + ":"
+            hoursString = `${hours}:`;
         else if (hours < 10 && hours > 0)
-            hoursString = "0" + hours + ":"
+            hoursString = `0${hours}:`;
 
         let minuteString = parseInt(seconds / _TIME_DIVISOR) % _TIME_DIVISOR;
         let secondString = parseInt(seconds % _TIME_DIVISOR);
         let timeString =
-            hoursString +
-            (minuteString < 10 ? "0" + minuteString : minuteString)+
-            ":" +
-            (secondString < 10 ? "0" + secondString : secondString);
+            `${hoursString +
+            (minuteString < 10 ? `0${minuteString}` : minuteString)
+            }:${
+                secondString < 10 ? `0${secondString}` : secondString}`;
 
         return timeString;
     }
@@ -251,9 +249,9 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
     _updatePositionCallback() {
         let position = MainWindow.play.queryPosition();
 
-        if (position >= 0) {
+        if (position >= 0)
             this.progressScale.set_value(position);
-        }
+
         return true;
     }
 
@@ -268,11 +266,11 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
     }
 
     setVolume() {
-        if (setVisibleID == ActiveArea.PLAY) {
+        if (setVisibleID == ActiveArea.PLAY)
             play.setVolume(volumeValue[0].play);
-        } else if (setVisibleID == ActiveArea.RECORD) {
-           this._record.setVolume(volumeValue[0].record);
-        }
+        else if (setVisibleID == ActiveArea.RECORD)
+            this._record.setVolume(volumeValue[0].record);
+
     }
 
     getVolume() {
@@ -289,15 +287,15 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         volumeValue.push({ record: micVolume, play: playVolume });
         activeProfile = Application.application.getPreferences();
 
-        this.recordGrid = new Gtk.Grid({ name: "recordGrid",
-                                         orientation: Gtk.Orientation.HORIZONTAL });
+        this.recordGrid = new Gtk.Grid({ name: 'recordGrid',
+            orientation: Gtk.Orientation.HORIZONTAL });
         this.groupGrid.add(this.recordGrid);
 
         this.widgetRecord = new Gtk.Toolbar({ show_arrow: false,
-                                              halign: Gtk.Align.END,
-                                              valign: Gtk.Align.FILL,
-                                              icon_size: Gtk.IconSize.BUTTON,
-                                              opacity: 1 });
+            halign: Gtk.Align.END,
+            valign: Gtk.Align.FILL,
+            icon_size: Gtk.IconSize.BUTTON,
+            opacity: 1 });
         this.recordGrid.attach(this.widgetRecord, 0, 0, 2, 2);
 
         this._boxRecord = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
@@ -305,16 +303,16 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.widgetRecord.insert(this._groupRecord, -1);
 
         this.recordTextLabel = new Gtk.Label({ margin_bottom: 4,
-                                               margin_end: 6,
-                                               margin_start: 6,
-                                               margin_top: 6 });
-        this.recordTextLabel.label = _("Recording…");
+            margin_end: 6,
+            margin_start: 6,
+            margin_top: 6 });
+        this.recordTextLabel.label = _('Recording…');
         this._boxRecord.pack_start(this.recordTextLabel, false, true, 0);
 
         this.recordTimeLabel = new Gtk.Label({ margin_bottom: 4,
-                                               margin_end: 6,
-                                               margin_start: 6,
-                                               margin_top: 6});
+            margin_end: 6,
+            margin_start: 6,
+            margin_top: 6 });
 
         this._boxRecord.pack_start(this.recordTimeLabel, false, true, 0);
 
@@ -322,16 +320,16 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.toolbarStart.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
 
         // finish button (stop recording)
-        let stopRecord = new Gtk.Button({ label: _("Done"),
-                                          halign: Gtk.Align.FILL,
-                                          valign: Gtk.Align.CENTER,
-                                          hexpand: true,
-                                          margin_bottom: 4,
-                                          margin_end: 6,
-                                          margin_start: 6,
-                                          margin_top: 6 });
+        let stopRecord = new Gtk.Button({ label: _('Done'),
+            halign: Gtk.Align.FILL,
+            valign: Gtk.Align.CENTER,
+            hexpand: true,
+            margin_bottom: 4,
+            margin_end: 6,
+            margin_start: 6,
+            margin_top: 6 });
         stopRecord.get_style_context().add_class('text-button');
-        stopRecord.connect("clicked", () => this.onRecordStopClicked());
+        stopRecord.connect('clicked', () => this.onRecordStopClicked());
         this.toolbarStart.pack_start(stopRecord, true, true, 0);
         this.recordGrid.attach(this.toolbarStart, 5, 1, 2, 2);
     }
@@ -341,16 +339,16 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this._scrolledWin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
         this.scrollbar = this._scrolledWin.get_vadjustment();
 
-        this.scrollbar.connect("value_changed", () => {
-                this.currentBound = this.scrollbar.get_value();
-                UpperBoundVal = this.scrollbar.upper - this.scrollbar.page_size;
-                if (UpperBoundVal == this.currentBound && loadMoreButton == null) {
-                    this.addLoadMoreButton();
-                } else if (UpperBoundVal != this.currentBound && loadMoreButton) {
-                    loadMoreButton.destroy();
-                    loadMoreButton = null;
-                }
-            });
+        this.scrollbar.connect('value_changed', () => {
+            this.currentBound = this.scrollbar.get_value();
+            UpperBoundVal = this.scrollbar.upper - this.scrollbar.page_size;
+            if (UpperBoundVal == this.currentBound && loadMoreButton == null) {
+                this.addLoadMoreButton();
+            } else if (UpperBoundVal != this.currentBound && loadMoreButton) {
+                loadMoreButton.destroy();
+                loadMoreButton = null;
+            }
+        });
 
         this.groupGrid.add(this._scrolledWin);
         this._scrolledWin.show();
@@ -369,8 +367,8 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
             this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
             this.listBox.set_header_func(null);
             this.listBox.set_activate_on_single_click(true);
-            this.listBox.connect("row-selected", () => {
-                this.rowGridCallback()
+            this.listBox.connect('row-selected', () => {
+                this.rowGridCallback();
             });
             this.listBox.show();
 
@@ -379,25 +377,25 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
 
             for (let i = this._startIdx; i <= this._endIdx; i++) {
                 this.rowGrid = new Gtk.Grid({ name: i.toString(),
-                                              height_request: 45,
-                                              orientation: Gtk.Orientation.VERTICAL,
-                                              hexpand: true,
-                                              vexpand: true });
+                    height_request: 45,
+                    orientation: Gtk.Orientation.VERTICAL,
+                    hexpand: true,
+                    vexpand: true });
                 this.rowGrid.set_orientation(Gtk.Orientation.HORIZONTAL);
                 this.listBox.add(this.rowGrid);
                 this.rowGrid.show();
 
                 // play button
-                this.playImage = new Gtk.Image({ name: "PlayImage" });
+                this.playImage = new Gtk.Image({ name: 'PlayImage' });
                 this.playImage.set_from_icon_name('media-playback-start-symbolic', Gtk.IconSize.BUTTON);
-                this._playListButton = new Gtk.Button({ name: "PlayButton",
-                                                        hexpand: false,
-                                                        vexpand: true });
+                this._playListButton = new Gtk.Button({ name: 'PlayButton',
+                    hexpand: false,
+                    vexpand: true });
                 this._playListButton.set_image(this.playImage);
-                this._playListButton.set_tooltip_text(_("Play"));
+                this._playListButton.set_tooltip_text(_('Play'));
                 this.rowGrid.attach(this._playListButton, 0, 0, 2, 2);
                 this._playListButton.show();
-                this._playListButton.connect('clicked', (button) => {
+                this._playListButton.connect('clicked', button => {
                     let row = button.get_parent().get_parent();
                     this.listBox.select_row(row);
                     play.passSelected(row);
@@ -410,94 +408,94 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
                 // pause button
                 this.pauseImage = Gtk.Image.new();
                 this.pauseImage.set_from_icon_name('media-playback-pause-symbolic', Gtk.IconSize.BUTTON);
-                this._pauseListButton = new Gtk.Button({ name: "PauseButton",
-                                                         hexpand: false,
-                                                         vexpand: true });
+                this._pauseListButton = new Gtk.Button({ name: 'PauseButton',
+                    hexpand: false,
+                    vexpand: true });
                 this._pauseListButton.set_image(this.pauseImage);
-                this._pauseListButton.set_tooltip_text(_("Pause"));
+                this._pauseListButton.set_tooltip_text(_('Pause'));
                 this.rowGrid.attach(this._pauseListButton, 0, 0, 2, 2);
                 this._pauseListButton.hide();
-                this._pauseListButton.connect('clicked', (button) => {
+                this._pauseListButton.connect('clicked', button => {
                     let row = button.get_parent().get_parent();
                     this.listBox.select_row(row);
                     this.onPause(row);
                 });
 
-                this._fileName = new Gtk.Label({ name: "FileNameLabel",
-                                                 ellipsize: Pango.EllipsizeMode.END,
-                                                 halign: Gtk.Align.START,
-                                                 valign: Gtk.Align.START,
-                                                 margin_start: 15,
-                                                 margin_top: 5,
-                                                 use_markup: true,
-                                                 width_chars: 35,
-                                                 xalign: 0 });
-                let markup = ('<b>'+ this._files[i].fileName + '</b>');
+                this._fileName = new Gtk.Label({ name: 'FileNameLabel',
+                    ellipsize: Pango.EllipsizeMode.END,
+                    halign: Gtk.Align.START,
+                    valign: Gtk.Align.START,
+                    margin_start: 15,
+                    margin_top: 5,
+                    use_markup: true,
+                    width_chars: 35,
+                    xalign: 0 });
+                let 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);
                 this._fileName.show();
 
-                this._playLabelBox = new Gtk.Box({ name: "PlayLabelBox",
-                                                   orientation: Gtk.Orientation.HORIZONTAL,
-                                                   height_request: 45 });
+                this._playLabelBox = new Gtk.Box({ name: 'PlayLabelBox',
+                    orientation: Gtk.Orientation.HORIZONTAL,
+                    height_request: 45 });
                 this.rowGrid.attach(this._playLabelBox, 3, 1, 5, 1);
                 this._playLabelBox.show();
-                this.playDurationLabel = new Gtk.Label({ name: "PlayDurationLabel",
-                                                         halign: Gtk.Align.END,
-                                                         valign: Gtk.Align.END,
-                                                         margin_start: 15,
-                                                         margin_top: 5 });
-                this.fileDuration = this._formatTime(this._files[i].duration/Gst.SECOND);
+                this.playDurationLabel = new Gtk.Label({ name: 'PlayDurationLabel',
+                    halign: Gtk.Align.END,
+                    valign: Gtk.Align.END,
+                    margin_start: 15,
+                    margin_top: 5 });
+                this.fileDuration = this._formatTime(this._files[i].duration / Gst.SECOND);
                 this.playDurationLabel.label = this.fileDuration;
                 this._playLabelBox.pack_start(this.playDurationLabel, false, true, 0);
                 this.playDurationLabel.show();
 
-                this.dividerLabel = new Gtk.Label({ name: "DividerLabel",
-                                                    halign: Gtk.Align.START,
-                                                    valign: Gtk.Align.END,
-                                                    margin_top: 5 });
-                this.dividerLabel.label = "/";
+                this.dividerLabel = new Gtk.Label({ name: 'DividerLabel',
+                    halign: Gtk.Align.START,
+                    valign: Gtk.Align.END,
+                    margin_top: 5 });
+                this.dividerLabel.label = '/';
                 this._playLabelBox.pack_start(this.dividerLabel, false, true, 0);
                 this.dividerLabel.hide();
 
-                this.playTimeLabel = new Gtk.Label({ name: "PlayTimeLabel",
-                                                     halign: Gtk.Align.START,
-                                                     valign: Gtk.Align.END,
-                                                     margin_end: 15,
-                                                     margin_top: 5 });
-                this.playTimeLabel.label = "0:00";
+                this.playTimeLabel = new Gtk.Label({ name: 'PlayTimeLabel',
+                    halign: Gtk.Align.START,
+                    valign: Gtk.Align.END,
+                    margin_end: 15,
+                    margin_top: 5 });
+                this.playTimeLabel.label = '0:00';
                 this._playLabelBox.pack_start(this.playTimeLabel, false, true, 0);
                 this.playTimeLabel.hide();
 
-                //Date Modified label
-                this.dateModifiedLabel = new Gtk.Label({ name: "DateModifiedLabel",
-                                                         halign: Gtk.Align.END,
-                                                         valign: Gtk.Align.END,
-                                                         margin_start: 15,
-                                                         margin_top: 5 });
+                // Date Modified label
+                this.dateModifiedLabel = new Gtk.Label({ name: 'DateModifiedLabel',
+                    halign: Gtk.Align.END,
+                    valign: Gtk.Align.END,
+                    margin_start: 15,
+                    margin_top: 5 });
                 this.dateModifiedLabel.label = this._files[i].dateModified;
                 this.dateModifiedLabel.get_style_context().add_class('dim-label');
                 this.dateModifiedLabel.set_no_show_all(true);
                 this.rowGrid.attach(this.dateModifiedLabel, 3, 1, 6, 1);
                 this.dateModifiedLabel.show();
 
-                this.waveFormGrid = new Gtk.Grid({ name: "WaveFormGrid",
-                                                   hexpand: true,
-                                                   vexpand: true,
-                                                   orientation: Gtk.Orientation.VERTICAL,
-                                                   valign: Gtk.Align.FILL });
+                this.waveFormGrid = new Gtk.Grid({ name: 'WaveFormGrid',
+                    hexpand: true,
+                    vexpand: true,
+                    orientation: Gtk.Orientation.VERTICAL,
+                    valign: Gtk.Align.FILL });
                 this.waveFormGrid.set_no_show_all(true);
                 this.rowGrid.attach(this.waveFormGrid, 12, 1, 17, 2);
                 this.waveFormGrid.show();
 
                 // info button
-                this._info = new Gtk.Button({ name: "InfoButton",
-                                              hexpand: false,
-                                              vexpand: true,
-                                              margin_end: 2 });
-                this._info.image = Gtk.Image.new_from_icon_name("dialog-information-symbolic", 
Gtk.IconSize.BUTTON);
-                this._info.connect("clicked", (button) => {
+                this._info = new Gtk.Button({ name: 'InfoButton',
+                    hexpand: false,
+                    vexpand: true,
+                    margin_end: 2 });
+                this._info.image = Gtk.Image.new_from_icon_name('dialog-information-symbolic', 
Gtk.IconSize.BUTTON);
+                this._info.connect('clicked', button => {
                     let row = button.get_parent().get_parent();
                     this.listBox.select_row(row);
                     let gridForName = row.get_child();
@@ -505,21 +503,21 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
                     let file = this._files[idx];
                     this._onInfoButton(file);
                 });
-                this._info.set_tooltip_text(_("Info"));
+                this._info.set_tooltip_text(_('Info'));
                 this.rowGrid.attach(this._info, 27, 0, 1, 2);
                 this._info.hide();
 
                 // delete button
-                this._delete = new Gtk.Button({ name: "DeleteButton",
-                                                hexpand: false,
-                                                margin_start: 2, });
-                this._delete.image = Gtk.Image.new_from_icon_name("user-trash-symbolic", 
Gtk.IconSize.BUTTON);
-                this._delete.connect("clicked", (button) => {
+                this._delete = new Gtk.Button({ name: 'DeleteButton',
+                    hexpand: false,
+                    margin_start: 2 });
+                this._delete.image = Gtk.Image.new_from_icon_name('user-trash-symbolic', 
Gtk.IconSize.BUTTON);
+                this._delete.connect('clicked', button => {
                     let row = button.get_parent().get_parent();
                     this.listBox.select_row(row);
                     this._deleteFile(row);
                 });
-                this._delete.set_tooltip_text(_("Delete"));
+                this._delete.set_tooltip_text(_('Delete'));
                 this.rowGrid.attach(this._delete, 28, 0, 1, 2);
                 this._delete.hide();
             }
@@ -528,10 +526,10 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
     }
 
     addLoadMoreButton() {
-       loadMoreButton = new LoadMoreButton();
-       loadMoreButton.connect('clicked', () => loadMoreButton.onLoadMore());
-       this.groupGrid.add(loadMoreButton);
-       loadMoreButton.show();
+        loadMoreButton = new LoadMoreButton();
+        loadMoreButton.connect('clicked', () => loadMoreButton.onLoadMore());
+        this.groupGrid.add(loadMoreButton);
+        loadMoreButton.show();
     }
 
     destroyLoadMoreButton() {
@@ -545,21 +543,21 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.destroyLoadMoreButton();
         previousSelRow = null;
 
-        if (this.listBox) {
+        if (this.listBox)
             this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
-        }
+
 
         list.setListTypeRefresh();
         list.enumerateDirectory();
     }
 
     listBoxLoadMore() {
-       this.destroyLoadMoreButton();
-       previousSelRow = null;
-       this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
-       offsetController.increaseEndIdxStep();
-       list.setListTypeRefresh();
-       list._setDiscover();
+        this.destroyLoadMoreButton();
+        previousSelRow = null;
+        this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
+        offsetController.increaseEndIdxStep();
+        list.setListTypeRefresh();
+        list._setDiscover();
     }
 
     scrolledWinDelete() {
@@ -571,38 +569,38 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.destroyLoadMoreButton();
         if (previousSelRow != null) {
             let rowGrid = previousSelRow.get_child();
-            rowGrid.foreach((child) => {
+            rowGrid.foreach(child => {
                 let alwaysShow = child.get_no_show_all();
 
                 if (!alwaysShow)
                     child.hide();
 
-                if (child.name == "PauseButton") {
+                if (child.name == 'PauseButton') {
                     child.hide();
                     child.sensitive = false;
                 }
-                if (child.name == "PlayButton") {
+                if (child.name == 'PlayButton') {
                     child.show();
                     child.sensitive = true;
                 }
 
-                if (child.name == "PlayLabelBox") {
+                if (child.name == 'PlayLabelBox') {
                     child.show();
-                    child.foreach((grandchild) => {
-                        if (grandchild.name == "PlayTimeLabel") {
+                    child.foreach(grandchild => {
+                        if (grandchild.name == 'PlayTimeLabel')
                             grandchild.hide();
-                        }
 
-                        if (grandchild.name == "DividerLabel") {
+
+                        if (grandchild.name == 'DividerLabel')
                             grandchild.hide();
-                        }
+
                     });
                 }
             });
 
-            if (play.getPipeStates() == PipelineStates.PLAYING || play.getPipeStates()== 
PipelineStates.PAUSED) {
+            if (play.getPipeStates() == PipelineStates.PLAYING || play.getPipeStates() == 
PipelineStates.PAUSED)
                 play.stopPlaying();
-            }
+
         }
         previousSelRow = null;
     }
@@ -612,25 +610,25 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.destroyLoadMoreButton();
 
         if (selectedRow) {
-            if (previousSelRow != null) {
+            if (previousSelRow != null)
                 this.hasPreviousSelRow();
-            }
+
 
             previousSelRow = selectedRow;
             let selectedRowGrid = previousSelRow.get_child();
             selectedRowGrid.show_all();
-            selectedRowGrid.foreach((child) => {
+            selectedRowGrid.foreach(child => {
                 let alwaysShow = child.get_no_show_all();
 
                 if (!alwaysShow)
                     child.sensitive = true;
 
-                if (child.name == "PauseButton") {
+                if (child.name == 'PauseButton') {
                     child.hide();
                     child.sensitive = false;
                 }
 
-                if (child.name == "WaveFormGrid")
+                if (child.name == 'WaveFormGrid')
                     child.sensitive = true;
             });
         }
@@ -639,8 +637,8 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
     _getFileFromRow(selected) {
         let fileForAction = null;
         let rowGrid = selected.get_child();
-        rowGrid.foreach((child) => {
-            if (child.name == "FileNameLabel") {
+        rowGrid.foreach(child => {
+            if (child.name == 'FileNameLabel') {
                 let name = child.get_text();
                 let application = Gio.Application.get_default();
                 fileForAction = application.saveDir.get_child_for_display_name(name);
@@ -670,7 +668,7 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
     }
 
     setLabel(time) {
-        this.time = time
+        this.time = time;
 
         this.timeLabelString = this._formatTime(time);
 
@@ -686,10 +684,10 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
 
         let selected = this.listBox.get_row_at_index(index);
         let rowGrid = selected.get_child();
-        rowGrid.foreach((child) => {
-            if (child.name == "FileNameLabel") {
+        rowGrid.foreach(child => {
+            if (child.name == 'FileNameLabel') {
                 let name = child.get_text();
-                let markup = ('<b>'+ newName + '</b>');
+                let markup = `<b>${newName}</b>`;
                 child.label = markup;
             }
         });
@@ -703,13 +701,13 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
             play.pausePlaying();
 
             let rowGrid = listRow.get_child();
-            rowGrid.foreach((child) => {
-                if (child.name == "PauseButton") {
+            rowGrid.foreach(child => {
+                if (child.name == 'PauseButton') {
                     child.hide();
                     child.sensitive = false;
                 }
 
-                if (child.name == "PlayButton") {
+                if (child.name == 'PlayButton') {
                     child.show();
                     child.sensitive = true;
                 }
@@ -726,39 +724,39 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
 
 
             let rowGrid = listRow.get_child();
-            rowGrid.foreach((child) => {
-                if (child.name == "InfoButton" || child.name == "DeleteButton" ||
-                    child.name == "PlayButton") {
+            rowGrid.foreach(child => {
+                if (child.name == 'InfoButton' || child.name == 'DeleteButton' ||
+                    child.name == 'PlayButton') {
                     child.hide();
                     child.sensitive = false;
                 }
 
-                if (child.name == "PauseButton") {
+                if (child.name == 'PauseButton') {
                     child.show();
                     child.sensitive = true;
                 }
 
-                if (child.name == "PlayLabelBox") {
-                    child.foreach((grandchild) => {
-                        if (grandchild.name == "PlayTimeLabel") {
+                if (child.name == 'PlayLabelBox') {
+                    child.foreach(grandchild => {
+                        if (grandchild.name == 'PlayTimeLabel')
                             view.playTimeLabel = grandchild;
-                        }
 
-                        if (grandchild.name == "DividerLabel") {
+
+                        if (grandchild.name == 'DividerLabel')
                             grandchild.show();
-                        }
+
                     });
                 }
 
-                if (child.name == "WaveFormGrid") {
+                if (child.name == 'WaveFormGrid') {
                     this.wFGrid = child;
                     child.sensitive = true;
                 }
             });
 
-            if (activeState != PipelineStates.PAUSED) {
+            if (activeState != PipelineStates.PAUSED)
                 wave = new Waveform.WaveForm(this.wFGrid, selFile);
-            }
+
         }
     }
 });
@@ -769,20 +767,20 @@ const RecordButton = GObject.registerClass(class RecordButton extends Gtk.Button
         this.image = Gtk.Image.new_from_icon_name('media-record-symbolic', Gtk.IconSize.BUTTON);
         this.set_always_show_image(true);
         this.set_valign(Gtk.Align.CENTER);
-        this.set_label(_("Record"));
+        this.set_label(_('Record'));
         this.get_style_context().add_class('text-button');
-        this.connect("clicked", () => this._onRecord());
+        this.connect('clicked', () => this._onRecord());
     }
 
     _onRecord() {
         view.destroyLoadMoreButton();
         view.hasPreviousSelRow();
 
-        if (view.listBox) {
+        if (view.listBox)
             view.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
-        } else {
+        else
             view.emptyGrid.destroy();
-        }
+
 
         this.set_sensitive(false);
         setVisibleID = ActiveArea.RECORD;
@@ -801,7 +799,7 @@ var EncoderComboBox = GObject.registerClass(class EncoderComboBox extends Gtk.Co
     // encoding setting labels in combobox
     _init() {
         super._init();
-        let combo = [_("Ogg Vorbis"), _("Opus"), _("FLAC"), _("MP3"), _("MOV")];
+        let combo = [_('Ogg Vorbis'), _('Opus'), _('FLAC'), _('MP3'), _('MOV')];
 
         for (let i = 0; i < combo.length; i++)
             this.append_text(combo[i]);
@@ -809,7 +807,7 @@ var EncoderComboBox = GObject.registerClass(class EncoderComboBox extends Gtk.Co
         this.set_sensitive(true);
         activeProfile = Application.application.getPreferences();
         this.set_active(activeProfile);
-        this.connect("changed", () => this._onComboBoxTextChanged());
+        this.connect('changed', () => this._onComboBoxTextChanged());
     }
 
     _onComboBoxTextChanged() {
@@ -822,7 +820,7 @@ var ChannelsComboBox = GObject.registerClass(class ChannelsComboBox extends Gtk.
     // channel setting labels in combobox
     _init() {
         super._init();
-        let combo = [_("Mono"), _("Stereo")];
+        let combo = [_('Mono'), _('Stereo')];
 
         for (let i = 0; i < combo.length; i++)
             this.append_text(combo[i]);
@@ -830,7 +828,7 @@ var ChannelsComboBox = GObject.registerClass(class ChannelsComboBox extends Gtk.
         this.set_sensitive(true);
         let chanProfile = Application.application.getChannelsPreferences();
         this.set_active(chanProfile);
-        this.connect("changed", () => this._onChannelComboBoxTextChanged());
+        this.connect('changed', () => this._onChannelComboBoxTextChanged());
     }
 
     _onChannelComboBoxTextChanged() {
@@ -843,7 +841,7 @@ const LoadMoreButton = GObject.registerClass(class LoadMoreButton extends Gtk.Bu
     _init() {
         super._init();
         this._block = false;
-        this.label = _("Load More");
+        this.label = _('Load More');
         this.get_style_context().add_class('documents-load-more');
     }
 
diff --git a/src/play.js b/src/play.js
index 0d2bcd4..1182bef 100644
--- a/src/play.js
+++ b/src/play.js
@@ -35,13 +35,13 @@ const PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
     STOPPED: 2,
-    NULL: 3
+    NULL: 3,
 };
 
 const ErrState = {
     OFF: 0,
-    ON: 1
-}
+    ON: 1,
+};
 
 let errorDialogState;
 
@@ -51,26 +51,26 @@ var Play = class Play {
     _playPipeline() {
         errorDialogState = ErrState.OFF;
         let 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");
-        this.play.set_property("audio-sink", this.sink);
+        this.play = Gst.ElementFactory.make('playbin', 'play');
+        this.play.set_property('uri', uri);
+        this.sink = Gst.ElementFactory.make('pulsesink', 'sink');
+        this.play.set_property('audio-sink', this.sink);
         this.clock = this.play.get_clock();
         this.playBus = this.play.get_bus();
         this.playBus.add_signal_watch();
-        this.playBus.connect("message", (playBus, message) => {
-            if (message != null) {
+        this.playBus.connect('message', (playBus, message) => {
+            if (message != null)
                 this._onMessageReceived(message);
-            }
+
         });
     }
 
     startPlaying() {
         this.baseTime = 0;
 
-        if (!this.play || this.playState == PipelineStates.STOPPED ) {
+        if (!this.play || this.playState == PipelineStates.STOPPED)
             this._playPipeline();
-        }
+
 
         if (this.playState == PipelineStates.PAUSED) {
             this.updatePosition();
@@ -102,9 +102,9 @@ var Play = class Play {
     }
 
     stopPlaying() {
-        if (this.playState != PipelineStates.STOPPED) {
+        if (this.playState != PipelineStates.STOPPED)
             this.onEnd();
-        }
+
     }
 
     onEnd() {
@@ -131,7 +131,7 @@ var Play = class Play {
     _onMessageReceived(message) {
         this.localMsg = message;
         let msg = message.type;
-        switch(msg) {
+        switch (msg) {
 
         case Gst.MessageType.EOS:
             this.onEndOfStream();
@@ -174,45 +174,45 @@ var Play = class Play {
     }
 
     _updateTime() {
-        let time = this.play.query_position(Gst.Format.TIME)[1]/Gst.SECOND;
+        let time = this.play.query_position(Gst.Format.TIME)[1] / Gst.SECOND;
         this.trackDuration = this.play.query_duration(Gst.Format.TIME)[1];
-        this.trackDurationSecs = this.trackDuration/Gst.SECOND;
+        this.trackDurationSecs = this.trackDuration / Gst.SECOND;
 
-        if (time >= 0 && this.playState != PipelineStates.STOPPED) {
+        if (time >= 0 && this.playState != PipelineStates.STOPPED)
             MainWindow.view.setLabel(time);
-        } else if (time >= 0 && this.playState == PipelineStates.STOPPED) {
+        else if (time >= 0 && this.playState == PipelineStates.STOPPED)
             MainWindow.view.setLabel(0);
-        }
+
 
         let absoluteTime = 0;
 
-        if  (this.clock == null) {
+        if  (this.clock == null)
             this.clock = this.play.get_clock();
-        }
+
         try {
             absoluteTime = this.clock.get_time();
-        } catch(error) {
+        } catch (error) {
             // no-op
         }
 
         if (this.baseTime == 0)
             this.baseTime = absoluteTime;
 
-        this.runTime = absoluteTime- this.baseTime;
-        let approxTime = Math.round(this.runTime/_TENTH_SEC);
+        this.runTime = absoluteTime - this.baseTime;
+        let approxTime = Math.round(this.runTime / _TENTH_SEC);
 
-        if (MainWindow.wave != null) {
+        if (MainWindow.wave != null)
             MainWindow.wave._drawEvent(approxTime);
-        }
+
 
         return true;
     }
 
     queryPosition() {
         let position = 0;
-        while (position == 0) {
-            position = this.play.query_position(Gst.Format.TIME)[1]/Gst.SECOND;
-        }
+        while (position == 0)
+            position = this.play.query_position(Gst.Format.TIME)[1] / Gst.SECOND;
+
 
         return position;
     }
@@ -235,9 +235,9 @@ var Play = class Play {
 
     _showErrorDialog(errorStrOne, errorStrTwo) {
         if (errorDialogState == ErrState.OFF) {
-            let errorDialog = new Gtk.MessageDialog ({ destroy_with_parent: true,
-                                                       buttons: Gtk.ButtonsType.OK,
-                                                       message_type: Gtk.MessageType.WARNING });
+            let errorDialog = new Gtk.MessageDialog({ destroy_with_parent: true,
+                buttons: Gtk.ButtonsType.OK,
+                message_type: Gtk.MessageType.WARNING });
 
             if (errorStrOne != null)
                 errorDialog.set_property('text', errorStrOne);
@@ -246,11 +246,11 @@ var Play = class Play {
                 errorDialog.set_property('secondary-text', errorStrTwo);
 
             errorDialog.set_transient_for(Gio.Application.get_default().get_active_window());
-            errorDialog.connect ('response', () => {
+            errorDialog.connect('response', () => {
                 errorDialog.destroy();
                 this.onEndOfStream();
             });
             errorDialog.show();
         }
     }
-}
+};
diff --git a/src/preferences.js b/src/preferences.js
index 7209f19..8e7a67b 100644
--- a/src/preferences.js
+++ b/src/preferences.js
@@ -30,53 +30,53 @@ const Main = imports.main;
 
 let formatComboBoxText = null;
 let channelsComboBoxText = null;
-let recordVolume= null;
+let recordVolume = null;
 let playVolume = null;
 
 var Preferences = class Preferences {
     constructor() {
-        this.widget = new Gtk.Dialog ({ title: _("Preferences"),
-                                        resizable: false,
-                                        modal: true,
-                                        destroy_with_parent: true,
-                                        default_width: 400,
-                                        margin_top: 5,
-                                        use_header_bar: 1,
-                                        hexpand: true });
+        this.widget = new Gtk.Dialog({ title: _('Preferences'),
+            resizable: false,
+            modal: true,
+            destroy_with_parent: true,
+            default_width: 400,
+            margin_top: 5,
+            use_header_bar: 1,
+            hexpand: true });
 
         this.widget.set_transient_for(Gio.Application.get_default().get_active_window());
 
-        let grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
-                                   row_homogeneous: true,
-                                   column_homogeneous: true,
-                                   halign: Gtk.Align.CENTER,
-                                   row_spacing: 6,
-                                   column_spacing: 24,
-                                   margin_bottom: 12,
-                                   margin_end: 24,
-                                   margin_start: 24,
-                                   margin_top: 12 });
+        let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
+            row_homogeneous: true,
+            column_homogeneous: true,
+            halign: Gtk.Align.CENTER,
+            row_spacing: 6,
+            column_spacing: 24,
+            margin_bottom: 12,
+            margin_end: 24,
+            margin_start: 24,
+            margin_top: 12 });
         let contentArea = this.widget.get_content_area();
         contentArea.pack_start(grid, true, true, 2);
 
-        let formatLabel = new Gtk.Label({ label: _("Preferred format"),
-                                          halign: Gtk.Align.END });
+        let 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);
 
         formatComboBoxText = new MainWindow.EncoderComboBox();
         grid.attach(formatComboBoxText, 2, 0, 2, 1);
 
-        let channelsLabel = new Gtk.Label({ label: _("Default mode"),
-                                            halign: Gtk.Align.END });
+        let 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);
 
         channelsComboBoxText = new MainWindow.ChannelsComboBox();
         grid.attach(channelsComboBoxText, 2, 1, 2, 1);
 
-        let volumeLabel = new Gtk.Label({ label: _("Volume"),
-                                          halign: Gtk.Align.END });
+        let 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);
 
@@ -84,13 +84,13 @@ var Preferences = class Preferences {
         this.playRange = Gtk.Adjustment.new(MainWindow.volumeValue[0].play, 0, 1.0, 0.05, 0.0, 0.0);
         playVolume.set_adjustment(this.playRange);
         playVolume.set_sensitive(true);
-        playVolume.connect("value-changed", () => {
+        playVolume.connect('value-changed', () => {
             MainWindow.view.presetVolume(MainWindow.ActiveArea.PLAY, playVolume.get_value());
         });
         grid.attach(playVolume, 2, 2, 2, 1);
 
-        let micVolLabel = new Gtk.Label({ label: _("Microphone"),
-                                          halign: Gtk.Align.END });
+        let 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);
 
@@ -98,7 +98,7 @@ var Preferences = class Preferences {
         this.recordRange = Gtk.Adjustment.new(MainWindow.volumeValue[0].record, 0, 1.0, 0.05, 0.0, 0.0);
         recordVolume.set_adjustment(this.recordRange);
         recordVolume.set_sensitive(true);
-        recordVolume.connect("value-changed", () => {
+        recordVolume.connect('value-changed', () => {
             MainWindow.view.presetVolume(MainWindow.ActiveArea.RECORD, recordVolume.get_value());
         });
         grid.attach(recordVolume, 2, 3, 2, 1);
@@ -109,4 +109,4 @@ var Preferences = class Preferences {
     onDoneClicked() {
         this.widget.destroy();
     }
-}
+};
diff --git a/src/record.js b/src/record.js
index 5a8e492..ccd3c89 100644
--- a/src/record.js
+++ b/src/record.js
@@ -38,17 +38,17 @@ const Listview = imports.listview;
 const PipelineStates = {
     PLAYING: 0,
     PAUSED: 1,
-    STOPPED: 2
+    STOPPED: 2,
 };
 
 const ErrState = {
     OFF: 0,
-    ON: 1
+    ON: 1,
 };
 
 const Channels = {
     MONO: 0,
-    STEREO: 1
+    STEREO: 1,
 };
 
 const _TENTH_SEC = 100000000;
@@ -66,22 +66,22 @@ var Record = class Record {
         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.srcElement = Gst.ElementFactory.make("pulsesrc", "srcElement");
+        this.pipeline = new Gst.Pipeline({ name: 'pipe' });
+        this.srcElement = Gst.ElementFactory.make('pulsesrc', 'srcElement');
 
         if (this.srcElement == null) {
-            let inspect = "gst-inspect-1.0 pulseaudio";
+            let inspect = 'gst-inspect-1.0 pulseaudio';
             let [res, out, err, status] =  GLib.spawn_command_line_sync(inspect);
-            let err_str = String(err)
+            let err_str = String(err);
             if (err_str.replace(/\W/g, ''))
-                this._showErrorDialog(_("Please install the GStreamer 1.0 PulseAudio plugin."));
+                this._showErrorDialog(_('Please install the GStreamer 1.0 PulseAudio plugin.'));
             else
-                this._showErrorDialog(_("Your audio capture settings are invalid."));
+                this._showErrorDialog(_('Your audio capture settings are invalid.'));
 
             errorDialogState = ErrState.ON;
             this.onEndOfStream();
@@ -89,30 +89,30 @@ var Record = class Record {
         }
 
         this.pipeline.add(this.srcElement);
-        this.audioConvert = Gst.ElementFactory.make("audioconvert", "audioConvert");
+        this.audioConvert = Gst.ElementFactory.make('audioconvert', 'audioConvert');
         this.pipeline.add(this.audioConvert);
-        this.caps = Gst.Caps.from_string("audio/x-raw, channels=" + this._getChannels());
+        this.caps = Gst.Caps.from_string(`audio/x-raw, channels=${this._getChannels()}`);
         this.clock = this.pipeline.get_clock();
         this.recordBus = this.pipeline.get_bus();
         this.recordBus.add_signal_watch();
-        this.recordBus.connect("message", (recordBus, message) => {
-            if (message != null) {
+        this.recordBus.connect('message', (recordBus, message) => {
+            if (message != null)
                 this._onMessageReceived(message);
-            }
+
         });
-        this.level = Gst.ElementFactory.make("level", "level");
+        this.level = Gst.ElementFactory.make('level', 'level');
         this.pipeline.add(this.level);
-        this.volume = Gst.ElementFactory.make("volume", "volume");
+        this.volume = Gst.ElementFactory.make('volume', 'volume');
         this.pipeline.add(this.volume);
-        this.ebin = Gst.ElementFactory.make("encodebin", "ebin");
-        this.ebin.connect("element-added", (ebin, element) => {
+        this.ebin = Gst.ElementFactory.make('encodebin', 'ebin');
+        this.ebin.connect('element-added', (ebin, element) => {
             let factory = element.get_factory();
 
             if (factory != null) {
-                this.hasTagSetter = factory.has_interface("GstTagSetter");
+                this.hasTagSetter = factory.has_interface('GstTagSetter');
                 if (this.hasTagSetter == true) {
                     this.taglist = Gst.TagList.new_empty();
-                    this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_APPLICATION_NAME, _("Sound 
Recorder"));
+                    this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_APPLICATION_NAME, _('Sound 
Recorder'));
                     element.merge_tags(this.taglist, Gst.TagMergeMode.REPLACE);
                     this.taglist.add_value(Gst.TagMergeMode.APPEND, Gst.TAG_TITLE, this.initialFileName);
                     element.merge_tags(this.taglist, Gst.TagMergeMode.REPLACE);
@@ -122,14 +122,14 @@ var Record = class Record {
             }
         });
         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);
+        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);
         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();
         }
@@ -141,7 +141,7 @@ var Record = class Record {
         let ebinLink = this.ebin.link(this.filesink);
 
         if (!srcLink || !audioConvertLink || !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();
         }
@@ -151,11 +151,11 @@ var Record = class Record {
     }
 
     _updateTime() {
-        let time = this.pipeline.query_position(Gst.Format.TIME)[1]/Gst.SECOND;
+        let time = this.pipeline.query_position(Gst.Format.TIME)[1] / Gst.SECOND;
 
-        if (time >= 0) {
+        if (time >= 0)
             this._view.setLabel(time, 0);
-        }
+
 
         return true;
     }
@@ -166,27 +166,27 @@ var Record = class Record {
         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 )
+        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();
         }
 
-        if (!this.timeout) {
+        if (!this.timeout)
             this.timeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, MainWindow._SEC_TIMEOUT, () => 
this._updateTime());
-        }
+
     }
 
     stopRecording() {
@@ -215,7 +215,7 @@ var Record = class Record {
     _onMessageReceived(message) {
         this.localMsg = message;
         let msg = message.type;
-        switch(msg) {
+        switch (msg) {
 
         case Gst.MessageType.ELEMENT:
             if (GstPbutils.is_missing_plugin_message(this.localMsg)) {
@@ -237,44 +237,44 @@ var Record = class Record {
             }
 
             let 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");
-                        peakVal = s.get_value("peak");
-
-                        if (peakVal) {
-                            let val = peakVal.get_nth(0);
-
-                            if (val > 0)
+            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');
+                    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;
+                        let value = Math.pow(10, val / 20);
+                        this.peak = value;
+
 
+                        if  (this.clock == null)
+                            this.clock = this.pipeline.get_clock();
 
-                            if  (this.clock == null) {
-                                this.clock = this.pipeline.get_clock();
-                            }
-                            try {
-                                this.absoluteTime = this.clock.get_time();
-                            } catch(error) {
-                                this.absoluteTime = 0;
-                            }
+                        try {
+                            this.absoluteTime = this.clock.get_time();
+                        } catch (error) {
+                            this.absoluteTime = 0;
+                        }
 
 
-                            if (this.baseTime == 0)
-                                this.baseTime = this.absoluteTime;
+                        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);
-                            }
-                        }
+                        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:
@@ -295,9 +295,9 @@ var Record = class Record {
     }
 
     setVolume(value) {
-        if (this.volume) {
+        if (this.volume)
             this.volume.set_volume(GstAudio.StreamVolumeFormat.CUBIC, value);
-        }
+
     }
 
     _getChannels() {
@@ -305,7 +305,7 @@ var Record = class Record {
         let channels = null;
         let channelsPref = Application.application.getChannelsPreferences();
 
-        switch(channelsPref) {
+        switch (channelsPref) {
         case Channels.MONO:
             channels = 1;
             break;
@@ -323,19 +323,19 @@ var Record = class Record {
 
     _showErrorDialog(errorStrOne, errorStrTwo) {
         if (errorDialogState == ErrState.OFF) {
-            let errorDialog = new Gtk.MessageDialog ({ modal: true,
-                                                       destroy_with_parent: true,
-                                                       buttons: Gtk.ButtonsType.OK,
-                                                       message_type: Gtk.MessageType.WARNING });
-            if (errorStrOne != null) {
-                errorDialog.set_property("text", errorStrOne);
-            }
+            let errorDialog = new Gtk.MessageDialog({ modal: true,
+                destroy_with_parent: true,
+                buttons: Gtk.ButtonsType.OK,
+                message_type: Gtk.MessageType.WARNING });
+            if (errorStrOne != null)
+                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", () => {
+            errorDialog.connect('response', () => {
                 errorDialog.destroy();
                 MainWindow.view.onRecordStopClicked();
                 this.onEndOfStream();
@@ -343,7 +343,7 @@ var Record = class Record {
             errorDialog.show();
         }
     }
-}
+};
 
 const BuildFileName = class BuildFileName {
     buildInitialFilename() {
@@ -352,8 +352,8 @@ const BuildFileName = class BuildFileName {
         this.dateTime = GLib.DateTime.new_now_local();
         /* Translators: ""Recording from %R on %A %F "" is the default name assigned to a file created
             by the application (for example, "Recording from 14:40:30 on Tuesday 2020-02-25"). */
-        var clipName = this.dateTime.format (_("Recording from %R on %A %F"));        
-        this.clip = dir.get_child_for_display_name(clipName); 
+        var clipName = this.dateTime.format(_('Recording from %R on %A %F'));
+        this.clip = dir.get_child_for_display_name(clipName);
         var file = this.clip.get_path();
         return file;
     }
@@ -365,4 +365,4 @@ const BuildFileName = class BuildFileName {
     getOrigin() {
         return this.dateTime;
     }
-}
+};
diff --git a/src/util.js b/src/util.js
index a398f7e..e9017f9 100644
--- a/src/util.js
+++ b/src/util.js
@@ -33,8 +33,8 @@ function loadStyleSheet() {
     let file = 'application.css';
     let provider = new Gtk.CssProvider();
     provider.load_from_path(GLib.build_filenamev([pkg.pkgdatadir,
-                                                  file]));
+        file]));
     Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
-                                             provider,
-                                             Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+        provider,
+        Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 }
diff --git a/src/waveform.js b/src/waveform.js
index 6813884..e93889b 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -42,7 +42,7 @@ const waveSamples = 40;
 
 const WaveType = {
     RECORD: 0,
-    PLAY: 1
+    PLAY: 1,
 };
 
 var WaveForm = class WaveForm {
@@ -58,7 +58,7 @@ var WaveForm = class WaveForm {
             this.duration = this.file.duration;
             this._uri = this.file.uri;
         } else {
-          this.waveType = WaveType.RECORD;
+            this.waveType = WaveType.RECORD;
         }
 
         let gridWidth = 0;
@@ -66,17 +66,17 @@ var WaveForm = class WaveForm {
         let drawingHeight = 0;
         this.drawing = Gtk.DrawingArea.new();
         if (this.waveType == WaveType.RECORD) {
-            this.drawing.set_property("valign", Gtk.Align.FILL);
-            this.drawing.set_property("hexpand",true);
+            this.drawing.set_property('valign', Gtk.Align.FILL);
+            this.drawing.set_property('hexpand', true);
             this._grid.attach(this.drawing, 2, 0, 3, 2);
         } else {
-            this.drawing.set_property("valign", Gtk.Align.FILL);
-            this.drawing.set_property("hexpand",true);
-            this.drawing.set_property("vexpand",true);
+            this.drawing.set_property('valign', Gtk.Align.FILL);
+            this.drawing.set_property('hexpand', true);
+            this.drawing.set_property('vexpand', true);
             this._grid.add(this.drawing);
         }
 
-        this.drawing.connect("draw", (drawing, cr) => this.fillSurface(drawing, cr));
+        this.drawing.connect('draw', (drawing, cr) => this.fillSurface(drawing, cr));
         this.drawing.show_all();
         this._grid.show_all();
 
@@ -88,9 +88,9 @@ var WaveForm = class WaveForm {
 
     _launchPipeline() {
         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");
+            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();
         bus.add_signal_watch();
         GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, Application.SIGINT, 
Application.application.onWindowDestroy);
@@ -98,28 +98,28 @@ var WaveForm = class WaveForm {
 
         this.nSamples = Math.ceil(this.duration / INTERVAL);
 
-        bus.connect("message", (bus, message) => {
-            if (message != null) {
+        bus.connect('message', (bus, message) => {
+            if (message != null)
                 this._messageCb(message);
-            }
+
         });
     }
 
     _messageCb(message) {
         let msg = message.type;
 
-        switch(msg) {
+        switch (msg) {
         case Gst.MessageType.ELEMENT:
             let s = message.get_structure();
 
             if (s) {
 
-                if (s.has_name("level")) {
+                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");
+                    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');
 
                     if (peakVal) {
                         let val = peakVal.get_nth(0);
@@ -127,19 +127,19 @@ var WaveForm = class WaveForm {
                         if (val > 0)
                             val = 0;
 
-                        let value = Math.pow(10, val/20);
+                        let value = Math.pow(10, val / 20);
                         peaks.push(value);
                     }
                 }
             }
 
-            if (peaks.length == this.playTime) {
+            if (peaks.length == this.playTime)
                 this.pipeline.set_state(Gst.State.PAUSED);
-            }
 
-            if (peaks.length == pauseVal) {
+
+            if (peaks.length == pauseVal)
                 this.pipeline.set_state(Gst.State.PAUSED);
-            }
+
             break;
 
         case Gst.MessageType.EOS:
@@ -161,14 +161,12 @@ var WaveForm = class WaveForm {
 
         if (this.waveType == WaveType.PLAY) {
 
-            if (peaks.length != this.playTime) {
+            if (peaks.length != this.playTime)
                 this.pipeline.set_state(Gst.State.PLAYING);
-            }
+
             start = Math.floor(this.playTime);
-        } else {
-            if (this.recordTime >= 0) {
-                start = this.recordTime;
-            }
+        } else if (this.recordTime >= 0) {
+            start = this.recordTime;
         }
 
         let i = 0;
@@ -177,13 +175,13 @@ var WaveForm = class WaveForm {
         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);
+        let pixelsPerSample = width / waveSamples;
+        let 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);
-              cr.setLineWidth(1);
-              cr.setSourceRGBA(0.0, 255, 255, 255);
+            gradient.addColorStopRGBA(0.75, 0.94, 1.0, 0.94, 0.75);
+            gradient.addColorStopRGBA(0.0, 0.94, 1.0, 0.94, 0.22);
+            cr.setLineWidth(1);
+            cr.setSourceRGBA(0.0, 255, 255, 255);
         } else {
             gradient.addColorStopRGBA(0.75, 0.0, 0.72, 0.64, 0.35);
             gradient.addColorStopRGBA(0.0, 0.2, 0.54, 0.47, 0.22);
@@ -191,22 +189,22 @@ var WaveForm = class WaveForm {
             cr.setSourceRGBA(0.0, 185, 161, 255);
         }
 
-        for(i = start; i <= end; i++) {
+        for (i = start; i <= end; i++) {
 
             // Keep moving until we get to a non-null array member
-            if (peaks[i] < 0) {
-                cr.moveTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)))
-            }
+            if (peaks[i] < 0)
+                cr.moveTo(xAxis * pixelsPerSample, waveheight - peaks[i] * waveheight);
+
 
             // Start drawing when we reach the first non-null array member
             if (peaks[i] != null && peaks[i] >= 0) {
                 let idx = i - 1;
 
-                if (start >= 40 && xAxis == 0) {
-                     cr.moveTo((xAxis * pixelsPerSample), waveheight);
-                }
+                if (start >= 40 && xAxis == 0)
+                    cr.moveTo(xAxis * pixelsPerSample, waveheight);
+
 
-                cr.lineTo((xAxis * pixelsPerSample), (waveheight - (peaks[i] * waveheight)));
+                cr.lineTo(xAxis * pixelsPerSample, waveheight - peaks[i] * waveheight);
             }
 
             xAxis += 1;
@@ -226,13 +224,13 @@ var WaveForm = class WaveForm {
             lastTime = this.playTime;
             this.playTime = playTime;
 
-            if (peaks.length < this.playTime) {
+            if (peaks.length < this.playTime)
                 this.pipeline.set_state(Gst.State.PLAYING);
-            }
 
-            if (lastTime != this.playTime) {
+
+            if (lastTime != this.playTime)
                 this.drawing.queue_draw();
-            }
+
 
         } else {
             peaks.push(recPeaks);
@@ -240,7 +238,7 @@ var WaveForm = class WaveForm {
             this.recordTime = playTime;
 
             if (peaks.length < this.recordTime) {
-                log("error");
+                log('error');
                 return true;
             }
             if (this.drawing)
@@ -261,4 +259,4 @@ var WaveForm = class WaveForm {
             log(e);
         }
     }
-}
+};


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