[gnome-shell-extensions/wip/fmuellner/js-cleanup: 7/7] cleanup: Get rid of Lang.bind()



commit f52da060bcfeb4531832f89b702191959fa89762
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Nov 13 17:13:01 2017 +0000

    cleanup: Get rid of Lang.bind()
    
    After replacing Lang.Class with ES6 classes and adopting arrow notation
    for anonymous callbacks, we only use the Lang module to bind `this` to
    named callbacks. However since ES5, this functionality is already provided
    by Function.prototype.bind() - in fact, Lang.bind() itself uses it when
    no extra arguments are specified.
    
    So just use the built-in function directly instead of the wrapper.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790301

 extensions/alternate-tab/extension.js       | 13 +++--
 extensions/apps-menu/extension.js           | 17 +++---
 extensions/auto-move-windows/extension.js   |  3 +-
 extensions/auto-move-windows/prefs.js       |  9 ++-
 extensions/drive-menu/extension.js          | 11 ++--
 extensions/places-menu/extension.js         |  3 +-
 extensions/places-menu/placeDisplay.js      |  7 +--
 extensions/user-theme/extension.js          |  3 +-
 extensions/window-list/extension.js         | 91 +++++++++++++++--------------
 extensions/windowsNavigator/extension.js    |  7 ++-
 extensions/workspace-indicator/extension.js | 15 +++--
 extensions/workspace-indicator/prefs.js     | 15 +++--
 12 files changed, 98 insertions(+), 96 deletions(-)
---
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index 88e3639..58f212a 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -1,7 +1,6 @@
 /* -*- mode: js; js-basic-offset: 4; indent-tabs-mode: nil -*- */
 
 const Clutter = imports.gi.Clutter;
-const Lang = imports.lang;
 const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
 
@@ -43,15 +42,19 @@ function enable() {
             tabPopup.destroy();
     };
 
-    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
-    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._forcedWindowSwitcher));
+    setKeybinding('switch-applications',
+                  Main.wm._forcedWindowSwitcher.bind(Main.wm));
+    setKeybinding('switch-applications-backward',
+                  Main.wm._forcedWindowSwitcher.bind(Main.wm));
 }
 
 function disable() {
     var prop;
 
-    setKeybinding('switch-applications', Lang.bind(Main.wm, Main.wm._startSwitcher));
-    setKeybinding('switch-applications-backward', Lang.bind(Main.wm, Main.wm._startSwitcher));
+    setKeybinding('switch-applications',
+                  Main.wm._startSwitcher.bind(Main.wm));
+    setKeybinding('switch-applications-backward',
+                  Main.wm._startSwitcher.bind(Main.wm));
 
     for (prop in injections)
         AltTab.WindowSwitcherPopup.prototype[prop] = injections[prop];
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index cfd5891..789bdbc 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -3,7 +3,6 @@
 const Atk = imports.gi.Atk;
 const DND = imports.ui.dnd;
 const GMenu = imports.gi.GMenu;
-const Lang = imports.lang;
 const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 const Clutter = imports.gi.Clutter;
@@ -61,7 +60,7 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
 
         let textureCache = St.TextureCache.get_default();
         let iconThemeChangedId = textureCache.connect('icon-theme-changed',
-                                                      Lang.bind(this, this._updateIcon));
+                                                      this._updateIcon.bind(this));
         this.actor.connect('destroy', () => {
             textureCache.disconnect(iconThemeChangedId);
         });
@@ -131,7 +130,7 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
             name = _("Favorites");
 
         this.actor.add_child(new St.Label({ text: name }));
-        this.actor.connect('motion-event', Lang.bind(this, this._onMotionEvent));
+        this.actor.connect('motion-event', this._onMotionEvent.bind(this));
     }
 
     activate(event) {
@@ -272,7 +271,7 @@ class DesktopTarget {
 
         this._windowAddedId =
             global.window_group.connect('actor-added',
-                                        Lang.bind(this, this._onWindowAdded));
+                                        this._onWindowAdded.bind(this));
 
         global.get_window_actors().forEach(a => {
             this._onWindowAdded(a.get_parent(), a);
@@ -425,8 +424,8 @@ class ApplicationsButton extends PanelMenu.Button {
         this.actor.name = 'panelApplications';
         this.actor.label_actor = this._label;
 
-        this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('captured-event', this._onCapturedEvent.bind(this));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
 
         this._showingId = Main.overview.connect('showing', () => {
             this.actor.add_accessible_state (Atk.StateType.CHECKED);
@@ -435,7 +434,7 @@ class ApplicationsButton extends PanelMenu.Button {
             this.actor.remove_accessible_state (Atk.StateType.CHECKED);
         });
         Main.layoutManager.connect('startup-complete',
-                                   Lang.bind(this, this._setKeybinding));
+                                   this._setKeybinding.bind(this));
         this._setKeybinding();
 
         this._desktopTarget = new DesktopTarget();
@@ -469,7 +468,7 @@ class ApplicationsButton extends PanelMenu.Button {
     _createVertSeparator() {
         let separator = new St.DrawingArea({ style_class: 'calendar-vertical-separator',
                                              pseudo_class: 'highlighted' });
-        separator.connect('repaint', Lang.bind(this, this._onVertSepRepaint));
+        separator.connect('repaint', this._onVertSepRepaint.bind(this));
         return separator;
     }
 
@@ -482,7 +481,7 @@ class ApplicationsButton extends PanelMenu.Button {
                                            Shell.ActionMode.NORMAL |
                                            Shell.ActionMode.OVERVIEW,
                                            Main.sessionMode.hasOverview ?
-                                           Lang.bind(Main.overview, Main.overview.toggle) :
+                                           Main.overview.toggle.bind(Main.overview) :
                                            null);
 
         this._desktopTarget.destroy();
diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js
index 34da450..ca9cd90 100644
--- a/extensions/auto-move-windows/extension.js
+++ b/extensions/auto-move-windows/extension.js
@@ -3,7 +3,6 @@
 
 const Glib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
 const Shell = imports.gi.Shell;
@@ -26,7 +25,7 @@ class WindowMover {
 
         let display = global.screen.get_display();
         // Connect after so the handler from ShellWindowTracker has already run
-        this._windowCreatedId = display.connect_after('window-created', Lang.bind(this, this._findAndMove));
+        this._windowCreatedId = display.connect_after('window-created', this._findAndMove.bind(this));
     }
 
     destroy() {
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index 16c0416..f163a19 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -4,7 +4,6 @@
 const Gio = imports.gi.Gio;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const Gettext = imports.gettext.domain('gnome-shell-extensions');
 const _ = Gettext.gettext;
@@ -34,7 +33,7 @@ const Widget = GObject.registerClass({
         this.set_orientation(Gtk.Orientation.VERTICAL);
 
         this._settings = Convenience.getSettings();
-        this._settings.connect('changed', Lang.bind(this, this._refresh));
+        this._settings.connect('changed', this._refresh.bind(this));
         this._changedPermitted = false;
 
         this._store = new Gtk.ListStore();
@@ -63,7 +62,7 @@ const Widget = GObject.registerClass({
         let workspaceColumn = new Gtk.TreeViewColumn({ title: _("Workspace"),
                                                        sort_column_id: Columns.WORKSPACE });
         let workspaceRenderer = new Gtk.CellRendererSpin({ editable: true });
-        workspaceRenderer.connect('edited', Lang.bind(this, this._workspaceEdited));
+        workspaceRenderer.connect('edited', this._workspaceEdited.bind(this));
         workspaceColumn.pack_start(workspaceRenderer, true);
         workspaceColumn.add_attribute(workspaceRenderer, "adjustment", Columns.ADJUSTMENT);
         workspaceColumn.add_attribute(workspaceRenderer, "text", Columns.WORKSPACE);
@@ -78,11 +77,11 @@ const Widget = GObject.registerClass({
         let newButton = new Gtk.ToolButton({ icon_name: 'bookmark-new-symbolic',
                                              label: _("Add Rule"),
                                              is_important: true });
-        newButton.connect('clicked', Lang.bind(this, this._createNew));
+        newButton.connect('clicked', this._createNew.bind(this));
         toolbar.add(newButton);
 
         let delButton = new Gtk.ToolButton({ icon_name: 'edit-delete-symbolic'  });
-        delButton.connect('clicked', Lang.bind(this, this._deleteSelected));
+        delButton.connect('clicked', this._deleteSelected.bind(this));
         toolbar.add(delButton);
 
         let selection = this._treeView.get_selection();
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 9356b59..3c3dbe8 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -1,7 +1,6 @@
 // Drive menu extension
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
 const St = imports.gi.St;
 const Shell = imports.gi.Shell;
 
@@ -31,10 +30,10 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
         let ejectIcon = new St.Icon({ icon_name: 'media-eject-symbolic',
                                       style_class: 'popup-menu-icon ' });
         let ejectButton = new St.Button({ child: ejectIcon });
-        ejectButton.connect('clicked', Lang.bind(this, this._eject));
+        ejectButton.connect('clicked', this._eject.bind(this));
         this.actor.add(ejectButton);
 
-        this._changedId = mount.connect('changed', Lang.bind(this, this._syncVisibility));
+        this._changedId = mount.connect('changed', this._syncVisibility.bind(this));
         this._syncVisibility();
     }
 
@@ -75,12 +74,12 @@ class MountMenuItem extends PopupMenu.PopupBaseMenuItem {
             this.mount.eject_with_operation(Gio.MountUnmountFlags.NONE,
                                             mountOp.mountOp,
                                             null, // Gio.Cancellable
-                                            Lang.bind(this, this._ejectFinish));
+                                            this._ejectFinish.bind(this));
         else
             this.mount.unmount_with_operation(Gio.MountUnmountFlags.NONE,
                                               mountOp.mountOp,
                                               null, // Gio.Cancellable
-                                              Lang.bind(this, this._unmountFinish));
+                                              this._unmountFinish.bind(this));
     }
 
     _unmountFinish(mount, result) {
@@ -138,7 +137,7 @@ class DriveMenu extends PanelMenu.Button {
 
         this._mounts = [ ];
 
-        this._monitor.get_mounts().forEach(Lang.bind(this, this._addMount));
+        this._monitor.get_mounts().forEach(this._addMount.bind(this));
 
         this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
         this.menu.addAction(_("Open Files"), event => {
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 91cf05f..cf7f3a9 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -3,7 +3,6 @@
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const Lang = imports.lang;
 const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 
@@ -36,7 +35,7 @@ class PlaceMenuItem extends PopupMenu.PopupBaseMenuItem {
         this.actor.add_child(this._label);
 
         this._changedId = info.connect('changed',
-                                       Lang.bind(this, this._propertiesChanged));
+                                       this._propertiesChanged.bind(this));
     }
 
     destroy() {
diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js
index 5f546c9..836a54a 100644
--- a/extensions/places-menu/placeDisplay.js
+++ b/extensions/places-menu/placeDisplay.js
@@ -3,7 +3,6 @@
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
 const Shell = imports.gi.Shell;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Signals = imports.signals;
 const St = imports.gi.St;
@@ -143,7 +142,7 @@ class RootInfo extends PlaceInfo {
                                             return;
 
                                         this._proxy.connect('g-properties-changed',
-                                                            Lang.bind(this, this._propertiesChanged));
+                                                            this._propertiesChanged.bind(this));
                                         this._propertiesChanged(obj);
                                     });
     }
@@ -225,7 +224,7 @@ var PlacesManager = class {
         this._settings = new Gio.Settings({ schema_id: BACKGROUND_SCHEMA });
         this._showDesktopIconsChangedId =
             this._settings.connect('changed::show-desktop-icons',
-                                   Lang.bind(this, this._updateSpecials));
+                                   this._updateSpecials.bind(this));
         this._updateSpecials();
 
         /*
@@ -262,7 +261,7 @@ var PlacesManager = class {
                          'drive-connected', 'drive-disconnected', 'drive-changed'];
 
         this._volumeMonitorSignals = [];
-        let func = Lang.bind(this, this._updateMounts);
+        let func = this._updateMounts.bind(this);
         for (let i = 0; i < signals.length; i++) {
             let id = this._volumeMonitor.connect(signals[i], func);
             this._volumeMonitorSignals.push(id);
diff --git a/extensions/user-theme/extension.js b/extensions/user-theme/extension.js
index 0c792cf..e0c2d57 100644
--- a/extensions/user-theme/extension.js
+++ b/extensions/user-theme/extension.js
@@ -3,7 +3,6 @@
 
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
-const Lang = imports.lang;
 const Main = imports.ui.main;
 
 const SETTINGS_KEY = 'name';
@@ -18,7 +17,7 @@ class ThemeManager {
     }
 
     enable() {
-        this._changedId = this._settings.connect('changed::'+SETTINGS_KEY, Lang.bind(this, 
this._changeTheme));
+        this._changedId = this._settings.connect('changed::'+SETTINGS_KEY, this._changeTheme.bind(this));
         this._changeTheme();
     }
 
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 6d09525..4978b49 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -7,7 +7,6 @@ const Shell = imports.gi.Shell;
 const St = imports.gi.St;
 
 const DND = imports.ui.dnd;
-const Lang = imports.lang;
 const Main = imports.ui.main;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
@@ -81,7 +80,7 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
 
         this._notifyMinimizedId =
             this._metaWindow.connect('notify::minimized',
-                                     Lang.bind(this, this._updateMinimizeItem));
+                                     this._updateMinimizeItem.bind(this));
         this._updateMinimizeItem();
 
         this._maximizeItem = new PopupMenu.PopupMenuItem('');
@@ -98,10 +97,10 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
 
         this._notifyMaximizedHId =
             this._metaWindow.connect('notify::maximized-horizontally',
-                                     Lang.bind(this, this._updateMaximizeItem));
+                                     this._updateMaximizeItem.bind(this));
         this._notifyMaximizedVId =
             this._metaWindow.connect('notify::maximized-vertically',
-                                     Lang.bind(this, this._updateMaximizeItem));
+                                     this._updateMaximizeItem.bind(this));
         this._updateMaximizeItem();
 
         this._closeItem = new PopupMenu.PopupMenuItem(_("Close"));
@@ -110,7 +109,7 @@ class WindowContextMenu extends PopupMenu.PopupMenu {
         });
         this.addMenuItem(this._closeItem);
 
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
 
         this.connect('open-state-changed', () => {
             if (!this.isOpen)
@@ -155,23 +154,23 @@ class WindowTitle {
         this._textureCache = St.TextureCache.get_default();
         this._iconThemeChangedId =
             this._textureCache.connect('icon-theme-changed',
-                                       Lang.bind(this, this._updateIcon));
+                                       this._updateIcon.bind(this));
         this._notifyWmClass =
             this._metaWindow.connect('notify::wm-class',
-                                     Lang.bind(this, this._updateIcon));
+                                     this._updateIcon.bind(this));
         this._notifyAppId =
             this._metaWindow.connect('notify::gtk-application-id',
-                                     Lang.bind(this, this._updateIcon));
+                                     this._updateIcon.bind(this));
         this._updateIcon();
 
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
 
         this._notifyTitleId =
             this._metaWindow.connect('notify::title',
-                                    Lang.bind(this, this._updateTitle));
+                                     this._updateTitle.bind(this));
         this._notifyMinimizedId =
             this._metaWindow.connect('notify::minimized',
-                                    Lang.bind(this, this._minimizedChanged));
+                                     this._minimizedChanged.bind(this));
         this._minimizedChanged();
     }
 
@@ -226,24 +225,24 @@ class BaseButton {
         this.actor._delegate = this;
 
         this.actor.connect('allocation-changed',
-                           Lang.bind(this, this._updateIconGeometry));
-        this.actor.connect('clicked', Lang.bind(this, this._onClicked));
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
-        this.actor.connect('popup-menu', Lang.bind(this, this._onPopupMenu));
+                           this._updateIconGeometry.bind(this));
+        this.actor.connect('clicked', this._onClicked.bind(this));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
+        this.actor.connect('popup-menu', this._onPopupMenu.bind(this));
 
         this._contextMenuManager = new PopupMenu.PopupMenuManager(this);
 
         this._switchWorkspaceId =
             global.window_manager.connect('switch-workspace',
-                                          Lang.bind(this, this._updateVisibility));
+                                          this._updateVisibility.bind(this));
 
         if (this._perMonitor) {
             this._windowEnteredMonitorId =
                 global.screen.connect('window-entered-monitor',
-                    Lang.bind(this, this._windowEnteredOrLeftMonitor));
+                    this._windowEnteredOrLeftMonitor.bind(this));
             this._windowLeftMonitorId =
                 global.screen.connect('window-left-monitor',
-                    Lang.bind(this, this._windowEnteredOrLeftMonitor));
+                    this._windowEnteredOrLeftMonitor.bind(this));
         }
     }
 
@@ -345,11 +344,11 @@ class WindowButton extends BaseButton {
 
         this._workspaceChangedId =
             this.metaWindow.connect('workspace-changed',
-                                    Lang.bind(this, this._updateVisibility));
+                                    this._updateVisibility.bind(this));
 
         this._notifyFocusId =
             global.display.connect('notify::focus-window',
-                                   Lang.bind(this, this._updateStyle));
+                                   this._updateStyle.bind(this));
         this._updateStyle();
     }
 
@@ -492,7 +491,7 @@ class AppButton extends BaseButton {
         this._menu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.BOTTOM);
         this._menu.connect('open-state-changed', _onMenuStateChanged);
         this._menu.actor.hide();
-        this._menu.connect('activate', Lang.bind(this, this._onMenuActivate));
+        this._menu.connect('activate', this._onMenuActivate.bind(this));
         this._menuManager.addMenu(this._menu);
         Main.uiGroup.add_actor(this._menu.actor);
 
@@ -509,13 +508,13 @@ class AppButton extends BaseButton {
 
         this._windowsChangedId =
             this.app.connect('windows-changed',
-                             Lang.bind(this, this._windowsChanged));
+                             this._windowsChanged.bind(this));
         this._windowsChanged();
 
         this._windowTracker = Shell.WindowTracker.get_default();
         this._notifyFocusId =
             this._windowTracker.connect('notify::focus-app',
-                                        Lang.bind(this, this._updateStyle));
+                                        this._updateStyle.bind(this));
         this._updateStyle();
     }
 
@@ -662,14 +661,18 @@ class WorkspaceIndicator extends PanelMenu.Button {
         this.workspacesItems = [];
 
         this._screenSignals = [];
-        this._screenSignals.push(global.screen.connect('notify::n-workspaces', 
Lang.bind(this,this._updateMenu)));
-        this._screenSignals.push(global.screen.connect_after('workspace-switched', 
Lang.bind(this,this._updateIndicator)));
+        this._screenSignals.push(global.screen.connect('notify::n-workspaces',
+                                                       this._updateMenu.bind(this)));
+        this._screenSignals.push(global.screen.connect_after('workspace-switched',
+                                                             this._updateIndicator.bind(this)));
 
-        this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
+        this.actor.connect('scroll-event', this._onScrollEvent.bind(this));
         this._updateMenu();
 
         this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.wm.preferences' });
-        this._settingsChangedId = this._settings.connect('changed::workspace-names', Lang.bind(this, 
this._updateMenu));
+        this._settingsChangedId =
+            this._settings.connect('changed::workspace-names',
+                                   this._updateMenu.bind(this));
     }
 
     destroy() {
@@ -761,7 +764,7 @@ class WindowList {
                                      reactive: true,
                                      track_hover: true,
                                      layout_manager: new Clutter.BinLayout()});
-        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+        this.actor.connect('destroy', this._onDestroy.bind(this));
 
         let box = new St.BoxLayout({ x_expand: true, y_expand: true });
         this.actor.add_actor(box);
@@ -780,7 +783,7 @@ class WindowList {
             let spacing = node.get_length('spacing');
             this._windowList.layout_manager.spacing = spacing;
         });
-        this._windowList.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
+        this._windowList.connect('scroll-event', this._onScrollEvent.bind(this));
 
         let indicatorsBox = new St.BoxLayout({ x_align: Clutter.ActorAlign.END });
         box.add(indicatorsBox);
@@ -792,11 +795,11 @@ class WindowList {
         this._workspaceSettings = this._getWorkspaceSettings();
         this._workspacesOnlyOnPrimaryChangedId =
             this._workspaceSettings.connect('changed::workspaces-only-on-primary',
-                                            Lang.bind(this, this._updateWorkspaceIndicatorVisibility));
+                                            this._updateWorkspaceIndicatorVisibility.bind(this));
         this._dynamicWorkspacesSettings = this._getDynamicWorkspacesSettings();
         this._dynamicWorkspacesChangedId =
             this._dynamicWorkspacesSettings.connect('changed::dynamic-workspaces',
-                                                    Lang.bind(this, 
this._updateWorkspaceIndicatorVisibility));
+                                                    this._updateWorkspaceIndicatorVisibility.bind(this));
         this._updateWorkspaceIndicatorVisibility();
 
         this._menuManager = new PopupMenu.PopupMenuManager(this);
@@ -808,13 +811,13 @@ class WindowList {
         Main.ctrlAltTabManager.addGroup(this.actor, _("Window List"), 'start-here-symbolic');
 
         this.actor.width = this._monitor.width;
-        this.actor.connect('notify::height', Lang.bind(this, this._updatePosition));
+        this.actor.connect('notify::height', this._updatePosition.bind(this));
         this._updatePosition();
 
         this._appSystem = Shell.AppSystem.get_default();
         this._appStateChangedId =
             this._appSystem.connect('app-state-changed',
-                                    Lang.bind(this, this._onAppStateChanged));
+                                    this._onAppStateChanged.bind(this));
 
         this._keyboardVisiblechangedId =
             Main.layoutManager.connect('keyboard-visible-changed',
@@ -833,12 +836,12 @@ class WindowList {
         this._workspaceSignals = new Map();
         this._nWorkspacesChangedId =
             global.screen.connect('notify::n-workspaces',
-                                  Lang.bind(this, this._onWorkspacesChanged));
+                                  this._onWorkspacesChanged.bind(this));
         this._onWorkspacesChanged();
 
         this._switchWorkspaceId =
             global.window_manager.connect('switch-workspace',
-                                          Lang.bind(this, this._checkGrouping));
+                                          this._checkGrouping.bind(this));
 
         this._overviewShowingId =
             Main.overview.connect('showing', () => {
@@ -859,12 +862,12 @@ class WindowList {
 
         this._dragBeginId =
             Main.xdndHandler.connect('drag-begin',
-                                     Lang.bind(this, this._onDragBegin));
+                                     this._onDragBegin.bind(this));
         this._dragEndId =
             Main.xdndHandler.connect('drag-end',
-                                     Lang.bind(this, this._onDragEnd));
+                                     this._onDragEnd.bind(this));
         this._dragMonitor = {
-            dragMotion: Lang.bind(this, this._onDragMotion)
+            dragMotion: this._onDragMotion.bind(this)
         };
 
         this._dndTimeoutId = 0;
@@ -873,7 +876,7 @@ class WindowList {
         this._settings = Convenience.getSettings();
         this._groupingModeChangedId =
             this._settings.connect('changed::grouping-mode',
-                                   Lang.bind(this, this._groupingModeChanged));
+                                   this._groupingModeChanged.bind(this));
         this._grouped = undefined;
         this._groupingModeChanged();
     }
@@ -1085,10 +1088,10 @@ class WindowList {
             let signals = { windowAddedId: 0, windowRemovedId: 0 };
             signals._windowAddedId =
                 workspace.connect_after('window-added',
-                                        Lang.bind(this, this._onWindowAdded));
+                                        this._onWindowAdded.bind(this));
             signals._windowRemovedId =
                 workspace.connect('window-removed',
-                                  Lang.bind(this, this._onWindowRemoved));
+                                  this._onWindowRemoved.bind(this));
             this._workspaceSignals.set(workspace, signals);
         }
 
@@ -1135,7 +1138,7 @@ class WindowList {
         this._dndWindow = hoveredWindow;
         this._dndTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
                                               DND_ACTIVATE_TIMEOUT,
-                                              Lang.bind(this, this._activateWindow));
+                                              this._activateWindow.bind(this));
 
         return DND.DragMotionResult.CONTINUE;
     }
@@ -1211,11 +1214,11 @@ class Extension {
         this._settings = Convenience.getSettings();
         this._showOnAllMonitorsChangedId =
             this._settings.connect('changed::show-on-all-monitors',
-                                   Lang.bind(this, this._buildWindowLists));
+                                   this._buildWindowLists.bind(this));
 
         this._monitorsChangedId =
             Main.layoutManager.connect('monitors-changed',
-                                       Lang.bind(this, this._buildWindowLists));
+                                       this._buildWindowLists.bind(this));
 
         this._buildWindowLists();
     }
diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js
index a2a0257..8c86f0f 100644
--- a/extensions/windowsNavigator/extension.js
+++ b/extensions/windowsNavigator/extension.js
@@ -1,6 +1,5 @@
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
 const Clutter = imports.gi.Clutter;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const St = imports.gi.St;
 
@@ -244,8 +243,10 @@ function enable() {
     workViewInjections['_init'] = injectToFunction(WorkspacesView.WorkspacesView.prototype, '_init', 
function(width, height, x, y, workspaces) {
         this._pickWorkspace = false;
         this._pickWindow = false;
-        this._keyPressEventId = global.stage.connect('key-press-event', Lang.bind(this, this._onKeyPress));
-        this._keyReleaseEventId = global.stage.connect('key-release-event', Lang.bind(this, 
this._onKeyRelease));
+        this._keyPressEventId =
+            global.stage.connect('key-press-event', this._onKeyPress.bind(this));
+        this._keyReleaseEventId =
+            global.stage.connect('key-release-event', this._onKeyRelease.bind(this));
         connectedSignals.push({ obj: global.stage, id: this._keyPressEventId });
         connectedSignals.push({ obj: global.stage, id: this._keyReleaseEventId });
     });
diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js
index 5aa8b12..ace1703 100644
--- a/extensions/workspace-indicator/extension.js
+++ b/extensions/workspace-indicator/extension.js
@@ -4,7 +4,6 @@ const Gio = imports.gi.Gio;
 const Meta = imports.gi.Meta;
 const Clutter = imports.gi.Clutter;
 const St = imports.gi.St;
-const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
@@ -37,18 +36,22 @@ class WorkspaceIndicator extends PanelMenu.Button {
         this.menu.addMenuItem(this._workspaceSection);
 
         this._screenSignals = [];
-        this._screenSignals.push(global.screen.connect_after('workspace-added', 
Lang.bind(this,this._createWorkspacesSection)));
-        this._screenSignals.push(global.screen.connect_after('workspace-removed', 
Lang.bind(this,this._createWorkspacesSection)));
-        this._screenSignals.push(global.screen.connect_after('workspace-switched', 
Lang.bind(this,this._updateIndicator)));
+        this._screenSignals.push(global.screen.connect_after('workspace-added',                              
                                this._createWorkspacesSection.bind(this)));
+        this._screenSignals.push(global.screen.connect_after('workspace-removed',
+                                                             this._createWorkspacesSection.bind(this)));
+        this._screenSignals.push(global.screen.connect_after('workspace-switched',
+                                                             this._updateIndicator.bind(this)));
 
-        this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
+        this.actor.connect('scroll-event', this._onScrollEvent.bind(this));
         this._createWorkspacesSection();
 
         //styling
         this.statusLabel.add_style_class_name('panel-workspace-indicator');
 
         this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA });
-        this._settingsChangedId = this._settings.connect('changed::' + WORKSPACE_KEY, Lang.bind(this, 
this._createWorkspacesSection));
+        this._settingsChangedId =
+            this._settings.connect('changed::' + WORKSPACE_KEY,
+                                   this._createWorkspacesSection.bind(this));
     }
 
     destroy() {
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index cfb6d8c..71416b3 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -4,7 +4,6 @@ const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
-const Lang = imports.lang;
 
 const Gettext = imports.gettext.domain('gnome-shell-extensions');
 const _ = Gettext.gettext;
@@ -28,15 +27,15 @@ class WorkspaceNameModel extends Gtk.ListStore {
         };
 
         this._settings = new Gio.Settings({ schema_id: WORKSPACE_SCHEMA });
-        //this._settings.connect('changed::workspace-names', Lang.bind(this, this._reloadFromSettings));
+        //this._settings.connect('changed::workspace-names', this._reloadFromSettings.bind(this));
 
         this._reloadFromSettings();
 
         // overriding class closure doesn't work, because GtkTreeModel
         // plays tricks with marshallers and class closures
-        this.connect('row-changed', Lang.bind(this, this._onRowChanged));
-        this.connect('row-inserted', Lang.bind(this, this._onRowInserted));
-        this.connect('row-deleted', Lang.bind(this, this._onRowDeleted));
+        this.connect('row-changed', this._onRowChanged.bind(this));
+        this.connect('row-inserted', this._onRowInserted.bind(this));
+        this.connect('row-deleted', this._onRowDeleted.bind(this));
     }
 
     _reloadFromSettings() {
@@ -150,7 +149,7 @@ class WorkspaceSettingsWidget extends Gtk.Grid {
 
         let column = new Gtk.TreeViewColumn({ title: _("Name") });
         let renderer = new Gtk.CellRendererText({ editable: true });
-        renderer.connect('edited', Lang.bind(this, this._cellEdited));
+        renderer.connect('edited', this._cellEdited.bind(this));
         column.pack_start(renderer, true);
         column.add_attribute(renderer, 'text', this._store.Columns.LABEL);
         this._treeView.append_column(column);
@@ -161,11 +160,11 @@ class WorkspaceSettingsWidget extends Gtk.Grid {
         toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR);
 
         let newButton = new Gtk.ToolButton({ icon_name: 'list-add-symbolic' });
-        newButton.connect('clicked', Lang.bind(this, this._newClicked));
+        newButton.connect('clicked', this._newClicked.bind(this));
         toolbar.add(newButton);
 
         let delButton = new Gtk.ToolButton({ icon_name: 'list-remove-symbolic' });
-        delButton.connect('clicked', Lang.bind(this, this._delClicked));
+        delButton.connect('clicked', this._delClicked.bind(this));
         toolbar.add(delButton);
 
         let selection = this._treeView.get_selection();


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