[gnome-shell-extensions] cleanup: Don't use comparison operator when checking falsy values



commit ed7a2928057b41c2baf586b5a510e0a72f4905ff
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 7 03:58:03 2019 +0200

    cleanup: Don't use comparison operator when checking falsy values
    
    We mostly use the regular == and != comparison operators over their
    type-safe === and !== counterparts. This is about to change, but there
    are some places where we don't care whether a value is null, undefined
    or 0; just check for falsiness there instead of using operators, so
    we can start to consistently use the type-safe operators everywhere
    else in a follow-up commit.
    
    https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/91

 extensions/auto-move-windows/extension.js | 2 +-
 extensions/drive-menu/extension.js        | 2 +-
 extensions/places-menu/placeDisplay.js    | 8 ++++----
 extensions/window-list/windowPicker.js    | 2 +-
 extensions/windowsNavigator/extension.js  | 8 ++++----
 5 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index 9ffdfea..de9f3b5 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -44,7 +44,7 @@ class WindowMover {
         });
 
         let addedApps = ids.map(id => this._appSystem.lookup_app(id)).filter(
-            app => app != null && !this._appData.has(app)
+            app => app && !this._appData.has(app)
         );
         addedApps.forEach(app => {
             let data = {
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 0463fb5..365e244 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -53,7 +53,7 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
 
         let volume = this.mount.get_volume();
 
-        if (volume == null) {
+        if (!volume) {
             // probably a GDaemonMount, could be network or
             // local, but we can't tell; assume it's local for now
             return true;
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 7b8b719..1612a83 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -366,7 +366,7 @@ var PlacesManager = class {
 
         for (let i = 0; i < dirs.length; i++) {
             let specialPath = GLib.get_user_special_dir(dirs[i]);
-            if (specialPath == null || specialPath == homePath)
+            if (!specialPath || specialPath == homePath)
                 continue;
 
             let file = Gio.File.new_for_path(specialPath), info;
@@ -415,7 +415,7 @@ var PlacesManager = class {
                     networkVolumes.push(volumes[j]);
                 } else {
                     let mount = volumes[j].get_mount();
-                    if (mount != null)
+                    if (mount)
                         this._addMount('devices', mount);
                 }
             }
@@ -424,7 +424,7 @@ var PlacesManager = class {
         /* add all volumes that is not associated with a drive */
         let volumes = this._volumeMonitor.get_volumes();
         for (let i = 0; i < volumes.length; i++) {
-            if (volumes[i].get_drive() != null)
+            if (volumes[i].get_drive())
                 continue;
 
             let identifier = volumes[i].get_identifier('class');
@@ -432,7 +432,7 @@ var PlacesManager = class {
                 networkVolumes.push(volumes[i]);
             } else {
                 let mount = volumes[i].get_mount();
-                if (mount != null)
+                if (mount)
                     this._addMount('devices', mount);
             }
         }
diff --git a/extensions/window-list/windowPicker.js b/extensions/window-list/windowPicker.js
index cc071e7..901475d 100644
--- a/extensions/window-list/windowPicker.js
+++ b/extensions/window-list/windowPicker.js
@@ -24,7 +24,7 @@ let MyWorkspacesDisplay = class extends WorkspacesDisplay {
     }
 
     show(...args) {
-        if (this._scrollEventId == 0) {
+        if (!this._scrollEventId) {
             this._scrollEventId = Main.windowPicker.connect('scroll-event',
                 this._onScrollEvent.bind(this));
         }
diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js
index 6cad3be..f5175b1 100644
--- a/extensions/windowsNavigator/extension.js
+++ b/extensions/windowsNavigator/extension.js
@@ -61,7 +61,7 @@ var MyWorkspace = class extends Workspace.Workspace {
     }
 
     showTooltip() {
-        if (this._tip == null || this._actualGeometry == null)
+        if (!this._tip || !this._actualGeometry)
             return;
         this._tip.text = (this.metaWorkspace.index() + 1).toString();
 
@@ -83,7 +83,7 @@ var MyWorkspace = class extends Workspace.Workspace {
     }
 
     hideTooltip() {
-        if (this._tip == null)
+        if (!this._tip)
             return;
         if (!this._tip.get_parent())
             return;
@@ -100,14 +100,14 @@ var MyWorkspace = class extends Workspace.Workspace {
 
     showWindowsTooltips() {
         for (let i in this._windowOverlays) {
-            if (this._windowOverlays[i] != null)
+            if (this._windowOverlays[i])
                 this._windowOverlays[i].showTooltip();
         }
     }
 
     hideWindowsTooltips() {
         for (let i in this._windowOverlays) {
-            if (this._windowOverlays[i] != null)
+            if (this._windowOverlays[i])
                 this._windowOverlays[i].hideTooltip();
         }
     }


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