diff --git a/HACKING b/HACKING index 71b8d104a..575be5b7a 100644 --- a/HACKING +++ b/HACKING @@ -222,7 +222,7 @@ the actor itself: this.actor = new St.Button({ text: "This is a button" }); this.actor._delegate = this; - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); + this.actor.connect('clicked', this._onClicked.bind(this)); }, _onClicked(actor) { @@ -252,11 +252,13 @@ invoked, not to the value of this where the closure is created, because "this" is a keyword with a value passed in at function invocation time, it is not a variable that can be captured in closures. -All closures should be wrapped with a Lang.bind. +All closures should be wrapped with Function.prototype.bind or use arrow +notation. const Lang = imports.lang; - let closure = Lang.bind(this, function() { this._fnorbate(); }); + let closure1 = () => { this._fnorbate(); }; + let closure2 = this._fnorbate.bind(this); A more realistic example would be connecting to a signal on a method of a prototype: @@ -267,7 +269,7 @@ prototype: var MyClass = new Lang.Class({ _init() { let fnorb = new FnorbLib.Fnorb(); - fnorb.connect('frobate', Lang.bind(this, this._onFnorbFrobate)); + fnorb.connect('frobate', this._onFnorbFrobate.bind(this)); }, _onFnorbFrobate(fnorb) { diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js index 97cac6728..a30b46b30 100644 --- a/js/extensionPrefs/main.js +++ b/js/extensionPrefs/main.js @@ -41,9 +41,9 @@ var Application = new Lang.Class({ flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE }); - this.application.connect('activate', Lang.bind(this, this._onActivate)); - this.application.connect('command-line', Lang.bind(this, this._onCommandLine)); - this.application.connect('startup', Lang.bind(this, this._onStartup)); + this.application.connect('activate', this._onActivate.bind(this)); + this.application.connect('command-line', this._onCommandLine.bind(this)); + this.application.connect('startup', this._onStartup.bind(this)); this._extensionPrefsModules = {}; @@ -162,8 +162,8 @@ var Application = new Lang.Class({ this._window.add(scroll); this._extensionSelector = new Gtk.ListBox({ selection_mode: Gtk.SelectionMode.NONE }); - this._extensionSelector.set_sort_func(Lang.bind(this, this._sortList)); - this._extensionSelector.set_header_func(Lang.bind(this, this._updateHeader)); + this._extensionSelector.set_sort_func(this._sortList.bind(this)); + this._extensionSelector.set_header_func(this._updateHeader.bind(this)); scroll.add(this._extensionSelector); @@ -193,7 +193,7 @@ var Application = new Lang.Class({ _scanExtensions() { let finder = new ExtensionUtils.ExtensionFinder(); - finder.connect('extension-found', Lang.bind(this, this._extensionFound)); + finder.connect('extension-found', this._extensionFound.bind(this)); finder.scanExtensions(); this._extensionsLoaded(); }, diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 45b8efe02..481cd3a77 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -55,13 +55,13 @@ var AuthPrompt = new Lang.Class({ this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, { reauthenticationOnly: reauthenticationOnly }); - this._userVerifier.connect('ask-question', Lang.bind(this, this._onAskQuestion)); - this._userVerifier.connect('show-message', Lang.bind(this, this._onShowMessage)); - this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed)); - this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete)); - this._userVerifier.connect('reset', Lang.bind(this, this._onReset)); - this._userVerifier.connect('smartcard-status-changed', Lang.bind(this, this._onSmartcardStatusChanged)); - this._userVerifier.connect('ovirt-user-authenticated', Lang.bind(this, this._onOVirtUserAuthenticated)); + this._userVerifier.connect('ask-question', this._onAskQuestion.bind(this)); + this._userVerifier.connect('show-message', this._onShowMessage.bind(this)); + this._userVerifier.connect('verification-failed', this._onVerificationFailed.bind(this)); + this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this)); + this._userVerifier.connect('reset', this._onReset.bind(this)); + this._userVerifier.connect('smartcard-status-changed', this._onSmartcardStatusChanged.bind(this)); + this._userVerifier.connect('ovirt-user-authenticated', this._onOVirtUserAuthenticated.bind(this)); this.smartcardDetected = this._userVerifier.smartcardDetected; this.connect('next', () => { @@ -76,7 +76,7 @@ var AuthPrompt = new Lang.Class({ this.actor = new St.BoxLayout({ style_class: 'login-dialog-prompt-layout', vertical: true }); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('key-press-event', (actor, event) => { if (event.get_key_symbol() == Clutter.KEY_Escape) this.cancel(); diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 290bf7408..4a93545af 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -57,7 +57,7 @@ var UserListItem = new Lang.Class({ _init(user) { this.user = user; this._userChangedId = this.user.connect('changed', - Lang.bind(this, this._onUserChanged)); + this._onUserChanged.bind(this)); let layout = new St.BoxLayout({ vertical: true }); this.actor = new St.Button({ style_class: 'login-dialog-user-list-item', @@ -67,8 +67,7 @@ var UserListItem = new Lang.Class({ reactive: true, x_align: St.Align.START, x_fill: true }); - this.actor.connect('destroy', - Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('key-focus-in', () => { this._setSelected(true); @@ -90,7 +89,7 @@ var UserListItem = new Lang.Class({ scale_x: 0 }); layout.add(this._timedLoginIndicator); - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); + this.actor.connect('clicked', this._onClicked.bind(this)); this._onUserChanged(); }, @@ -173,7 +172,7 @@ var UserList = new Lang.Class({ this.actor.add_actor(this._box); this._items = {}; - this.actor.connect('key-focus-in', Lang.bind(this, this._moveFocusToItems)); + this.actor.connect('key-focus-in', this._moveFocusToItems.bind(this)); }, _moveFocusToItems() { @@ -270,8 +269,7 @@ var UserList = new Lang.Class({ this._items[userName] = item; - item.connect('activate', - Lang.bind(this, this._onItemActivated)); + item.connect('activate', this._onItemActivated.bind(this)); // Try to keep the focused item front-and-center item.actor.connect('key-focus-in', () => { this.scrollToItem(item); }); @@ -413,8 +411,8 @@ var LoginDialog = new Lang.Class({ this.actor.get_accessible().set_role(Atk.Role.WINDOW); this.actor.add_constraint(new Layout.MonitorConstraint({ primary: true })); - this.actor.connect('allocate', Lang.bind(this, this._onAllocate)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('allocate', this._onAllocate.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); parentActor.add_child(this.actor); this._userManager = AccountsService.UserManager.get_default() @@ -423,17 +421,17 @@ var LoginDialog = new Lang.Class({ this._settings = new Gio.Settings({ schema_id: GdmUtil.LOGIN_SCREEN_SCHEMA }); this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_KEY, - Lang.bind(this, this._updateBanner)); + this._updateBanner.bind(this)); this._settings.connect('changed::' + GdmUtil.BANNER_MESSAGE_TEXT_KEY, - Lang.bind(this, this._updateBanner)); + this._updateBanner.bind(this)); this._settings.connect('changed::' + GdmUtil.DISABLE_USER_LIST_KEY, - Lang.bind(this, this._updateDisableUserList)); + this._updateDisableUserList.bind(this)); this._settings.connect('changed::' + GdmUtil.LOGO_KEY, - Lang.bind(this, this._updateLogo)); + this._updateLogo.bind(this)); this._textureCache = St.TextureCache.get_default(); this._updateLogoTextureId = this._textureCache.connect('texture-file-changed', - Lang.bind(this, this._updateLogoTexture)); + this._updateLogoTexture.bind(this)); this._userSelectionBox = new St.BoxLayout({ style_class: 'login-dialog-user-selection-box', x_align: Clutter.ActorAlign.CENTER, @@ -449,8 +447,8 @@ var LoginDialog = new Lang.Class({ y_fill: true }); this._authPrompt = new AuthPrompt.AuthPrompt(this._gdmClient, AuthPrompt.AuthPromptMode.UNLOCK_OR_LOG_IN); - this._authPrompt.connect('prompted', Lang.bind(this, this._onPrompted)); - this._authPrompt.connect('reset', Lang.bind(this, this._onReset)); + this._authPrompt.connect('prompted', this._onPrompted.bind(this)); + this._authPrompt.connect('reset', this._onReset.bind(this)); this._authPrompt.hide(); this.actor.add_child(this._authPrompt.actor); @@ -467,7 +465,7 @@ var LoginDialog = new Lang.Class({ x_align: St.Align.START, x_fill: true }); - this._notListedButton.connect('clicked', Lang.bind(this, this._hideUserListAskForUsernameAndBeginVerification)); + this._notListedButton.connect('clicked', this._hideUserListAskForUsernameAndBeginVerification.bind(this)); this._notListedButton.hide(); @@ -517,15 +515,15 @@ var LoginDialog = new Lang.Class({ this._realmManager = new Realmd.Manager(); this._realmSignalId = this._realmManager.connect('login-format-changed', - Lang.bind(this, this._showRealmLoginHint)); + this._showRealmLoginHint.bind(this)); - LoginManager.getLoginManager().getCurrentSessionProxy(Lang.bind(this, this._gotGreeterSessionProxy)); + LoginManager.getLoginManager().getCurrentSessionProxy(this._gotGreeterSessionProxy.bind(this)); // If the user list is enabled, it should take key focus; make sure the // screen shield is initialized first to prevent it from stealing the // focus later this._startupCompleteId = Main.layoutManager.connect('startup-complete', - Lang.bind(this, this._updateDisableUserList)); + this._updateDisableUserList.bind(this)); }, _getBannerAllocation(dialogBox) { @@ -723,7 +721,7 @@ var LoginDialog = new Lang.Class({ } }); } else { - let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, Lang.bind(this, this._loadUserList)); + let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, this._loadUserList.bind(this)); GLib.Source.set_name_by_id(id, '[gnome-shell] _loadUserList'); } }, @@ -820,11 +818,11 @@ var LoginDialog = new Lang.Class({ this._greeter = this._gdmClient.get_greeter_sync(null); this._defaultSessionChangedId = this._greeter.connect('default-session-name-changed', - Lang.bind(this, this._onDefaultSessionChanged)); + this._onDefaultSessionChanged.bind(this)); this._sessionOpenedId = this._greeter.connect('session-opened', - Lang.bind(this, this._onSessionOpened)); + this._onSessionOpened.bind(this)); this._timedLoginRequestedId = this._greeter.connect('timed-login-requested', - Lang.bind(this, this._onTimedLoginRequested)); + this._onTimedLoginRequested.bind(this)); } }, diff --git a/js/gdm/oVirt.js b/js/gdm/oVirt.js index 21a18023d..8a6a545ec 100644 --- a/js/gdm/oVirt.js +++ b/js/gdm/oVirt.js @@ -34,7 +34,7 @@ var OVirtCredentialsManager = new Lang.Class({ this._credentials = new OVirtCredentials(); this._credentials.connectSignal('UserAuthenticated', - Lang.bind(this, this._onUserAuthenticated)); + this._onUserAuthenticated.bind(this)); }, _onUserAuthenticated(proxy, sender, [token]) { diff --git a/js/gdm/realmd.js b/js/gdm/realmd.js index d7fe864f9..9aa27d928 100644 --- a/js/gdm/realmd.js +++ b/js/gdm/realmd.js @@ -66,7 +66,7 @@ var Manager = new Lang.Class({ this._aggregateProvider = Provider(Gio.DBus.system, 'org.freedesktop.realmd', '/org/freedesktop/realmd', - Lang.bind(this, this._reloadRealms)) + this._reloadRealms.bind(this)) this._realms = {}; this._signalId = this._aggregateProvider.connect('g-properties-changed', @@ -86,7 +86,7 @@ var Manager = new Lang.Class({ let realm = Realm(Gio.DBus.system, 'org.freedesktop.realmd', realmPaths[i], - Lang.bind(this, this._onRealmLoaded)); + this._onRealmLoaded.bind(this)); } }, diff --git a/js/gdm/util.js b/js/gdm/util.js index edae04622..261e1e433 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -133,7 +133,7 @@ var ShellUserVerifier = new Lang.Class({ this._settings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA }); this._settings.connect('changed', - Lang.bind(this, this._updateDefaultService)); + this._updateDefaultService.bind(this)); this._updateDefaultService(); this._fprintManager = Fprint.FprintManager(); @@ -147,9 +147,9 @@ var ShellUserVerifier = new Lang.Class({ this._checkForSmartcard(); this._smartcardInsertedId = this._smartcardManager.connect('smartcard-inserted', - Lang.bind(this, this._checkForSmartcard)); + this._checkForSmartcard.bind(this)); this._smartcardRemovedId = this._smartcardManager.connect('smartcard-removed', - Lang.bind(this, this._checkForSmartcard)); + this._checkForSmartcard.bind(this)); this._messageQueue = []; this._messageQueueTimeoutId = 0; @@ -164,7 +164,7 @@ var ShellUserVerifier = new Lang.Class({ this._oVirtUserAuthenticated(this._oVirtCredentialsManager.getToken()); this._oVirtUserAuthenticatedId = this._oVirtCredentialsManager.connect('user-authenticated', - Lang.bind(this, this._oVirtUserAuthenticated)); + this._oVirtUserAuthenticated.bind(this)); }, begin(userName, hold) { @@ -179,9 +179,9 @@ var ShellUserVerifier = new Lang.Class({ // If possible, reauthenticate an already running session, // so any session specific credentials get updated appropriately this._client.open_reauthentication_channel(userName, this._cancellable, - Lang.bind(this, this._reauthenticationChannelOpened)); + this._reauthenticationChannelOpened.bind(this)); } else { - this._client.get_user_verifier(this._cancellable, Lang.bind(this, this._userVerifierGot)); + this._client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this)); } }, @@ -357,7 +357,7 @@ var ShellUserVerifier = new Lang.Class({ // Gdm emits org.freedesktop.DBus.Error.AccessDenied when there is // no session to reauthenticate. Fall back to performing verification // from this login session - client.get_user_verifier(this._cancellable, Lang.bind(this, this._userVerifierGot)); + client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this)); return; } catch(e) { this._reportInitError('Failed to open reauthentication channel', e); @@ -387,13 +387,13 @@ var ShellUserVerifier = new Lang.Class({ }, _connectSignals() { - this._userVerifier.connect('info', Lang.bind(this, this._onInfo)); - this._userVerifier.connect('problem', Lang.bind(this, this._onProblem)); - this._userVerifier.connect('info-query', Lang.bind(this, this._onInfoQuery)); - this._userVerifier.connect('secret-info-query', Lang.bind(this, this._onSecretInfoQuery)); - this._userVerifier.connect('conversation-stopped', Lang.bind(this, this._onConversationStopped)); - this._userVerifier.connect('reset', Lang.bind(this, this._onReset)); - this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete)); + this._userVerifier.connect('info', this._onInfo.bind(this)); + this._userVerifier.connect('problem', this._onProblem.bind(this)); + this._userVerifier.connect('info-query', this._onInfoQuery.bind(this)); + this._userVerifier.connect('secret-info-query', this._onSecretInfoQuery.bind(this)); + this._userVerifier.connect('conversation-stopped', this._onConversationStopped.bind(this)); + this._userVerifier.connect('reset', this._onReset.bind(this)); + this._userVerifier.connect('verification-complete', this._onVerificationComplete.bind(this)); }, _getForegroundService() { diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js index 84d14560c..9f77b4c40 100644 --- a/js/misc/extensionUtils.js +++ b/js/misc/extensionUtils.js @@ -186,7 +186,9 @@ var ExtensionFinder = new Lang.Class({ scanExtensions() { let perUserDir = Gio.File.new_for_path(global.userdatadir); - FileUtils.collectFromDatadirs('extensions', true, Lang.bind(this, this._loadExtension, perUserDir)); + FileUtils.collectFromDatadirs('extensions', true, (dir, info) => { + this._loadExtension(dir, info, perUserDir); + }); } }); Signals.addSignalMethods(ExtensionFinder.prototype); diff --git a/js/misc/history.js b/js/misc/history.js index 5ecab8290..693e6de1c 100644 --- a/js/misc/history.js +++ b/js/misc/history.js @@ -22,7 +22,7 @@ var HistoryManager = new Lang.Class({ if (this._key) { this._history = global.settings.get_strv(this._key); global.settings.connect('changed::' + this._key, - Lang.bind(this, this._historyChanged)); + this._historyChanged.bind(this)); } else { this._history = []; @@ -32,7 +32,7 @@ var HistoryManager = new Lang.Class({ if (this._entry) { this._entry.connect('key-press-event', - Lang.bind(this, this._onEntryKeyPress)); + this._onEntryKeyPress.bind(this)); } }, diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index de8cd5b13..782b9ad28 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -53,11 +53,11 @@ var IBusManager = new Lang.Class({ this._preloadEnginesId = 0; this._ibus = IBus.Bus.new_async(); - this._ibus.connect('connected', Lang.bind(this, this._onConnected)); - this._ibus.connect('disconnected', Lang.bind(this, this._clear)); + this._ibus.connect('connected', this._onConnected.bind(this)); + this._ibus.connect('disconnected', this._clear.bind(this)); // Need to set this to get 'global-engine-changed' emitions this._ibus.set_watch_ibus_signal(true); - this._ibus.connect('global-engine-changed', Lang.bind(this, this._engineChanged)); + this._ibus.connect('global-engine-changed', this._engineChanged.bind(this)); this._spawn(); }, @@ -88,11 +88,11 @@ var IBusManager = new Lang.Class({ }, _onConnected() { - this._ibus.list_engines_async(-1, null, Lang.bind(this, this._initEngines)); + this._ibus.list_engines_async(-1, null, this._initEngines.bind(this)); this._ibus.request_name_async(IBus.SERVICE_PANEL, IBus.BusNameFlag.REPLACE_EXISTING, -1, null, - Lang.bind(this, this._initPanelService)); + this._initPanelService.bind(this)); }, _initEngines(ibus, result) { @@ -114,7 +114,7 @@ var IBusManager = new Lang.Class({ this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(), object_path: IBus.PATH_PANEL }); this._candidatePopup.setPanelService(this._panelService); - this._panelService.connect('update-property', Lang.bind(this, this._updateProperty)); + this._panelService.connect('update-property', this._updateProperty.bind(this)); try { // IBus versions older than 1.5.10 have a bug which // causes spurious set-content-type emissions when @@ -122,7 +122,7 @@ var IBusManager = new Lang.Class({ // and hints defeating its intended semantics and // confusing users. We thus don't use it in that case. _checkIBusVersion(1, 5, 10); - this._panelService.connect('set-content-type', Lang.bind(this, this._setContentType)); + this._panelService.connect('set-content-type', this._setContentType.bind(this)); } catch (e) { } // If an engine is already active we need to get its properties diff --git a/js/misc/inputMethod.js b/js/misc/inputMethod.js index caf63826b..addc20f4e 100644 --- a/js/misc/inputMethod.js +++ b/js/misc/inputMethod.js @@ -16,13 +16,13 @@ var InputMethod = new Lang.Class({ this._enabled = true; this._currentFocus = null; this._ibus = IBus.Bus.new_async(); - this._ibus.connect('connected', Lang.bind(this, this._onConnected)); - this._ibus.connect('disconnected', Lang.bind(this, this._clear)); - this.connect('notify::can-show-preedit', Lang.bind(this, this._updateCapabilities)); + this._ibus.connect('connected', this._onConnected.bind(this)); + this._ibus.connect('disconnected', this._clear.bind(this)); + this.connect('notify::can-show-preedit', this._updateCapabilities.bind(this)); this._inputSourceManager = Keyboard.getInputSourceManager(); this._sourceChangedId = this._inputSourceManager.connect('current-source-changed', - Lang.bind(this, this._onSourceChanged)); + this._onSourceChanged.bind(this)); this._currentSource = this._inputSourceManager.currentSource; if (this._ibus.is_connected()) @@ -54,16 +54,16 @@ var InputMethod = new Lang.Class({ _onConnected() { this._ibus.create_input_context_async ('gnome-shell', -1, null, - Lang.bind(this, this._setContext)); + this._setContext.bind(this)); }, _setContext(bus, res) { this._context = this._ibus.create_input_context_async_finish(res); this._context.connect('enabled', () => { this._enabled = true }); this._context.connect('disabled', () => { this._enabled = false }); - this._context.connect('commit-text', Lang.bind(this, this._onCommitText)); - this._context.connect('delete-surrounding-text', Lang.bind(this, this._onDeleteSurroundingText)); - this._context.connect('update-preedit-text', Lang.bind(this, this._onUpdatePreeditText)); + this._context.connect('commit-text', this._onCommitText.bind(this)); + this._context.connect('delete-surrounding-text', this._onDeleteSurroundingText.bind(this)); + this._context.connect('update-preedit-text', this._onUpdatePreeditText.bind(this)); this._updateCapabilities(); }, diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index f99965615..4eb0686aa 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -110,7 +110,7 @@ var LoginManagerSystemd = new Lang.Class({ 'org.freedesktop.login1', '/org/freedesktop/login1'); this._proxy.connectSignal('PrepareForSleep', - Lang.bind(this, this._prepareForSleep)); + this._prepareForSleep.bind(this)); }, getCurrentSessionProxy(callback) { diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js index 217e138e0..1ce4f8342 100644 --- a/js/misc/objectManager.js +++ b/js/misc/objectManager.js @@ -61,7 +61,7 @@ var ObjectManager = new Lang.Class({ this._numLoadInhibitors = 1; this._managerProxy.init_async(GLib.PRIORITY_DEFAULT, this._cancellable, - Lang.bind(this, this._onManagerProxyLoaded)); + this._onManagerProxyLoaded.bind(this)); }, _tryToCompleteLoad() { @@ -226,7 +226,7 @@ var ObjectManager = new Lang.Class({ this._numLoadInhibitors++; this._addInterface(objectPath, interfaceName, - Lang.bind(this, this._tryToCompleteLoad)); + this._tryToCompleteLoad.bind(this)); } } this._tryToCompleteLoad(); diff --git a/js/misc/smartcardManager.js b/js/misc/smartcardManager.js index 256b5145c..60808b371 100644 --- a/js/misc/smartcardManager.js +++ b/js/misc/smartcardManager.js @@ -32,7 +32,7 @@ var SmartcardManager = new Lang.Class({ name: "org.gnome.SettingsDaemon.Smartcard", objectPath: '/org/gnome/SettingsDaemon/Smartcard', knownInterfaces: [ SmartcardTokenIface ], - onLoaded: Lang.bind(this, this._onLoaded) }); + onLoaded: this._onLoaded.bind(this) }); this._insertedTokens = {}; this._loginToken = null; }, diff --git a/js/misc/util.js b/js/misc/util.js index 4395ab6b7..1d73d2076 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -369,7 +369,7 @@ var CloseButton = new Lang.Class({ this._boxPointer = boxpointer; if (boxpointer) - this._boxPointer.connect('arrow-side-changed', Lang.bind(this, this._sync)); + this._boxPointer.connect('arrow-side-changed', this._sync.bind(this)); }, _computeBoxPointerOffset() { @@ -452,7 +452,7 @@ var AppSettingsMonitor = new Lang.Class({ this._appSystem = Shell.AppSystem.get_default(); this._appSystem.connect('installed-changed', - Lang.bind(this, this._onInstalledChanged)); + this._onInstalledChanged.bind(this)); this._onInstalledChanged(); }, diff --git a/js/misc/weather.js b/js/misc/weather.js index 4bdce937a..398f1fd52 100644 --- a/js/misc/weather.js +++ b/js/misc/weather.js @@ -46,11 +46,11 @@ var WeatherClient = new Lang.Class({ }); }); this._permStore.connectSignal('Changed', - Lang.bind(this, this._onPermStoreChanged)); + this._onPermStoreChanged.bind(this)); this._locationSettings = new Gio.Settings({ schema_id: 'org.gnome.system.location' }); this._locationSettings.connect('changed::enabled', - Lang.bind(this, this._updateAutoLocation)); + this._updateAutoLocation.bind(this)); this._world = GWeather.Location.get_world(); @@ -68,9 +68,9 @@ var WeatherClient = new Lang.Class({ 'org.gnome.Weather.Application'); this._weatherAppMon.connect('available-changed', () => { this.emit('changed'); }); this._weatherAppMon.watchSetting('automatic-location', - Lang.bind(this, this._onAutomaticLocationChanged)); + this._onAutomaticLocationChanged.bind(this)); this._weatherAppMon.watchSetting('locations', - Lang.bind(this, this._onLocationsChanged)); + this._onLocationsChanged.bind(this)); }, get available() { @@ -157,7 +157,7 @@ var WeatherClient = new Lang.Class({ this._gclueLocationChangedId = this._gclueService.connect('notify::location', - Lang.bind(this, this._onGClueLocationChanged)); + this._onGClueLocationChanged.bind(this)); this._onGClueLocationChanged(); } else { if (this._gclueLocationChangedId) diff --git a/js/portalHelper/main.js b/js/portalHelper/main.js index df6424f62..838af46e9 100644 --- a/js/portalHelper/main.js +++ b/js/portalHelper/main.js @@ -122,7 +122,7 @@ var PortalWindow = new Lang.Class({ _init(application, url, timestamp, doneCallback) { this.parent({ application: application }); - this.connect('delete-event', Lang.bind(this, this.destroyWindow)); + this.connect('delete-event', this.destroyWindow.bind(this)); this._headerBar = new PortalHeaderBar(); this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.NOT_YET_DETERMINED); this.set_titlebar(this._headerBar); @@ -146,12 +146,12 @@ var PortalWindow = new Lang.Class({ this._webContext.set_network_proxy_settings(WebKit.NetworkProxyMode.NO_PROXY, null); this._webView = WebKit.WebView.new_with_context(this._webContext); - this._webView.connect('decide-policy', Lang.bind(this, this._onDecidePolicy)); - this._webView.connect('load-changed', Lang.bind(this, this._onLoadChanged)); - this._webView.connect('insecure-content-detected', Lang.bind(this, this._onInsecureContentDetected)); - this._webView.connect('load-failed-with-tls-errors', Lang.bind(this, this._onLoadFailedWithTlsErrors)); + this._webView.connect('decide-policy', this._onDecidePolicy.bind(this)); + this._webView.connect('load-changed', this._onLoadChanged.bind(this)); + this._webView.connect('insecure-content-detected', this._onInsecureContentDetected.bind(this)); + this._webView.connect('load-failed-with-tls-errors', this._onLoadFailedWithTlsErrors.bind(this)); this._webView.load_uri(url); - this._webView.connect('notify::uri', Lang.bind(this, this._syncUri)); + this._webView.connect('notify::uri', this._syncUri.bind(this)); this._syncUri(); this.add(this._webView); diff --git a/js/ui/altTab.js b/js/ui/altTab.js index 8880196c1..97dddce5b 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -353,7 +353,7 @@ var AppSwitcherPopup = new Lang.Class({ !forceAppFocus) { this._thumbnailTimeoutId = Mainloop.timeout_add ( THUMBNAIL_POPUP_TIME, - Lang.bind(this, this._timeoutPopupThumbnails)); + this._timeoutPopupThumbnails.bind(this)); GLib.Source.set_name_by_id(this._thumbnailTimeoutId, '[gnome-shell] this._timeoutPopupThumbnails'); } }, @@ -384,9 +384,9 @@ var AppSwitcherPopup = new Lang.Class({ _createThumbnails() { this._thumbnails = new ThumbnailList (this._items[this._selectedIndex].cachedWindows); - this._thumbnails.connect('item-activated', Lang.bind(this, this._windowActivated)); - this._thumbnails.connect('item-entered', Lang.bind(this, this._windowEntered)); - this._thumbnails.connect('item-removed', Lang.bind(this, this._windowRemoved)); + this._thumbnails.connect('item-activated', this._windowActivated.bind(this)); + this._thumbnails.connect('item-entered', this._windowEntered.bind(this)); + this._thumbnails.connect('item-removed', this._windowRemoved.bind(this)); this._thumbnails.actor.connect('destroy', () => { this._thumbnails = null; this._thumbnailsFocused = false; @@ -431,8 +431,8 @@ var CyclerHighlight = new Lang.Class({ this.actor.add_constraint(constraint); this.actor.connect('notify::allocation', - Lang.bind(this, this._onAllocationChanged)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this._onAllocationChanged.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); }, set window(w) { @@ -490,7 +490,7 @@ var CyclerPopup = new Lang.Class({ // We don't show an actual popup, so just provide what SwitcherPopup // expects instead of inheriting from SwitcherList this._switcherList = { actor: new St.Widget(), - highlight: Lang.bind(this, this._highlightItem), + highlight: this._highlightItem.bind(this), connect() {} }; }, @@ -690,7 +690,7 @@ var AppSwitcher = new Lang.Class({ this._altTabPopup = altTabPopup; this._mouseTimeOutId = 0; - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); }, _onDestroy() { @@ -912,7 +912,9 @@ var ThumbnailList = new Lang.Class({ this._thumbnailBins[i].set_height(binHeight); this._thumbnailBins[i].add_actor(clone); - clone._destroyId = mutterWindow.connect('destroy', Lang.bind(this, this._removeThumbnail, clone)); + clone._destroyId = mutterWindow.connect('destroy', source => { + this._removeThumbnail(source, clone); + }); this._clones.push(clone); } diff --git a/js/ui/animation.js b/js/ui/animation.js index 5c1c41b46..fbd2cafdf 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -14,7 +14,7 @@ var Animation = new Lang.Class({ _init(file, width, height, speed) { this.actor = new St.Bin(); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._speed = speed; this._isLoaded = false; @@ -24,7 +24,7 @@ var Animation = new Lang.Class({ let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; this._animations = St.TextureCache.get_default().load_sliced_image (file, width, height, scaleFactor, - Lang.bind(this, this._animationsLoaded)); + this._animationsLoaded.bind(this)); this.actor.set_child(this._animations); }, @@ -33,7 +33,7 @@ var Animation = new Lang.Class({ if (this._frame == 0) this._showFrame(0); - this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, Lang.bind(this, this._update)); + this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, this._update.bind(this)); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._update'); } diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 50bc69916..74c772d50 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -390,7 +390,7 @@ var AllView = new Lang.Class({ (indicators, pageIndex) => { this.goToPage(pageIndex); }); - this._pageIndicators.actor.connect('scroll-event', Lang.bind(this, this._onScroll)); + this._pageIndicators.actor.connect('scroll-event', this._onScroll.bind(this)); this.actor.add_actor(this._pageIndicators.actor); this.folderIcons = []; @@ -406,12 +406,12 @@ var AllView = new Lang.Class({ box.add_actor(this._stack); this._scrollView.add_actor(box); - this._scrollView.connect('scroll-event', Lang.bind(this, this._onScroll)); + this._scrollView.connect('scroll-event', this._onScroll.bind(this)); let panAction = new Clutter.PanAction({ interpolate: false }); - panAction.connect('pan', Lang.bind(this, this._onPan)); - panAction.connect('gesture-cancel', Lang.bind(this, this._onPanEnd)); - panAction.connect('gesture-end', Lang.bind(this, this._onPanEnd)); + panAction.connect('pan', this._onPan.bind(this)); + panAction.connect('gesture-cancel', this._onPanEnd.bind(this)); + panAction.connect('gesture-end', this._onPanEnd.bind(this)); this._panAction = panAction; this._scrollView.add_action(panAction); this._panning = false; @@ -448,7 +448,7 @@ var AllView = new Lang.Class({ if (this.actor.mapped) { this._keyPressEventId = global.stage.connect('key-press-event', - Lang.bind(this, this._onKeyPressEvent)); + this._onKeyPressEvent.bind(this)); } else { if (this._keyPressEventId) global.stage.disconnect(this._keyPressEventId); @@ -456,7 +456,7 @@ var AllView = new Lang.Class({ } }); - this._redisplayWorkId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay)); + this._redisplayWorkId = Main.initializeDeferredWork(this.actor, this._redisplay.bind(this)); Shell.AppSystem.get_default().connect('installed-changed', () => { Main.queueDeferredWork(this._redisplayWorkId); @@ -514,8 +514,8 @@ var AllView = new Lang.Class({ folders.forEach(id => { let path = this._folderSettings.path + 'folders/' + id + '/'; let icon = new FolderIcon(id, path, this); - icon.connect('name-changed', Lang.bind(this, this._itemNameChanged)); - icon.connect('apps-changed', Lang.bind(this, this._refilterApps)); + icon.connect('name-changed', this._itemNameChanged.bind(this)); + icon.connect('apps-changed', this._refilterApps.bind(this)); this.addItem(icon); this.folderIcons.push(icon); }); @@ -905,7 +905,7 @@ var AppDisplay = new Lang.Class({ _init() { this._privacySettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.privacy' }); this._privacySettings.connect('changed::remember-app-usage', - Lang.bind(this, this._updateFrequentVisibility)); + this._updateFrequentVisibility.bind(this)); this._views = []; @@ -930,7 +930,7 @@ var AppDisplay = new Lang.Class({ this._viewStackLayout = new ViewStackLayout(); this._viewStack = new St.Widget({ x_expand: true, y_expand: true, layout_manager: this._viewStackLayout }); - this._viewStackLayout.connect('allocated-size-changed', Lang.bind(this, this._onAllocatedSizeChanged)); + this._viewStackLayout.connect('allocated-size-changed', this._onAllocatedSizeChanged.bind(this)); this.actor.add_actor(this._viewStack); let layout = new ControlsBoxLayout({ homogeneous: true }); this._controls = new St.Widget({ style_class: 'app-view-controls', @@ -970,7 +970,7 @@ var AppDisplay = new Lang.Class({ Gio.DBus.system.watch_name(SWITCHEROO_BUS_NAME, Gio.BusNameWatcherFlags.NONE, - Lang.bind(this, this._switcherooProxyAppeared), + this._switcherooProxyAppeared.bind(this), () => { this._switcherooProxy = null; this._updateDiscreteGpuAvailable(); @@ -1153,7 +1153,7 @@ var FolderView = new Lang.Class({ this.actor.add_actor(scrollableContainer); let action = new Clutter.PanAction({ interpolate: true }); - action.connect('pan', Lang.bind(this, this._onPan)); + action.connect('pan', this._onPan.bind(this)); this.actor.add_action(action); }, @@ -1269,7 +1269,7 @@ var FolderIcon = new Lang.Class({ // whether we need to update arrow side, position etc. this._popupInvalidated = false; - this.icon = new IconGrid.BaseIcon('', { createIcon: Lang.bind(this, this._createIcon), setSizeManually: true }); + this.icon = new IconGrid.BaseIcon('', { createIcon: this._createIcon.bind(this), setSizeManually: true }); this.actor.set_child(this.icon.actor); this.actor.label_actor = this.icon.label; @@ -1285,7 +1285,7 @@ var FolderIcon = new Lang.Class({ this._popup.popdown(); }); - this._folder.connect('changed', Lang.bind(this, this._redisplay)); + this._folder.connect('changed', this._redisplay.bind(this)); this._redisplay(); }, @@ -1456,7 +1456,7 @@ var AppFolderPopup = new Lang.Class({ this._boxPointer.bin.set_child(this._view.actor); this.closeButton = Util.makeCloseButton(this._boxPointer); - this.closeButton.connect('clicked', Lang.bind(this, this.popdown)); + this.closeButton.connect('clicked', this.popdown.bind(this)); this.actor.add_actor(this.closeButton); this._boxPointer.actor.bind_property('opacity', this.closeButton, 'opacity', @@ -1467,7 +1467,7 @@ var AppFolderPopup = new Lang.Class({ source.actor.connect('destroy', () => { this.actor.destroy(); }); this._grabHelper = new GrabHelper.GrabHelper(this.actor); this._grabHelper.addActor(Main.layoutManager.overviewGroup); - this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress)); + this.actor.connect('key-press-event', this._onKeyPress.bind(this)); }, _onKeyPress(actor, event) { @@ -1526,7 +1526,7 @@ var AppFolderPopup = new Lang.Class({ return; this._isOpen = this._grabHelper.grab({ actor: this.actor, - onUngrab: Lang.bind(this, this.popdown) }); + onUngrab: this.popdown.bind(this) }); if (!this._isOpen) return; @@ -1615,18 +1615,18 @@ var AppIcon = new Lang.Class({ let isDraggable = appIconParams['isDraggable']; delete iconParams['isDraggable']; - iconParams['createIcon'] = Lang.bind(this, this._createIcon); + iconParams['createIcon'] = this._createIcon.bind(this); iconParams['setSizeManually'] = true; this.icon = new IconGrid.BaseIcon(app.get_name(), iconParams); this._iconContainer.add_child(this.icon.actor); this.actor.label_actor = this.icon.label; - this.actor.connect('leave-event', Lang.bind(this, this._onLeaveEvent)); - this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); - this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent)); - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); - this.actor.connect('popup-menu', Lang.bind(this, this._onKeyboardPopupMenu)); + this.actor.connect('leave-event', this._onLeaveEvent.bind(this)); + this.actor.connect('button-press-event', this._onButtonPress.bind(this)); + this.actor.connect('touch-event', this._onTouchEvent.bind(this)); + this.actor.connect('clicked', this._onClicked.bind(this)); + this.actor.connect('popup-menu', this._onKeyboardPopupMenu.bind(this)); this._menu = null; this._menuManager = new PopupMenu.PopupMenuManager(this); @@ -1645,7 +1645,7 @@ var AppIcon = new Lang.Class({ }); } - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._menuTimeoutId = 0; this._stateChangedId = this.app.connect('notify::state', () => { diff --git a/js/ui/appFavorites.js b/js/ui/appFavorites.js index ff4bf30a7..beeafe750 100644 --- a/js/ui/appFavorites.js +++ b/js/ui/appFavorites.js @@ -51,7 +51,7 @@ var AppFavorites = new Lang.Class({ _init() { this._favorites = {}; - global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged)); + global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, this._onFavsChanged.bind(this)); this.reload(); }, diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js index 95b4f8272..de8af09b6 100644 --- a/js/ui/audioDeviceSelection.js +++ b/js/ui/audioDeviceSelection.js @@ -65,9 +65,9 @@ var AudioDeviceSelectionDialog = new Lang.Class({ this._selectionBox = new St.BoxLayout({ style_class: 'audio-selection-box' }); this.contentLayout.add(this._selectionBox, { expand: true }); - this.addButton({ action: Lang.bind(this, this._openSettings), + this.addButton({ action: this._openSettings.bind(this), label: _("Sound Settings") }); - this.addButton({ action: Lang.bind(this, this.close), + this.addButton({ action: this.close.bind(this), label: _("Cancel"), key: Clutter.Escape }); }, @@ -191,9 +191,9 @@ var AudioDeviceSelectionDBus = new Lang.Class({ } dialog._sender = invocation.get_sender(); - dialog.connect('closed', Lang.bind(this, this._onDialogClosed)); + dialog.connect('closed', this._onDialogClosed.bind(this)); dialog.connect('device-selected', - Lang.bind(this, this._onDeviceSelected)); + this._onDeviceSelected.bind(this)); dialog.open(); this._audioSelectionDialog = dialog; diff --git a/js/ui/background.js b/js/ui/background.js index c0f0263cd..b24f82536 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -539,7 +539,7 @@ var BackgroundSource = new Lang.Class({ this._backgrounds = []; this._monitorsChangedId = global.screen.connect('monitors-changed', - Lang.bind(this, this._onMonitorsChanged)); + this._onMonitorsChanged.bind(this)); }, _onMonitorsChanged() { diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index ecebeda24..47f718a84 100644 --- a/js/ui/boxpointer.js +++ b/js/ui/boxpointer.js @@ -44,13 +44,13 @@ var BoxPointer = new Lang.Class({ y_fill: true }); this._container = new Shell.GenericContainer(); this.actor.set_child(this._container); - this._container.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this._container.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this._container.connect('allocate', Lang.bind(this, this._allocate)); + this._container.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this._container.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this._container.connect('allocate', this._allocate.bind(this)); this.bin = new St.Bin(binProperties); this._container.add_actor(this.bin); this._border = new St.DrawingArea(); - this._border.connect('repaint', Lang.bind(this, this._drawBorder)); + this._border.connect('repaint', this._drawBorder.bind(this)); this._container.add_actor(this._border); this.bin.raise(this._border); this._xOffset = 0; diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 8ecd9492e..a46017ad0 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -215,7 +215,7 @@ var DBusEventSource = new Lang.Class({ } } - this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged)); + this._dbusProxy.connectSignal('Changed', this._onChanged.bind(this)); this._dbusProxy.connect('notify::g-name-owner', () => { if (this._dbusProxy.g_name_owner) @@ -299,7 +299,7 @@ var DBusEventSource = new Lang.Class({ this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000, this._curRequestEnd.getTime() / 1000, forceReload, - Lang.bind(this, this._onEventsReceived), + this._onEventsReceived.bind(this), Gio.DBusCallFlags.NONE); } }, @@ -367,7 +367,7 @@ var Calendar = new Lang.Class({ this._weekStart = Shell.util_get_week_start(); this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' }); - this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, Lang.bind(this, this._onSettingsChange)); + this._settings.connect('changed::' + SHOW_WEEKDATE_KEY, this._onSettingsChange.bind(this)); this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY); /** @@ -398,7 +398,7 @@ var Calendar = new Lang.Class({ reactive: true }); this.actor.connect('scroll-event', - Lang.bind(this, this._onScroll)); + this._onScroll.bind(this)); this._buildHeader (); }, @@ -446,7 +446,7 @@ var Calendar = new Lang.Class({ accessible_name: _("Previous month"), can_focus: true }); this._topBox.add(this._backButton); - this._backButton.connect('clicked', Lang.bind(this, this._onPrevMonthButtonClicked)); + this._backButton.connect('clicked', this._onPrevMonthButtonClicked.bind(this)); this._monthLabel = new St.Label({style_class: 'calendar-month-label', can_focus: true }); @@ -456,7 +456,7 @@ var Calendar = new Lang.Class({ accessible_name: _("Next month"), can_focus: true }); this._topBox.add(this._forwardButton); - this._forwardButton.connect('clicked', Lang.bind(this, this._onNextMonthButtonClicked)); + this._forwardButton.connect('clicked', this._onNextMonthButtonClicked.bind(this)); // Add weekday labels... // @@ -779,7 +779,7 @@ var NotificationMessage = new Lang.Class({ this.close(); }); this._updatedId = notification.connect('updated', - Lang.bind(this, this._onUpdated)); + this._onUpdated.bind(this)); }, _getIcon() { @@ -818,7 +818,7 @@ var EventsSection = new Lang.Class({ _init() { this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); - this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents)); + this._desktopSettings.connect('changed', this._reloadEvents.bind(this)); this._eventSource = new EmptyEventSource(); this.parent(); @@ -829,11 +829,11 @@ var EventsSection = new Lang.Class({ can_focus: true }); this.actor.insert_child_below(this._title, null); - this._title.connect('clicked', Lang.bind(this, this._onTitleClicked)); - this._title.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn)); + this._title.connect('clicked', this._onTitleClicked.bind(this)); + this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this)); Shell.AppSystem.get_default().connect('installed-changed', - Lang.bind(this, this._appInstalledChanged)); + this._appInstalledChanged.bind(this)); this._appInstalledChanged(); }, @@ -843,7 +843,7 @@ var EventsSection = new Lang.Class({ setEventSource(eventSource) { this._eventSource = eventSource; - this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents)); + this._eventSource.connect('changed', this._reloadEvents.bind(this)); }, get allowed() { @@ -953,12 +953,12 @@ var NotificationSection = new Lang.Class({ this._sources = new Map(); this._nUrgent = 0; - Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded)); + Main.messageTray.connect('source-added', this._sourceAdded.bind(this)); Main.messageTray.getSources().forEach(source => { this._sourceAdded(Main.messageTray, source); }); - this.actor.connect('notify::mapped', Lang.bind(this, this._onMapped)); + this.actor.connect('notify::mapped', this._onMapped.bind(this)); }, get allowed() { @@ -987,7 +987,7 @@ var NotificationSection = new Lang.Class({ this._onSourceDestroy(source, obj); }); obj.notificationAddedId = source.connect('notification-added', - Lang.bind(this, this._onNotificationAdded)); + this._onNotificationAdded.bind(this)); this._sources.set(source, obj); }, @@ -1139,7 +1139,7 @@ var CalendarMessageList = new Lang.Class({ this._eventsSection = new EventsSection(); this._addSection(this._eventsSection); - Main.sessionMode.connect('updated', Lang.bind(this, this._sync)); + Main.sessionMode.connect('updated', this._sync.bind(this)); }, _addSection(section) { @@ -1154,13 +1154,13 @@ var CalendarMessageList = new Lang.Class({ this._removeSection(section); }); obj.visibleId = section.actor.connect('notify::visible', - Lang.bind(this, this._sync)); + this._sync.bind(this)); obj.emptyChangedId = section.connect('empty-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); obj.canClearChangedId = section.connect('can-clear-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); obj.keyFocusId = section.connect('key-focus-in', - Lang.bind(this, this._onKeyFocusIn)); + this._onKeyFocusIn.bind(this)); this._sections.set(section, obj); this._sectionList.add_actor(section.actor); diff --git a/js/ui/closeDialog.js b/js/ui/closeDialog.js index ed3a20722..aa0b5ceaf 100644 --- a/js/ui/closeDialog.js +++ b/js/ui/closeDialog.js @@ -59,10 +59,10 @@ var CloseDialog = new Lang.Class({ this._dialog.addContent(this._createDialogContent()); this._dialog.addButton({ label: _('Force Quit'), - action: Lang.bind(this, this._onClose), + action: this._onClose.bind(this), default: true }); this._dialog.addButton({ label: _('Wait'), - action: Lang.bind(this, this._onWait), + action: this._onWait.bind(this), key: Clutter.Escape }); global.focus_manager.add_group(this._dialog); diff --git a/js/ui/components/__init__.js b/js/ui/components/__init__.js index 533acca34..055900b72 100644 --- a/js/ui/components/__init__.js +++ b/js/ui/components/__init__.js @@ -9,7 +9,7 @@ var ComponentManager = new Lang.Class({ this._allComponents = {}; this._enabledComponents = []; - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js index 83d7d9e7b..2d8f3f8fb 100644 --- a/js/ui/components/automountManager.js +++ b/js/ui/components/automountManager.js @@ -27,22 +27,22 @@ var AutomountManager = new Lang.Class({ this._volumeQueue = []; this._session = new GnomeSession.SessionManager(); this._session.connectSignal('InhibitorAdded', - Lang.bind(this, this._InhibitorsChanged)); + this._InhibitorsChanged.bind(this)); this._session.connectSignal('InhibitorRemoved', - Lang.bind(this, this._InhibitorsChanged)); + this._InhibitorsChanged.bind(this)); this._inhibited = false; this._volumeMonitor = Gio.VolumeMonitor.get(); }, enable() { - this._volumeAddedId = this._volumeMonitor.connect('volume-added', Lang.bind(this, this._onVolumeAdded)); - this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved)); - this._driveConnectedId = this._volumeMonitor.connect('drive-connected', Lang.bind(this, this._onDriveConnected)); - this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', Lang.bind(this, this._onDriveDisconnected)); - this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', Lang.bind(this, this._onDriveEjectButton)); + this._volumeAddedId = this._volumeMonitor.connect('volume-added', this._onVolumeAdded.bind(this)); + this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', this._onVolumeRemoved.bind(this)); + this._driveConnectedId = this._volumeMonitor.connect('drive-connected', this._onDriveConnected.bind(this)); + this._driveDisconnectedId = this._volumeMonitor.connect('drive-disconnected', this._onDriveDisconnected.bind(this)); + this._driveEjectButtonId = this._volumeMonitor.connect('drive-eject-button', this._onDriveEjectButton.bind(this)); - this._mountAllId = Mainloop.idle_add(Lang.bind(this, this._startupMountAll)); + this._mountAllId = Mainloop.idle_add(this._startupMountAll.bind(this)); GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll'); }, @@ -185,7 +185,7 @@ var AutomountManager = new Lang.Class({ volume._operation = operation; volume.mount(0, mountOp, null, - Lang.bind(this, this._onVolumeMounted)); + this._onVolumeMounted.bind(this)); }, _onVolumeMounted(volume, res) { diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index 185c2d4df..bbd732876 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -105,8 +105,7 @@ var ContentTypeDiscoverer = new Lang.Class({ if (shouldScan) { // guess mount's content types using GIO mount.guess_content_type(false, null, - Lang.bind(this, - this._onContentTypeGuessed)); + this._onContentTypeGuessed.bind(this)); } else { this._emitCallback(mount, []); } @@ -170,8 +169,8 @@ var AutorunManager = new Lang.Class({ }, enable() { - this._mountAddedId = this._volumeMonitor.connect('mount-added', Lang.bind(this, this._onMountAdded)); - this._mountRemovedId = this._volumeMonitor.connect('mount-removed', Lang.bind(this, this._onMountRemoved)); + this._mountAddedId = this._volumeMonitor.connect('mount-added', this._onMountAdded.bind(this)); + this._mountRemovedId = this._volumeMonitor.connect('mount-removed', this._onMountRemoved.bind(this)); }, disable() { diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js index b8e37d136..3dd58e828 100644 --- a/js/ui/components/keyring.js +++ b/js/ui/components/keyring.js @@ -28,9 +28,9 @@ var KeyringDialog = new Lang.Class({ this.parent({ styleClass: 'prompt-dialog' }); this.prompt = new Shell.KeyringPrompt(); - this.prompt.connect('show-password', Lang.bind(this, this._onShowPassword)); - this.prompt.connect('show-confirm', Lang.bind(this, this._onShowConfirm)); - this.prompt.connect('prompt-close', Lang.bind(this, this._onHidePrompt)); + this.prompt.connect('show-password', this._onShowPassword.bind(this)); + this.prompt.connect('show-confirm', this._onShowConfirm.bind(this)); + this.prompt.connect('prompt-close', this._onHidePrompt.bind(this)); let icon = new Gio.ThemedIcon({ name: 'dialog-password-symbolic' }); this._content = new Dialog.MessageDialogContent({ icon }); @@ -55,10 +55,10 @@ var KeyringDialog = new Lang.Class({ this._controlTable = null; this._cancelButton = this.addButton({ label: '', - action: Lang.bind(this, this._onCancelButton), + action: this._onCancelButton.bind(this), key: Clutter.Escape }); this._continueButton = this.addButton({ label: '', - action: Lang.bind(this, this._onContinueButton), + action: this._onContinueButton.bind(this), default: true }); this.prompt.bind_property('cancel-label', this._cancelButton, 'label', GObject.BindingFlags.SYNC_CREATE); @@ -112,7 +112,7 @@ var KeyringDialog = new Lang.Class({ x_expand: true }); this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); - this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onPasswordActivate)); + this._passwordEntry.clutter_text.connect('activate', this._onPasswordActivate.bind(this)); let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg'); this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE); @@ -144,7 +144,7 @@ var KeyringDialog = new Lang.Class({ x_expand: true }); this._confirmEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE ShellEntry.addContextMenu(this._confirmEntry, { isPassword: true }); - this._confirmEntry.clutter_text.connect('activate', Lang.bind(this, this._onConfirmActivate)); + this._confirmEntry.clutter_text.connect('activate', this._onConfirmActivate.bind(this)); if (rtl) { layout.attach(this._confirmEntry, 0, row, 1, 1); layout.attach(label, 1, row, 1, 1); @@ -263,10 +263,8 @@ var KeyringDummyDialog = new Lang.Class({ _init() { this.prompt = new Shell.KeyringPrompt(); - this.prompt.connect('show-password', - Lang.bind(this, this._cancelPrompt)); - this.prompt.connect('show-confirm', Lang.bind(this, - this._cancelPrompt)); + this.prompt.connect('show-password', this._cancelPrompt.bind(this)); + this.prompt.connect('show-confirm', this._cancelPrompt.bind(this)); }, _cancelPrompt() { diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index 0ea1fa7c0..c51e53eba 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -82,7 +82,7 @@ var NetworkSecretDialog = new Lang.Class({ initialFocusSet = true; } - secret.entry.clutter_text.connect('activate', Lang.bind(this, this._onOk)); + secret.entry.clutter_text.connect('activate', this._onOk.bind(this)); secret.entry.clutter_text.connect('text-changed', () => { secret.value = secret.entry.get_text(); if (secret.validate) @@ -110,12 +110,12 @@ var NetworkSecretDialog = new Lang.Class({ contentBox.messageBox.add(secretTable); this._okButton = { label: _("Connect"), - action: Lang.bind(this, this._onOk), + action: this._onOk.bind(this), default: true }; this.setButtons([{ label: _("Cancel"), - action: Lang.bind(this, this.cancel), + action: this.cancel.bind(this), key: Clutter.KEY_Escape, }, this._okButton]); @@ -384,7 +384,7 @@ var VPNRequestHandler = new Lang.Class({ this._readStdoutOldStyle(); this._childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, - Lang.bind(this, this._vpnChildFinished)); + this._vpnChildFinished.bind(this)); this._writeConnection(); } catch(e) { @@ -602,8 +602,8 @@ var NetworkAgent = new Lang.Class({ log('Failed to create monitor for VPN plugin dir: ' + e.message); } - this._native.connect('new-request', Lang.bind(this, this._newRequest)); - this._native.connect('cancel-request', Lang.bind(this, this._cancelRequest)); + this._native.connect('new-request', this._newRequest.bind(this)); + this._native.connect('cancel-request', this._cancelRequest.bind(this)); try { this._native.init(null); } catch(e) { diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index 631847ad1..b45356875 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -60,9 +60,9 @@ var AuthenticationDialog = new Lang.Class({ this._user = AccountsService.UserManager.get_default().get_user(userName); let userRealName = this._user.get_real_name() this._userLoadedId = this._user.connect('notify::is_loaded', - Lang.bind(this, this._onUserChanged)); + this._onUserChanged.bind(this)); this._userChangedId = this._user.connect('changed', - Lang.bind(this, this._onUserChanged)); + this._onUserChanged.bind(this)); // Special case 'root' let userIsRoot = false; @@ -108,7 +108,7 @@ var AuthenticationDialog = new Lang.Class({ text: "", can_focus: true}); ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); - this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivate)); + this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this)); this._passwordBox.add(this._passwordEntry, { expand: true }); @@ -146,10 +146,10 @@ var AuthenticationDialog = new Lang.Class({ this._nullMessageLabel.show(); this._cancelButton = this.addButton({ label: _("Cancel"), - action: Lang.bind(this, this.cancel), + action: this.cancel.bind(this), key: Clutter.Escape }); this._okButton = this.addButton({ label: _("Authenticate"), - action: Lang.bind(this, this._onAuthenticateButtonPressed), + action: this._onAuthenticateButtonPressed.bind(this), default: true }); this._doneEmitted = false; @@ -186,10 +186,10 @@ var AuthenticationDialog = new Lang.Class({ this.destroySession(); this._session = new PolkitAgent.Session({ identity: this._identityToAuth, cookie: this._cookie }); - this._session.connect('completed', Lang.bind(this, this._onSessionCompleted)); - this._session.connect('request', Lang.bind(this, this._onSessionRequest)); - this._session.connect('show-error', Lang.bind(this, this._onSessionShowError)); - this._session.connect('show-info', Lang.bind(this, this._onSessionShowInfo)); + this._session.connect('completed', this._onSessionCompleted.bind(this)); + this._session.connect('request', this._onSessionRequest.bind(this)); + this._session.connect('show-error', this._onSessionShowError.bind(this)); + this._session.connect('show-info', this._onSessionShowInfo.bind(this)); this._session.initiate(); }, @@ -346,8 +346,8 @@ var AuthenticationAgent = new Lang.Class({ this._currentDialog = null; this._handle = null; this._native = new Shell.PolkitAuthenticationAgent(); - this._native.connect('initiate', Lang.bind(this, this._onInitiate)); - this._native.connect('cancel', Lang.bind(this, this._onCancel)); + this._native.connect('initiate', this._onInitiate.bind(this)); + this._native.connect('cancel', this._onCancel.bind(this)); }, enable() { @@ -379,7 +379,7 @@ var AuthenticationAgent = new Lang.Class({ // See https://bugzilla.gnome.org/show_bug.cgi?id=643062 for more // discussion. - this._currentDialog.connect('done', Lang.bind(this, this._onDialogDone)); + this._currentDialog.connect('done', this._onDialogDone.bind(this)); this._currentDialog.performAuthentication(); }, diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index b7b682a0f..257b24fdd 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -157,7 +157,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({ // Allow other clients (such as Empathy) to pre-empt our channels if // needed this.set_delegated_channels_callback( - Lang.bind(this, this._delegatedChannelsCb)); + this._delegatedChannelsCb.bind(this)); }, vfunc_observe_channels(account, conn, channels, @@ -295,19 +295,19 @@ var ChatSource = new Lang.Class({ this._conn = conn; this._channel = channel; - this._closedId = this._channel.connect('invalidated', Lang.bind(this, this._channelClosed)); + this._closedId = this._channel.connect('invalidated', this._channelClosed.bind(this)); this._notifyTimeoutId = 0; this._presence = contact.get_presence_type(); - this._sentId = this._channel.connect('message-sent', Lang.bind(this, this._messageSent)); - this._receivedId = this._channel.connect('message-received', Lang.bind(this, this._messageReceived)); - this._pendingId = this._channel.connect('pending-message-removed', Lang.bind(this, this._pendingRemoved)); + this._sentId = this._channel.connect('message-sent', this._messageSent.bind(this)); + this._receivedId = this._channel.connect('message-received', this._messageReceived.bind(this)); + this._pendingId = this._channel.connect('pending-message-removed', this._pendingRemoved.bind(this)); - this._notifyAliasId = this._contact.connect('notify::alias', Lang.bind(this, this._updateAlias)); - this._notifyAvatarId = this._contact.connect('notify::avatar-file', Lang.bind(this, this._updateAvatarIcon)); - this._presenceChangedId = this._contact.connect('presence-changed', Lang.bind(this, this._presenceChanged)); + this._notifyAliasId = this._contact.connect('notify::alias', this._updateAlias.bind(this)); + this._notifyAvatarId = this._contact.connect('notify::avatar-file', this._updateAvatarIcon.bind(this)); + this._presenceChangedId = this._contact.connect('presence-changed', this._presenceChanged.bind(this)); // Add ourselves as a source. Main.messageTray.add(this); @@ -320,7 +320,7 @@ var ChatSource = new Lang.Class({ return; this._notification = new ChatNotification(this); - this._notification.connect('activated', Lang.bind(this, this.open)); + this._notification.connect('activated', this.open.bind(this)); this._notification.connect('updated', () => { if (this._banner && this._banner.expanded) this._ackMessages(); @@ -341,7 +341,7 @@ var ChatSource = new Lang.Class({ this._banner = new ChatNotificationBanner(this._notification); // We ack messages when the user expands the new notification - let id = this._banner.connect('expanded', Lang.bind(this, this._ackMessages)); + let id = this._banner.connect('expanded', this._ackMessages.bind(this)); this._banner.actor.connect('destroy', () => { this._banner.disconnect(id); this._banner = null; @@ -439,7 +439,7 @@ var ChatSource = new Lang.Class({ logManager.get_filtered_events_async(this._account, entity, Tpl.EventTypeMask.TEXT, SCROLLBACK_HISTORY_LINES, - null, Lang.bind(this, this._displayPendingMessages)); + null, this._displayPendingMessages.bind(this)); }, _displayPendingMessages(logManager, result) { @@ -563,7 +563,7 @@ var ChatSource = new Lang.Class({ if (this._notifyTimeoutId != 0) Mainloop.source_remove(this._notifyTimeoutId); this._notifyTimeoutId = Mainloop.timeout_add(500, - Lang.bind(this, this._notifyTimeout)); + this._notifyTimeout.bind(this)); GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout'); }, @@ -767,7 +767,7 @@ var ChatNotification = new Lang.Class({ // from the timestamp of the message. this._timestampTimeoutId = Mainloop.timeout_add_seconds( SCROLLBACK_IMMEDIATE_TIME - (currentTime - timestamp), - Lang.bind(this, this.appendTimestamp)); + this.appendTimestamp.bind(this)); GLib.Source.set_name_by_id(this._timestampTimeoutId, '[gnome-shell] this.appendTimestamp'); } } @@ -822,8 +822,8 @@ var ChatNotificationBanner = new Lang.Class({ this._responseEntry = new St.Entry({ style_class: 'chat-response', x_expand: true, can_focus: true }); - this._responseEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivated)); - this._responseEntry.clutter_text.connect('text-changed', Lang.bind(this, this._onEntryChanged)); + this._responseEntry.clutter_text.connect('activate', this._onEntryActivated.bind(this)); + this._responseEntry.clutter_text.connect('text-changed', this._onEntryChanged.bind(this)); this.setActionArea(this._responseEntry); this._responseEntry.clutter_text.connect('key-focus-in', () => { @@ -984,7 +984,7 @@ var ChatNotificationBanner = new Lang.Class({ this._composingTimeoutId = Mainloop.timeout_add_seconds( COMPOSING_STOP_TIMEOUT, - Lang.bind(this, this._composingStopTimeout)); + this._composingStopTimeout.bind(this)); GLib.Source.set_name_by_id(this._composingTimeoutId, '[gnome-shell] this._composingStopTimeout'); } else { this.notification.source.setChatState(Tp.ChannelChatState.ACTIVE); diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js index 6b8210435..673819c52 100644 --- a/js/ui/ctrlAltTab.js +++ b/js/ui/ctrlAltTab.js @@ -28,7 +28,7 @@ var CtrlAltTabManager = new Lang.Class({ this._items = []; this.addGroup(global.window_group, _("Windows"), 'focus-windows-symbolic', { sortGroup: SortGroup.TOP, - focusCallback: Lang.bind(this, this._focusWindows) }); + focusCallback: this._focusWindows.bind(this) }); }, addGroup(root, name, icon, params) { @@ -105,10 +105,9 @@ var CtrlAltTabManager = new Lang.Class({ items.push({ name: windows[i].title, proxy: windows[i].get_compositor_private(), - focusCallback: Lang.bind(windows[i], - function(timestamp) { - Main.activateWindow(this, timestamp); - }), + focusCallback: function(timestamp) { + Main.activateWindow(this, timestamp); + }.bind(windows[i]), iconActor: icon, iconName: iconName, sortGroup: SortGroup.MIDDLE }); @@ -118,7 +117,7 @@ var CtrlAltTabManager = new Lang.Class({ if (!items.length) return; - items.sort(Lang.bind(this, this._sortItems)); + items.sort(this._sortItems.bind(this)); if (!this._popup) { this._popup = new CtrlAltTabPopup(items); diff --git a/js/ui/dash.js b/js/ui/dash.js index 51ad34592..5ee2476e3 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -246,7 +246,7 @@ var ShowAppsIcon = new Lang.Class({ this.icon = new IconGrid.BaseIcon(_("Show Applications"), { setSizeManually: true, showLabel: false, - createIcon: Lang.bind(this, this._createIcon) }); + createIcon: this._createIcon.bind(this) }); this.toggleButton.add_actor(this.icon.actor); this.toggleButton._delegate = this; @@ -420,7 +420,7 @@ var Dash = new Lang.Class({ this._maxHeight = this.actor.height; }); - this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); + this._workId = Main.initializeDeferredWork(this._box, this._redisplay.bind(this)); this._appSystem = Shell.AppSystem.get_default(); @@ -428,15 +428,15 @@ var Dash = new Lang.Class({ AppFavorites.getAppFavorites().reload(); this._queueRedisplay(); }); - AppFavorites.getAppFavorites().connect('changed', Lang.bind(this, this._queueRedisplay)); - this._appSystem.connect('app-state-changed', Lang.bind(this, this._queueRedisplay)); + AppFavorites.getAppFavorites().connect('changed', this._queueRedisplay.bind(this)); + this._appSystem.connect('app-state-changed', this._queueRedisplay.bind(this)); Main.overview.connect('item-drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.overview.connect('item-drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('item-drag-cancelled', - Lang.bind(this, this._onDragCancelled)); + this._onDragCancelled.bind(this)); // Translators: this is the name of the dock/favorites area on // the left of the overview @@ -446,7 +446,7 @@ var Dash = new Lang.Class({ _onDragBegin() { this._dragCancelled = false; this._dragMonitor = { - dragMotion: Lang.bind(this, this._onDragMotion) + dragMotion: this._onDragMotion.bind(this) }; DND.addDragMonitor(this._dragMonitor); diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 55a269bb4..08ac28872 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -112,9 +112,9 @@ var WorldClocksSection = new Lang.Class({ this._clockAppMon = new Util.AppSettingsMonitor('org.gnome.clocks.desktop', 'org.gnome.clocks'); this._clockAppMon.connect('available-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._clockAppMon.watchSetting('world-clocks', - Lang.bind(this, this._clocksChanged)); + this._clocksChanged.bind(this)); this._sync(); }, @@ -176,7 +176,7 @@ var WorldClocksSection = new Lang.Class({ if (this._grid.get_n_children() > 1) { if (!this._clockNotifyId) this._clockNotifyId = - this._clock.connect('notify::clock', Lang.bind(this, this._updateLabels)); + this._clock.connect('notify::clock', this._updateLabels.bind(this)); this._updateLabels(); } else { if (this._clockNotifyId) @@ -230,7 +230,7 @@ var WeatherSection = new Lang.Class({ this._conditionsLabel.clutter_text.line_wrap = true; box.add_child(this._conditionsLabel); - this._weatherClient.connect('changed', Lang.bind(this, this._sync)); + this._weatherClient.connect('changed', this._sync.bind(this)); this._sync(); }, @@ -347,16 +347,16 @@ var MessagesIndicator = new Lang.Class({ this._sources = []; - Main.messageTray.connect('source-added', Lang.bind(this, this._onSourceAdded)); - Main.messageTray.connect('source-removed', Lang.bind(this, this._onSourceRemoved)); - Main.messageTray.connect('queue-changed', Lang.bind(this, this._updateCount)); + Main.messageTray.connect('source-added', this._onSourceAdded.bind(this)); + Main.messageTray.connect('source-removed', this._onSourceRemoved.bind(this)); + Main.messageTray.connect('queue-changed', this._updateCount.bind(this)); let sources = Main.messageTray.getSources(); sources.forEach(source => { this._onSourceAdded(null, source); }); }, _onSourceAdded(tray, source) { - source.connect('count-updated', Lang.bind(this, this._updateCount)); + source.connect('count-updated', this._updateCount.bind(this)); this._sources.push(source); this._updateCount(); }, @@ -545,9 +545,9 @@ var DateMenuButton = new Lang.Class({ this._clock = new GnomeDesktop.WallClock(); this._clock.bind_property('clock', this._clockDisplay, 'text', GObject.BindingFlags.SYNC_CREATE); - this._clock.connect('notify::timezone', Lang.bind(this, this._updateTimeZone)); + this._clock.connect('notify::timezone', this._updateTimeZone.bind(this)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, diff --git a/js/ui/dialog.js b/js/ui/dialog.js index 1312ba7be..cfa192db7 100644 --- a/js/ui/dialog.js +++ b/js/ui/dialog.js @@ -13,7 +13,7 @@ var Dialog = new Lang.Class({ _init(parentActor, styleClass) { this.parent({ layout_manager: new Clutter.BinLayout() }); - this.connect('destroy', Lang.bind(this, this._onDestroy)); + this.connect('destroy', this._onDestroy.bind(this)); this._initialKeyFocus = null; this._initialKeyFocusDestroyId = 0; @@ -26,7 +26,7 @@ var Dialog = new Lang.Class({ this._dialog.add_style_class_name(styleClass); this._parentActor = parentActor; - this._eventId = this._parentActor.connect('event', Lang.bind(this, this._modalEventHandler)); + this._eventId = this._parentActor.connect('event', this._modalEventHandler.bind(this)); this._parentActor.add_child(this); }, diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 5dae3bf9e..a38607c24 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -80,9 +80,9 @@ var _Draggable = new Lang.Class({ this.actor = actor; if (!params.manualMode) { this.actor.connect('button-press-event', - Lang.bind(this, this._onButtonPress)); + this._onButtonPress.bind(this)); this.actor.connect('touch-event', - Lang.bind(this, this._onTouchEvent)); + this._onTouchEvent.bind(this)); } this.actor.connect('destroy', () => { @@ -169,7 +169,7 @@ var _Draggable = new Lang.Class({ _grabActor() { this._grabDevice(this.actor); this._onEventId = this.actor.connect('event', - Lang.bind(this, this._onEvent)); + this._onEvent.bind(this)); }, _ungrabActor() { @@ -445,7 +445,7 @@ var _Draggable = new Lang.Class({ return; this._updateHoverId = GLib.idle_add(GLib.PRIORITY_DEFAULT, - Lang.bind(this, this._updateDragHover)); + this._updateDragHover.bind(this)); GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover'); }, @@ -600,7 +600,7 @@ var _Draggable = new Lang.Class({ // during it this._dragActorDestroyId = this._dragActor.connect('destroy', - Lang.bind(this, this._finishAnimation)); + this._finishAnimation.bind(this)); params['opacity'] = this._dragOrigOpacity; params['transition'] = 'easeOutQuad'; diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index 73df82673..7d18d0b79 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -303,7 +303,7 @@ var EndSessionDialog = new Lang.Class({ return; } this._powerProxy.connect('g-properties-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._sync(); }); @@ -313,12 +313,12 @@ var EndSessionDialog = new Lang.Class({ this._sessions = []; this.connect('destroy', - Lang.bind(this, this._onDestroy)); + this._onDestroy.bind(this)); this.connect('opened', - Lang.bind(this, this._onOpened)); + this._onOpened.bind(this)); - this._userLoadedId = this._user.connect('notify::is_loaded', Lang.bind(this, this._sync)); - this._userChangedId = this._user.connect('changed', Lang.bind(this, this._sync)); + this._userLoadedId = this._user.connect('notify::is_loaded', this._sync.bind(this)); + this._userChangedId = this._user.connect('changed', this._sync.bind(this)); let mainContentLayout = new St.BoxLayout({ vertical: false }); this.contentLayout.add(mainContentLayout, @@ -354,7 +354,7 @@ var EndSessionDialog = new Lang.Class({ y_align: St.Align.START }); this._checkBox = new CheckBox.CheckBox(); - this._checkBox.actor.connect('clicked', Lang.bind(this, this._sync)); + this._checkBox.actor.connect('clicked', this._sync.bind(this)); messageLayout.add(this._checkBox.actor); this._batteryWarning = new St.Label({ style_class: 'end-session-dialog-warning', @@ -478,7 +478,7 @@ var EndSessionDialog = new Lang.Class({ _updateButtons() { let dialogContent = DialogContent[this._type]; - let buttons = [{ action: Lang.bind(this, this.cancel), + let buttons = [{ action: this.cancel.bind(this), label: _("Cancel"), key: Clutter.Escape }]; diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js index 8688ce4b3..9b6f7a3a4 100644 --- a/js/ui/extensionDownloader.js +++ b/js/ui/extensionDownloader.js @@ -195,11 +195,11 @@ var InstallExtensionDialog = new Lang.Class({ this._invocation = invocation; this.setButtons([{ label: _("Cancel"), - action: Lang.bind(this, this._onCancelButtonPressed), + action: this._onCancelButtonPressed.bind(this), key: Clutter.Escape }, { label: _("Install"), - action: Lang.bind(this, this._onInstallButtonPressed), + action: this._onInstallButtonPressed.bind(this), default: true }]); diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 38351ac48..e35c01ab8 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -34,8 +34,8 @@ var extensionOrder = []; var _signals = {}; Signals.addSignalMethods(_signals); -var connect = Lang.bind(_signals, _signals.connect); -var disconnect = Lang.bind(_signals, _signals.disconnect); +var connect = _signals.connect.bind(_signals); +var disconnect = _signals.disconnect.bind(_signals); const ENABLED_EXTENSIONS_KEY = 'enabled-extensions'; const DISABLE_USER_EXTENSIONS_KEY = 'disable-user-extensions'; diff --git a/js/ui/focusCaretTracker.js b/js/ui/focusCaretTracker.js index 2bfc378d7..6695cbadf 100644 --- a/js/ui/focusCaretTracker.js +++ b/js/ui/focusCaretTracker.js @@ -32,7 +32,7 @@ var FocusCaretTracker = new Lang.Class({ Name: 'FocusCaretTracker', _init() { - this._atspiListener = Atspi.EventListener.new(Lang.bind(this, this._onChanged)); + this._atspiListener = Atspi.EventListener.new(this._onChanged.bind(this)); this._atspiInited = false; this._focusListenerRegistered = false; diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 393b548ab..60f2653f0 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -50,19 +50,17 @@ var BaseIcon = new Lang.Class({ x_fill: true, y_fill: true }); this.actor._delegate = this; - this.actor.connect('style-changed', - Lang.bind(this, this._onStyleChanged)); - this.actor.connect('destroy', - Lang.bind(this, this._onDestroy)); + this.actor.connect('style-changed', this._onStyleChanged.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._spacing = 0; let box = new Shell.GenericContainer(); - box.connect('allocate', Lang.bind(this, this._allocate)); + box.connect('allocate', this._allocate.bind(this)); box.connect('get-preferred-width', - Lang.bind(this, this._getPreferredWidth)); + this._getPreferredWidth.bind(this)); box.connect('get-preferred-height', - Lang.bind(this, this._getPreferredHeight)); + this._getPreferredHeight.bind(this)); this.actor.set_child(box); this.iconSize = ICON_SIZE; @@ -85,7 +83,7 @@ var BaseIcon = new Lang.Class({ this.icon = null; let cache = St.TextureCache.get_default(); - this._iconThemeChangedId = cache.connect('icon-theme-changed', Lang.bind(this, this._onIconThemeChanged)); + this._iconThemeChangedId = cache.connect('icon-theme-changed', this._onIconThemeChanged.bind(this)); }, _allocate(actor, box, flags) { @@ -274,7 +272,7 @@ var IconGrid = new Lang.Class({ this._fixedHItemSize = this._fixedVItemSize = undefined; this._grid = new Shell.GenericContainer(); this.actor.add(this._grid, { expand: true, y_align: St.Align.START }); - this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged)); + this.actor.connect('style-changed', this._onStyleChanged.bind(this)); // Cancel animations when hiding the overview, to avoid icons // swarming into the void ... @@ -283,11 +281,11 @@ var IconGrid = new Lang.Class({ this._cancelAnimation(); }); - this._grid.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this._grid.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this._grid.connect('allocate', Lang.bind(this, this._allocate)); - this._grid.connect('actor-added', Lang.bind(this, this._childAdded)); - this._grid.connect('actor-removed', Lang.bind(this, this._childRemoved)); + this._grid.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this._grid.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this._grid.connect('allocate', this._allocate.bind(this)); + this._grid.connect('actor-added', this._childAdded.bind(this)); + this._grid.connect('actor-removed', this._childRemoved.bind(this)); }, _keyFocusIn(actor) { @@ -295,7 +293,7 @@ var IconGrid = new Lang.Class({ }, _childAdded(grid, child) { - child._iconGridKeyFocusInId = child.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); + child._iconGridKeyFocusInId = child.connect('key-focus-in', this._keyFocusIn.bind(this)); }, _childRemoved(grid, child) { @@ -780,7 +778,7 @@ var IconGrid = new Lang.Class({ this._updateSpacingForSize(availWidth, availHeight); } Meta.later_add(Meta.LaterType.BEFORE_REDRAW, - Lang.bind(this, this._updateIconSizes)); + this._updateIconSizes.bind(this)); }, // Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up diff --git a/js/ui/kbdA11yDialog.js b/js/ui/kbdA11yDialog.js index 5d802a331..739e0883b 100644 --- a/js/ui/kbdA11yDialog.js +++ b/js/ui/kbdA11yDialog.js @@ -18,7 +18,7 @@ var KbdA11yDialog = new Lang.Class({ let deviceManager = Clutter.DeviceManager.get_default(); deviceManager.connect('kbd-a11y-flags-changed', - Lang.bind(this, this._showKbdA11yDialog)); + this._showKbdA11yDialog.bind(this)); }, _showKbdA11yDialog(deviceManager, newFlags, whatChanged) { diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 783fc2442..e13c7b724 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -195,7 +195,7 @@ var LanguageSelectionPopup = new Lang.Class({ } this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this.addAction(_("Region & Language Settings"), Lang.bind(this, this._launchSettings)); + this.addAction(_("Region & Language Settings"), this._launchSettings.bind(this)); this._capturedEventId = 0; this._unmapId = actor.connect('notify::mapped', () => { @@ -223,7 +223,7 @@ var LanguageSelectionPopup = new Lang.Class({ open(animate) { this.parent(animate); this._capturedEventId = global.stage.connect('captured-event', - Lang.bind(this, this._onCapturedEvent)); + this._onCapturedEvent.bind(this)); }, close(animate) { @@ -255,7 +255,7 @@ var Key = new Lang.Class({ */ this.actor = new St.BoxLayout ({ style_class: 'key-container' }); this.actor.add(this.keyButton, { expand: true, x_fill: true }); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._extended_keys = extendedKeys; this._extended_keyboard = null; @@ -357,7 +357,7 @@ var Key = new Lang.Class({ _showSubkeys() { this._boxPointer.show(BoxPointer.PopupAnimation.FULL); this._capturedEventId = global.stage.connect('captured-event', - Lang.bind(this, this._onCapturedEvent)); + this._onCapturedEvent.bind(this)); this._unmapId = this.keyButton.connect('notify::mapped', () => { if (!this.keyButton.is_mapped()) this._hideSubkeys(); @@ -492,8 +492,8 @@ var Keyboard = new Lang.Class({ this._focusInExtendedKeys = false; this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker(); - this._focusCaretTracker.connect('focus-changed', Lang.bind(this, this._onFocusChanged)); - this._focusCaretTracker.connect('caret-moved', Lang.bind(this, this._onCaretMoved)); + this._focusCaretTracker.connect('focus-changed', this._onFocusChanged.bind(this)); + this._focusCaretTracker.connect('caret-moved', this._onCaretMoved.bind(this)); this._languagePopup = null; this._currentAccessible = null; this._caretTrackingEnabled = false; @@ -506,7 +506,7 @@ var Keyboard = new Lang.Class({ this._latched = false; // current level is latched this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA }); - this._a11yApplicationsSettings.connect('changed', Lang.bind(this, this._syncEnabled)); + this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this)); this._lastDeviceId = null; this._suggestions = null; @@ -531,7 +531,7 @@ var Keyboard = new Lang.Class({ this._keyboardRequested = false; this._keyboardRestingId = 0; - Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout)); + Main.layoutManager.connect('monitors-changed', this._relayout.bind(this)); //Main.inputMethod.connect('cursor-location-changed', (o, rect) => { // if (this._keyboardVisible) { // let currentWindow = global.screen.get_display().focus_window; @@ -706,10 +706,10 @@ var Keyboard = new Lang.Class({ // keyboard on RTL locales. this.actor.text_direction = Clutter.TextDirection.LTR; - this._keyboardNotifyId = this._keyboardController.connect('active-group', Lang.bind(this, this._onGroupChanged)); - this._keyboardGroupsChangedId = this._keyboardController.connect('groups-changed', Lang.bind(this, this._onKeyboardGroupsChanged)); - this._keyboardStateId = this._keyboardController.connect('panel-state', Lang.bind(this, this._onKeyboardStateChanged)); - this._focusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged)); + this._keyboardNotifyId = this._keyboardController.connect('active-group', this._onGroupChanged.bind(this)); + this._keyboardGroupsChangedId = this._keyboardController.connect('groups-changed', this._onKeyboardGroupsChanged.bind(this)); + this._keyboardStateId = this._keyboardController.connect('panel-state', this._onKeyboardStateChanged.bind(this)); + this._focusNotifyId = global.stage.connect('notify::key-focus', this._onKeyFocusChanged.bind(this)); this._relayout(); }, @@ -1166,13 +1166,15 @@ var KeyboardController = new Lang.Class({ this._inputSourceManager = InputSourceManager.getInputSourceManager(); this._sourceChangedId = this._inputSourceManager.connect('current-source-changed', - Lang.bind(this, this._onSourceChanged)); + this._onSourceChanged.bind(this)); this._sourcesModifiedId = this._inputSourceManager.connect ('sources-changed', - Lang.bind(this, this._onSourcesModified)); + this._onSourcesModified.bind(this)); this._currentSource = this._inputSourceManager.currentSource; - Main.inputMethod.connect('notify::content-purpose', Lang.bind(this, this._onContentPurposeHintsChanged)); - Main.inputMethod.connect('notify::content-hints', Lang.bind(this, this._onContentPurposeHintsChanged)); + Main.inputMethod.connect('notify::content-purpose', + this._onContentPurposeHintsChanged.bind(this)); + Main.inputMethod.connect('notify::content-hints', + this._onContentPurposeHintsChanged.bind(this)); Main.inputMethod.connect('input-panel-state', (o, state) => { this.emit('panel-state', state); }); diff --git a/js/ui/layout.js b/js/ui/layout.js index 68fc2cda6..6f810395d 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -239,7 +239,7 @@ var LayoutManager = new Lang.Class({ this.addChrome(this.panelBox, { affectsStruts: true, trackFullscreen: true }); this.panelBox.connect('allocation-changed', - Lang.bind(this, this._panelBoxChanged)); + this._panelBoxChanged.bind(this)); this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup', layout_manager: new Clutter.BinLayout() }); @@ -270,13 +270,13 @@ var LayoutManager = new Lang.Class({ // Need to update struts on new workspaces when they are added global.screen.connect('notify::n-workspaces', - Lang.bind(this, this._queueUpdateRegions)); + this._queueUpdateRegions.bind(this)); global.screen.connect('restacked', - Lang.bind(this, this._windowsRestacked)); + this._windowsRestacked.bind(this)); global.screen.connect('monitors-changed', - Lang.bind(this, this._monitorsChanged)); + this._monitorsChanged.bind(this)); global.screen.connect('in-fullscreen-changed', - Lang.bind(this, this._updateFullscreen)); + this._updateFullscreen.bind(this)); this._monitorsChanged(); // NVIDIA drivers don't preserve FBO contents across @@ -294,7 +294,7 @@ var LayoutManager = new Lang.Class({ // This is called by Main after everything else is constructed init() { - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._loadBackground(); }, @@ -424,7 +424,7 @@ var LayoutManager = new Lang.Class({ layoutManager: this, monitorIndex: monitorIndex }); - bgManager.connect('changed', Lang.bind(this, this._addBackgroundMenu)); + bgManager.connect('changed', this._addBackgroundMenu.bind(this)); this._addBackgroundMenu(bgManager); return bgManager; @@ -859,11 +859,11 @@ var LayoutManager = new Lang.Class({ let actorData = Params.parse(params, defaultParams); actorData.actor = actor; actorData.visibleId = actor.connect('notify::visible', - Lang.bind(this, this._queueUpdateRegions)); + this._queueUpdateRegions.bind(this)); actorData.allocationId = actor.connect('notify::allocation', - Lang.bind(this, this._queueUpdateRegions)); + this._queueUpdateRegions.bind(this)); actorData.destroyId = actor.connect('destroy', - Lang.bind(this, this._untrackActor)); + this._untrackActor.bind(this)); // Note that destroying actor will unset its parent, so we don't // need to connect to 'destroy' too. @@ -903,7 +903,7 @@ var LayoutManager = new Lang.Class({ global.window_group.visible = windowsVisible; global.top_window_group.visible = windowsVisible; - this._trackedActors.forEach(Lang.bind(this, this._updateActorVisibility)); + this._trackedActors.forEach(this._updateActorVisibility.bind(this)); }, getWorkAreaForMonitor(monitorIndex) { @@ -935,7 +935,7 @@ var LayoutManager = new Lang.Class({ if (!this._updateRegionIdle) this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, - Lang.bind(this, this._updateRegions)); + this._updateRegions.bind(this)); }, _getWindowActorsForWorkspace(workspace) { @@ -1095,7 +1095,7 @@ var HotCorner = new Lang.Class({ HOT_CORNER_PRESSURE_TIMEOUT, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW); - this._pressureBarrier.connect('trigger', Lang.bind(this, this._toggleOverview)); + this._pressureBarrier.connect('trigger', this._toggleOverview.bind(this)); // Cache the three ripples instead of dynamically creating and destroying them. this._ripple1 = new St.BoxLayout({ style_class: 'ripple-box', opacity: 0, visible: false }); @@ -1168,12 +1168,12 @@ var HotCorner = new Lang.Class({ } this.actor.connect('leave-event', - Lang.bind(this, this._onEnvironsLeft)); + this._onEnvironsLeft.bind(this)); this._corner.connect('enter-event', - Lang.bind(this, this._onCornerEntered)); + this._onCornerEntered.bind(this)); this._corner.connect('leave-event', - Lang.bind(this, this._onCornerLeft)); + this._onCornerLeft.bind(this)); } }, @@ -1283,8 +1283,8 @@ var PressureBarrier = new Lang.Class({ }, addBarrier(barrier) { - barrier._pressureHitId = barrier.connect('hit', Lang.bind(this, this._onBarrierHit)); - barrier._pressureLeftId = barrier.connect('left', Lang.bind(this, this._onBarrierLeft)); + barrier._pressureHitId = barrier.connect('hit', this._onBarrierHit.bind(this)); + barrier._pressureLeftId = barrier.connect('left', this._onBarrierLeft.bind(this)); this._barriers.push(barrier); }, @@ -1300,7 +1300,7 @@ var PressureBarrier = new Lang.Class({ }, destroy() { - this._barriers.forEach(Lang.bind(this, this._disconnectBarrier)); + this._barriers.forEach(this._disconnectBarrier.bind(this)); this._barriers = []; }, diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index 1cc9059ce..76562492a 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -122,7 +122,7 @@ var Lightbox = new Lang.Class({ this.actor.hide(); this.shown = false; - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); if (params.width && params.height) { this.actor.width = params.width; @@ -133,8 +133,8 @@ var Lightbox = new Lang.Class({ this.actor.add_constraint(constraint); } - this._actorAddedSignalId = container.connect('actor-added', Lang.bind(this, this._actorAdded)); - this._actorRemovedSignalId = container.connect('actor-removed', Lang.bind(this, this._actorRemoved)); + this._actorAddedSignalId = container.connect('actor-added', this._actorAdded.bind(this)); + this._actorRemovedSignalId = container.connect('actor-removed', this._actorRemoved.bind(this)); this._highlighted = null; }, diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 81593404e..ea5b759ec 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -40,9 +40,9 @@ var commandHeader = 'const Clutter = imports.gi.Clutter; ' + * in the shell core code too. */ 'const stage = global.stage; ' + /* Special lookingGlass functions */ - 'const inspect = Lang.bind(Main.lookingGlass, Main.lookingGlass.inspect); ' + + 'const inspect = Main.lookingGlass.inspect.bind(Main.lookingGlass); ' + 'const it = Main.lookingGlass.getIt(); ' + - 'const r = Lang.bind(Main.lookingGlass, Main.lookingGlass.getResult); '; + 'const r = Main.lookingGlass.getResult.bind(Main.lookingGlass); '; const HISTORY_KEY = 'looking-glass-history'; // Time between tabs for them to count as a double-tab event @@ -66,7 +66,7 @@ var AutoComplete = new Lang.Class({ _init(entry) { this._entry = entry; - this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent)); + this._entry.connect('key-press-event', this._entryKeyPressEvent.bind(this)); this._lastTabTime = global.get_current_time(); }, @@ -282,7 +282,7 @@ var ObjLink = new Lang.Class({ style_class: 'shell-link', label: text }); this.actor.get_child().single_line_mode = true; - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); + this.actor.connect('clicked', this._onClicked.bind(this)); this._lookingGlass = lookingGlass; }, @@ -321,9 +321,9 @@ var WindowList = new Lang.Class({ _init(lookingGlass) { this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' }); let tracker = Shell.WindowTracker.get_default(); - this._updateId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._updateWindowList)); - global.display.connect('window-created', Lang.bind(this, this._updateWindowList)); - tracker.connect('tracked-windows-changed', Lang.bind(this, this._updateWindowList)); + this._updateId = Main.initializeDeferredWork(this.actor, this._updateWindowList.bind(this)); + global.display.connect('window-created', this._updateWindowList.bind(this)); + tracker.connect('tracked-windows-changed', this._updateWindowList.bind(this)); this._lookingGlass = lookingGlass; }, @@ -336,7 +336,7 @@ var WindowList = new Lang.Class({ let metaWindow = windows[i].metaWindow; // Avoid multiple connections if (!metaWindow._lookingGlassManaged) { - metaWindow.connect('unmanaged', Lang.bind(this, this._updateWindowList)); + metaWindow.connect('unmanaged', this._updateWindowList.bind(this)); metaWindow._lookingGlassManaged = true; } let box = new St.BoxLayout({ vertical: true }); @@ -399,17 +399,17 @@ var ObjInspector = new Lang.Class({ label.single_line_mode = true; hbox.add(label, { expand: true, y_fill: false }); let button = new St.Button({ label: 'Insert', style_class: 'lg-obj-inspector-button' }); - button.connect('clicked', Lang.bind(this, this._onInsert)); + button.connect('clicked', this._onInsert.bind(this)); hbox.add(button); if (this._previousObj != null) { button = new St.Button({ label: 'Back', style_class: 'lg-obj-inspector-button' }); - button.connect('clicked', Lang.bind(this, this._onBack)); + button.connect('clicked', this._onBack.bind(this)); hbox.add(button); } button = new St.Button({ style_class: 'window-close' }); - button.connect('clicked', Lang.bind(this, this.close)); + button.connect('clicked', this.close.bind(this)); hbox.add(button); if (typeof(obj) == typeof({})) { let properties = []; @@ -505,7 +505,7 @@ var Inspector = new Lang.Class({ _init(lookingGlass) { let container = new Shell.GenericContainer({ width: 0, height: 0 }); - container.connect('allocate', Lang.bind(this, this._allocate)); + container.connect('allocate', this._allocate.bind(this)); Main.uiGroup.add_actor(container); let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog', @@ -516,10 +516,10 @@ var Inspector = new Lang.Class({ this._displayText = new St.Label(); eventHandler.add(this._displayText, { expand: true }); - eventHandler.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); - eventHandler.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent)); - eventHandler.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); - eventHandler.connect('motion-event', Lang.bind(this, this._onMotionEvent)); + eventHandler.connect('key-press-event', this._onKeyPressEvent.bind(this)); + eventHandler.connect('button-press-event', this._onButtonPressEvent.bind(this)); + eventHandler.connect('scroll-event', this._onScrollEvent.bind(this)); + eventHandler.connect('motion-event', this._onMotionEvent.bind(this)); Clutter.grab_pointer(eventHandler); Clutter.grab_keyboard(eventHandler); @@ -652,7 +652,7 @@ var Extensions = new Lang.Class({ this._loadExtension(null, uuid); ExtensionSystem.connect('extension-loaded', - Lang.bind(this, this._loadExtension)); + this._loadExtension.bind(this)); }, _loadExtension(o, uuid) { @@ -749,7 +749,7 @@ var Extensions = new Lang.Class({ style_class: 'shell-link', label: _("View Source") }); viewsource._extension = extension; - viewsource.connect('clicked', Lang.bind(this, this._onViewSource)); + viewsource.connect('clicked', this._onViewSource.bind(this)); metaBox.add(viewsource); if (extension.metadata.url) { @@ -758,7 +758,7 @@ var Extensions = new Lang.Class({ style_class: 'shell-link', label: _("Web Page") }); webpage._extension = extension; - webpage.connect('clicked', Lang.bind(this, this._onWebPage)); + webpage.connect('clicked', this._onWebPage.bind(this)); metaBox.add(webpage); } @@ -769,7 +769,7 @@ var Extensions = new Lang.Class({ viewerrors._extension = extension; viewerrors._parentBox = box; viewerrors._isShowing = false; - viewerrors.connect('clicked', Lang.bind(this, this._onViewErrors)); + viewerrors.connect('clicked', this._onViewErrors.bind(this)); metaBox.add(viewerrors); return box; @@ -797,11 +797,11 @@ var LookingGlass = new Lang.Class({ vertical: true, visible: false, reactive: true }); - this.actor.connect('key-press-event', Lang.bind(this, this._globalKeyPressEvent)); + this.actor.connect('key-press-event', this._globalKeyPressEvent.bind(this)); this._interfaceSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); this._interfaceSettings.connect('changed::monospace-font-name', - Lang.bind(this, this._updateFont)); + this._updateFont.bind(this)); this._updateFont(); // We want it to appear to slide out from underneath the panel @@ -809,9 +809,9 @@ var LookingGlass = new Lang.Class({ Main.uiGroup.set_child_below_sibling(this.actor, Main.layoutManager.panelBox); Main.layoutManager.panelBox.connect('allocation-changed', - Lang.bind(this, this._queueResize)); + this._queueResize.bind(this)); Main.layoutManager.keyboardBox.connect('allocation-changed', - Lang.bind(this, this._queueResize)); + this._queueResize.bind(this)); this._objInspector = new ObjInspector(this); Main.uiGroup.add_actor(this._objInspector.actor); diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 9893c593a..b752b127a 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -79,7 +79,7 @@ var Magnifier = new Lang.Class({ let showAtLaunch = this._settingsInit(aZoomRegion); aZoomRegion.scrollContentsTo(this.xMouse, this.yMouse); - cursorTracker.connect('cursor-changed', Lang.bind(this, this._updateMouseSprite)); + cursorTracker.connect('cursor-changed', this._updateMouseSprite.bind(this)); this._cursorTracker = cursorTracker; // Export to dbus. @@ -153,7 +153,7 @@ var Magnifier = new Lang.Class({ */ startTrackingMouse() { if (!this._pointerWatch) - this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, Lang.bind(this, this.scrollToMousePos)); + this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, this.scrollToMousePos.bind(this)); }, /** @@ -452,38 +452,38 @@ var Magnifier = new Lang.Class({ }); this._settings.connect('changed::' + SCREEN_POSITION_KEY, - Lang.bind(this, this._updateScreenPosition)); + this._updateScreenPosition.bind(this)); this._settings.connect('changed::' + MAG_FACTOR_KEY, - Lang.bind(this, this._updateMagFactor)); + this._updateMagFactor.bind(this)); this._settings.connect('changed::' + LENS_MODE_KEY, - Lang.bind(this, this._updateLensMode)); + this._updateLensMode.bind(this)); this._settings.connect('changed::' + CLAMP_MODE_KEY, - Lang.bind(this, this._updateClampMode)); + this._updateClampMode.bind(this)); this._settings.connect('changed::' + MOUSE_TRACKING_KEY, - Lang.bind(this, this._updateMouseTrackingMode)); + this._updateMouseTrackingMode.bind(this)); this._settings.connect('changed::' + FOCUS_TRACKING_KEY, - Lang.bind(this, this._updateFocusTrackingMode)); + this._updateFocusTrackingMode.bind(this)); this._settings.connect('changed::' + CARET_TRACKING_KEY, - Lang.bind(this, this._updateCaretTrackingMode)); + this._updateCaretTrackingMode.bind(this)); this._settings.connect('changed::' + INVERT_LIGHTNESS_KEY, - Lang.bind(this, this._updateInvertLightness)); + this._updateInvertLightness.bind(this)); this._settings.connect('changed::' + COLOR_SATURATION_KEY, - Lang.bind(this, this._updateColorSaturation)); + this._updateColorSaturation.bind(this)); this._settings.connect('changed::' + BRIGHT_RED_KEY, - Lang.bind(this, this._updateBrightness)); + this._updateBrightness.bind(this)); this._settings.connect('changed::' + BRIGHT_GREEN_KEY, - Lang.bind(this, this._updateBrightness)); + this._updateBrightness.bind(this)); this._settings.connect('changed::' + BRIGHT_BLUE_KEY, - Lang.bind(this, this._updateBrightness)); + this._updateBrightness.bind(this)); this._settings.connect('changed::' + CONTRAST_RED_KEY, - Lang.bind(this, this._updateContrast)); + this._updateContrast.bind(this)); this._settings.connect('changed::' + CONTRAST_GREEN_KEY, - Lang.bind(this, this._updateContrast)); + this._updateContrast.bind(this)); this._settings.connect('changed::' + CONTRAST_BLUE_KEY, - Lang.bind(this, this._updateContrast)); + this._updateContrast.bind(this)); this._settings.connect('changed::' + SHOW_CROSS_HAIRS_KEY, () => { this.setCrosshairsVisible(this._settings.get_boolean(SHOW_CROSS_HAIRS_KEY)); @@ -709,11 +709,11 @@ var ZoomRegion = new Lang.Class({ this._scrollContentsTimerId = 0; Main.layoutManager.connect('monitors-changed', - Lang.bind(this, this._monitorsChanged)); + this._monitorsChanged.bind(this)); this._focusCaretTracker.connect('caret-moved', - Lang.bind(this, this._updateCaret)); + this._updateCaret.bind(this)); this._focusCaretTracker.connect('focus-changed', - Lang.bind(this, this._updateFocus)); + this._updateFocus.bind(this)); }, _updateFocus(caller, event) { @@ -1558,7 +1558,7 @@ var Crosshairs = new Lang.Class({ this.reCenter(); Main.layoutManager.connect('monitors-changed', - Lang.bind(this, this._monitorsChanged)); + this._monitorsChanged.bind(this)); }, _monitorsChanged() { diff --git a/js/ui/main.js b/js/ui/main.js index b10473601..2cfe941be 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -96,7 +96,7 @@ function _sessionUpdated() { wm.setCustomKeybindingHandler('panel-main-menu', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null); + sessionMode.hasOverview ? overview.toggle.bind(overview) : null); wm.allowKeybinding('overlay-key', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW); diff --git a/js/ui/messageList.js b/js/ui/messageList.js index a06d89d19..61987191b 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -310,7 +310,7 @@ var Message = new Lang.Class({ can_focus: true, x_expand: true, x_fill: true }); this.actor.connect('key-press-event', - Lang.bind(this, this._onKeyPressed)); + this._onKeyPressed.bind(this)); let vbox = new St.BoxLayout({ vertical: true }); this.actor.set_child(vbox); @@ -361,10 +361,10 @@ var Message = new Lang.Class({ this._bodyStack.add_actor(this.bodyLabel.actor); this.setBody(body); - this._closeButton.connect('clicked', Lang.bind(this, this.close)); - this.actor.connect('notify::hover', Lang.bind(this, this._sync)); - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this._closeButton.connect('clicked', this.close.bind(this)); + this.actor.connect('notify::hover', this._sync.bind(this)); + this.actor.connect('clicked', this._onClicked.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._sync(); }, @@ -535,11 +535,11 @@ var MessageListSection = new Lang.Class({ vertical: true }); this.actor.add_actor(this._list); - this._list.connect('actor-added', Lang.bind(this, this._sync)); - this._list.connect('actor-removed', Lang.bind(this, this._sync)); + this._list.connect('actor-added', this._sync.bind(this)); + this._list.connect('actor-removed', this._sync.bind(this)); let id = Main.sessionMode.connect('updated', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this.actor.connect('destroy', () => { Main.sessionMode.disconnect(id); }); @@ -583,7 +583,7 @@ var MessageListSection = new Lang.Class({ pivot_point: pivot, scale_x: scale, scale_y: scale }); obj.keyFocusId = message.actor.connect('key-focus-in', - Lang.bind(this, this._onKeyFocusIn)); + this._onKeyFocusIn.bind(this)); obj.destroyId = message.actor.connect('destroy', () => { this.removeMessage(message, false); }); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 8e8644811..9ce5b4460 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -85,7 +85,7 @@ var FocusGrabber = new Lang.Class({ this._prevKeyFocusActor = global.stage.get_key_focus(); - this._focusActorChangedId = global.stage.connect('notify::key-focus', Lang.bind(this, this._focusActorChanged)); + this._focusActorChangedId = global.stage.connect('notify::key-focus', this._focusActorChanged.bind(this)); if (!this._actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false)) this._actor.grab_key_focus(); @@ -164,7 +164,7 @@ var NotificationGenericPolicy = new Lang.Class({ this.id = 'generic'; this._masterSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications' }); - this._masterSettings.connect('changed', Lang.bind(this, this._changed)); + this._masterSettings.connect('changed', this._changed.bind(this)); }, store() { }, @@ -217,8 +217,8 @@ var NotificationApplicationPolicy = new Lang.Class({ this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.notifications.application', path: '/org/gnome/desktop/notifications/application/' + this._canonicalId + '/' }); - this._masterSettings.connect('changed', Lang.bind(this, this._changed)); - this._settings.connect('changed', Lang.bind(this, this._changed)); + this._masterSettings.connect('changed', this._changed.bind(this)); + this._settings.connect('changed', this._changed.bind(this)); }, store() { @@ -591,9 +591,9 @@ var SourceActor = new Lang.Class({ this._size = size; this.actor = new Shell.GenericContainer(); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); this.actor.connect('destroy', () => { this._source.disconnect(this._iconUpdatedId); this._actorDestroyed = true; @@ -607,7 +607,7 @@ var SourceActor = new Lang.Class({ this.actor.add_actor(this._iconBin); - this._iconUpdatedId = this._source.connect('icon-updated', Lang.bind(this, this._updateIcon)); + this._iconUpdatedId = this._source.connect('icon-updated', this._updateIcon.bind(this)); this._updateIcon(); }, @@ -665,7 +665,7 @@ var SourceActorWithLabel = new Lang.Class({ this.actor.add_actor(this._counterBin); - this._countUpdatedId = this._source.connect('count-updated', Lang.bind(this, this._updateCount)); + this._countUpdatedId = this._source.connect('count-updated', this._updateCount.bind(this)); this._updateCount(); this.actor.connect('destroy', () => { @@ -789,8 +789,8 @@ var Source = new Lang.Class({ while (this.notifications.length >= MAX_NOTIFICATIONS_PER_SOURCE) this.notifications.shift().destroy(NotificationDestroyedReason.EXPIRED); - notification.connect('destroy', Lang.bind(this, this._onNotificationDestroy)); - notification.connect('acknowledged-changed', Lang.bind(this, this.countUpdated)); + notification.connect('destroy', this._onNotificationDestroy.bind(this)); + notification.connect('acknowledged-changed', this.countUpdated.bind(this)); this.notifications.push(notification); this.emit('notification-added', notification); @@ -880,9 +880,9 @@ var MessageTray = new Lang.Class({ x_expand: true, layout_manager: new Clutter.BinLayout() }); this._bannerBin.connect('key-release-event', - Lang.bind(this, this._onNotificationKeyRelease)); + this._onNotificationKeyRelease.bind(this)); this._bannerBin.connect('notify::hover', - Lang.bind(this, this._onNotificationHoverChanged)); + this._onNotificationHoverChanged.bind(this)); this.actor.add_actor(this._bannerBin); this._notificationFocusGrabber = new FocusGrabber(this._bannerBin); @@ -915,35 +915,35 @@ var MessageTray = new Lang.Class({ Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false }); Main.layoutManager.trackChrome(this._bannerBin, { affectsInputRegion: true }); - global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState)); + global.screen.connect('in-fullscreen-changed', this._updateState.bind(this)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); Main.overview.connect('window-drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.overview.connect('window-drag-cancelled', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('window-drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('item-drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.overview.connect('item-drag-cancelled', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('item-drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.xdndHandler.connect('drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.xdndHandler.connect('drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.wm.addKeybinding('focus-active-notification', new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), Meta.KeyBindingFlags.NONE, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._expandActiveNotification)); + this._expandActiveNotification.bind(this)); this._sources = new Map(); @@ -1008,8 +1008,10 @@ var MessageTray = new Lang.Class({ // Register that we got a notification for this source source.policy.store(); - source.policy.connect('enable-changed', Lang.bind(this, this._onSourceEnableChanged, source)); - source.policy.connect('policy-changed', Lang.bind(this, this._updateState)); + source.policy.connect('enable-changed', () => { + this._onSourceEnableChanged(source.policy, source); + }); + source.policy.connect('policy-changed', this._updateState.bind(this)); this._onSourceEnableChanged(source.policy, source); }, @@ -1022,8 +1024,8 @@ var MessageTray = new Lang.Class({ this._sources.set(source, obj); - obj.notifyId = source.connect('notify', Lang.bind(this, this._onNotify)); - obj.destroyId = source.connect('destroy', Lang.bind(this, this._onSourceDestroy)); + obj.notifyId = source.connect('notify', this._onNotify.bind(this)); + obj.destroyId = source.connect('destroy', this._onSourceDestroy.bind(this)); this.emit('source-added', source); }, @@ -1088,7 +1090,7 @@ var MessageTray = new Lang.Class({ let full = (this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE); if (!full || notification.urgency == Urgency.CRITICAL) { notification.connect('destroy', - Lang.bind(this, this._onNotificationDestroy)); + this._onNotificationDestroy.bind(this)); this._notificationQueue.push(notification); this._notificationQueue.sort( (n1, n2) => n2.urgency - n1.urgency @@ -1148,7 +1150,7 @@ var MessageTray = new Lang.Class({ // We wait for a longer period if the notification popped up where the mouse pointer was already positioned. // That gives the user more time to mouse away from the notification and mouse back in in order to expand it. let timeout = this._useLongerNotificationLeftTimeout ? LONGER_HIDE_TIMEOUT * 1000 : HIDE_TIMEOUT * 1000; - this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, this._onNotificationLeftTimeout)); + this._notificationLeftTimeoutId = Mainloop.timeout_add(timeout, this._onNotificationLeftTimeout.bind(this)); GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout'); } }, @@ -1178,7 +1180,7 @@ var MessageTray = new Lang.Class({ x > this._notificationLeftMouseX - MOUSE_LEFT_ACTOR_THRESHOLD) { this._notificationLeftMouseX = -1; this._notificationLeftTimeoutId = Mainloop.timeout_add(LONGER_HIDE_TIMEOUT * 1000, - Lang.bind(this, this._onNotificationLeftTimeout)); + this._onNotificationLeftTimeout.bind(this)); GLib.Source.set_name_by_id(this._notificationLeftTimeoutId, '[gnome-shell] this._onNotificationLeftTimeout'); } else { this._notificationLeftTimeoutId = 0; @@ -1301,12 +1303,12 @@ var MessageTray = new Lang.Class({ if (!this._userActiveWhileNotificationShown) { // If the user isn't active, set up a watch to let us know // when the user becomes active. - this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive)); + this.idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this)); } this._banner = this._notification.createBanner(); this._bannerClickedId = this._banner.connect('done-displaying', - Lang.bind(this, this._escapeTray)); + this._escapeTray.bind(this)); this._bannerUnfocusedId = this._banner.connect('unfocused', () => { this._updateState(); }); @@ -1384,7 +1386,7 @@ var MessageTray = new Lang.Class({ if (timeout > 0) { this._notificationTimeoutId = Mainloop.timeout_add(timeout, - Lang.bind(this, this._notificationTimeout)); + this._notificationTimeout.bind(this)); GLib.Source.set_name_by_id(this._notificationTimeoutId, '[gnome-shell] this._notificationTimeout'); } }, diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index b9d3030eb..f97a2338c 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -60,7 +60,7 @@ var ModalDialog = new Lang.Class({ coordinate: Clutter.BindCoordinate.ALL }); this._group.add_constraint(constraint); - this._group.connect('destroy', Lang.bind(this, this._onGroupDestroy)); + this._group.connect('destroy', this._onGroupDestroy.bind(this)); this.backgroundStack = new St.Widget({ layout_manager: new Clutter.BinLayout() }); this._backgroundBin = new St.Bin({ child: this.backgroundStack, @@ -194,8 +194,7 @@ var ModalDialog = new Lang.Class({ { opacity: 0, time: OPEN_AND_CLOSE_TIME, transition: 'easeOutQuad', - onComplete: Lang.bind(this, - this._closeComplete) + onComplete: this._closeComplete.bind(this) }) else this._closeComplete(); diff --git a/js/ui/mpris.js b/js/ui/mpris.js index 49b76d152..2e80e995d 100644 --- a/js/ui/mpris.js +++ b/js/ui/mpris.js @@ -74,8 +74,8 @@ var MediaMessage = new Lang.Class({ this._player.next(); }); - this._player.connect('changed', Lang.bind(this, this._update)); - this._player.connect('closed', Lang.bind(this, this.close)); + this._player.connect('changed', this._update.bind(this)); + this._player.connect('closed', this.close.bind(this)); this._update(); }, @@ -117,10 +117,10 @@ var MprisPlayer = new Lang.Class({ _init(busName) { this._mprisProxy = new MprisProxy(Gio.DBus.session, busName, '/org/mpris/MediaPlayer2', - Lang.bind(this, this._onMprisProxyReady)); + this._onMprisProxyReady.bind(this)); this._playerProxy = new MprisPlayerProxy(Gio.DBus.session, busName, '/org/mpris/MediaPlayer2', - Lang.bind(this, this._onPlayerProxyReady)); + this._onPlayerProxyReady.bind(this)); this._visible = false; this._trackArtists = []; @@ -199,7 +199,7 @@ var MprisPlayer = new Lang.Class({ _onPlayerProxyReady() { this._propsChangedId = this._playerProxy.connect('g-properties-changed', - Lang.bind(this, this._updateState)); + this._updateState.bind(this)); this._updateState(); }, @@ -238,7 +238,7 @@ var MediaSection = new Lang.Class({ this._proxy = new DBusProxy(Gio.DBus.session, 'org.freedesktop.DBus', '/org/freedesktop/DBus', - Lang.bind(this, this._onProxyReady)); + this._onProxyReady.bind(this)); }, _shouldShow() { @@ -272,7 +272,7 @@ var MediaSection = new Lang.Class({ }); }); this._proxy.connectSignal('NameOwnerChanged', - Lang.bind(this, this._onNameOwnerChanged)); + this._onNameOwnerChanged.bind(this)); }, _onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) { diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index d08634dfd..9f085629f 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -106,9 +106,9 @@ var FdoNotificationDaemon = new Lang.Class({ this._nextNotificationId = 1; Shell.WindowTracker.get_default().connect('notify::focus-app', - Lang.bind(this, this._onFocusAppChanged)); + this._onFocusAppChanged.bind(this)); Main.overview.connect('hidden', - Lang.bind(this, this._onFocusAppChanged)); + this._onFocusAppChanged.bind(this)); }, _imageForNotificationData(hints) { @@ -480,7 +480,7 @@ var FdoNotificationDaemonSource = new Lang.Class({ this._nameWatcherId = Gio.DBus.session.watch_name(sender, Gio.BusNameWatcherFlags.NONE, null, - Lang.bind(this, this._onNameVanished)); + this._onNameVanished.bind(this)); else this._nameWatcherId = 0; }, @@ -614,8 +614,9 @@ var GtkNotificationDaemonNotification = new Lang.Class({ if (buttons) { buttons.deep_unpack().forEach(button => { - this.addAction(button.label.unpack(), - Lang.bind(this, this._onButtonClicked, button)); + this.addAction(button.label.unpack(), () => { + this._onButtonClicked(button); + }); }); } @@ -811,7 +812,7 @@ var GtkNotificationDaemon = new Lang.Class({ delete this._sources[appId]; this._saveNotifications(); }); - source.connect('count-updated', Lang.bind(this, this._saveNotifications)); + source.connect('count-updated', this._saveNotifications.bind(this)); Main.messageTray.add(source); this._sources[appId] = source; return source; diff --git a/js/ui/osdMonitorLabeler.js b/js/ui/osdMonitorLabeler.js index d6f199293..961844f1e 100644 --- a/js/ui/osdMonitorLabeler.js +++ b/js/ui/osdMonitorLabeler.js @@ -62,7 +62,7 @@ var OsdMonitorLabeler = new Lang.Class({ this._osdLabels = []; this._monitorLabels = null; Main.layoutManager.connect('monitors-changed', - Lang.bind(this, this._reset)); + this._reset.bind(this)); this._reset(); }, diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index 5c9ea49f5..f27f48965 100644 --- a/js/ui/osdWindow.js +++ b/js/ui/osdWindow.js @@ -109,10 +109,10 @@ var OsdWindow = new Lang.Class({ this._reset(); Main.layoutManager.connect('monitors-changed', - Lang.bind(this, this._relayout)); + this._relayout.bind(this)); let themeContext = St.ThemeContext.get_for_stage(global.stage); themeContext.connect('notify::scale-factor', - Lang.bind(this, this._relayout)); + this._relayout.bind(this)); this._relayout(); Main.uiGroup.add_child(this.actor); }, @@ -159,7 +159,7 @@ var OsdWindow = new Lang.Class({ if (this._hideTimeoutId) Mainloop.source_remove(this._hideTimeoutId); this._hideTimeoutId = Mainloop.timeout_add(HIDE_TIMEOUT, - Lang.bind(this, this._hide)); + this._hide.bind(this)); GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide'); }, @@ -215,7 +215,7 @@ var OsdWindowManager = new Lang.Class({ _init() { this._osdWindows = []; Main.layoutManager.connect('monitors-changed', - Lang.bind(this, this._monitorsChanged)); + this._monitorsChanged.bind(this)); this._monitorsChanged(); }, diff --git a/js/ui/overview.js b/js/ui/overview.js index fdd5cfeec..3d8d76b57 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -80,7 +80,7 @@ var ShellInfo = new Lang.Class({ this._undoCallback = undoCallback; if (undoCallback) - notification.addAction(_("Undo"), Lang.bind(this, this._onUndoClicked)); + notification.addAction(_("Undo"), this._onUndoClicked.bind(this)); this._source.notify(notification); } @@ -93,7 +93,7 @@ var Overview = new Lang.Class({ this._overviewCreated = false; this._initCalled = false; - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, @@ -148,16 +148,16 @@ var Overview = new Lang.Class({ // XDND this._dragMonitor = { - dragMotion: Lang.bind(this, this._onDragMotion) + dragMotion: this._onDragMotion.bind(this) }; Main.layoutManager.overviewGroup.connect('scroll-event', - Lang.bind(this, this._onScrollEvent)); - Main.xdndHandler.connect('drag-begin', Lang.bind(this, this._onDragBegin)); - Main.xdndHandler.connect('drag-end', Lang.bind(this, this._onDragEnd)); + this._onScrollEvent.bind(this)); + Main.xdndHandler.connect('drag-begin', this._onDragBegin.bind(this)); + Main.xdndHandler.connect('drag-end', this._onDragEnd.bind(this)); - global.screen.connect('restacked', Lang.bind(this, this._onRestacked)); + global.screen.connect('restacked', this._onRestacked.bind(this)); this._windowSwitchTimeoutId = 0; this._windowSwitchTimestamp = 0; @@ -257,7 +257,7 @@ var Overview = new Lang.Class({ this.dashIconSize = this._dash.iconSize; }); - Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout)); + Main.layoutManager.connect('monitors-changed', this._relayout.bind(this)); this._relayout(); }, diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index ec533c0f2..a2905abb9 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -119,15 +119,15 @@ var SlidingControl = new Lang.Class({ style_class: 'overview-controls', clip_to_allocation: true }); - Main.overview.connect('hiding', Lang.bind(this, this._onOverviewHiding)); + Main.overview.connect('hiding', this._onOverviewHiding.bind(this)); - Main.overview.connect('item-drag-begin', Lang.bind(this, this._onDragBegin)); - Main.overview.connect('item-drag-end', Lang.bind(this, this._onDragEnd)); - Main.overview.connect('item-drag-cancelled', Lang.bind(this, this._onDragEnd)); + Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this)); + Main.overview.connect('item-drag-end', this._onDragEnd.bind(this)); + Main.overview.connect('item-drag-cancelled', this._onDragEnd.bind(this)); - Main.overview.connect('window-drag-begin', Lang.bind(this, this._onWindowDragBegin)); - Main.overview.connect('window-drag-cancelled', Lang.bind(this, this._onWindowDragEnd)); - Main.overview.connect('window-drag-end', Lang.bind(this, this._onWindowDragEnd)); + Main.overview.connect('window-drag-begin', this._onWindowDragBegin.bind(this)); + Main.overview.connect('window-drag-cancelled', this._onWindowDragEnd.bind(this)); + Main.overview.connect('window-drag-end', this._onWindowDragEnd.bind(this)); }, _getSlide() { @@ -252,8 +252,8 @@ var ThumbnailsSlider = new Lang.Class({ this.actor.track_hover = true; this.actor.add_actor(this._thumbnailsBox.actor); - Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._updateSlide)); - this.actor.connect('notify::hover', Lang.bind(this, this._updateSlide)); + Main.layoutManager.connect('monitors-changed', this._updateSlide.bind(this)); + this.actor.connect('notify::hover', this._updateSlide.bind(this)); this._thumbnailsBox.actor.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE); }, @@ -328,7 +328,7 @@ var DashSlider = new Lang.Class({ this.actor.add_actor(this._dash.actor); - this._dash.connect('icon-size-changed', Lang.bind(this, this._updateSlide)); + this._dash.connect('icon-size-changed', this._updateSlide.bind(this)); }, _getSlide() { @@ -410,8 +410,8 @@ var ControlsManager = new Lang.Class({ this.viewSelector = new ViewSelector.ViewSelector(searchEntry, this.dash.showAppsButton); - this.viewSelector.connect('page-changed', Lang.bind(this, this._setVisibility)); - this.viewSelector.connect('page-empty', Lang.bind(this, this._onPageEmpty)); + this.viewSelector.connect('page-changed', this._setVisibility.bind(this)); + this.viewSelector.connect('page-empty', this._onPageEmpty.bind(this)); let layout = new ControlsLayout(); this.actor = new St.Widget({ layout_manager: layout, @@ -428,9 +428,9 @@ var ControlsManager = new Lang.Class({ expand: true }); this._group.add_actor(this._thumbnailsSlider.actor); - layout.connect('allocation-changed', Lang.bind(this, this._updateWorkspacesGeometry)); + layout.connect('allocation-changed', this._updateWorkspacesGeometry.bind(this)); - Main.overview.connect('showing', Lang.bind(this, this._updateSpacerVisibility)); + Main.overview.connect('showing', this._updateSpacerVisibility.bind(this)); Main.overview.connect('item-drag-begin', () => { let activePage = this.viewSelector.getActivePage(); if (activePage != ViewSelector.ViewPage.WINDOWS) diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 8fd2beb8b..9b5986985 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -49,7 +49,7 @@ var PadChooser = new Lang.Class({ this.actor.set_child(arrow); this._ensureMenu(groupDevices); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('clicked', actor => { if (actor.get_checked()) { if (this._padChooserMenu != null) @@ -104,7 +104,7 @@ var KeybindingEntry = new Lang.Class({ _init() { this.actor = new St.Entry({ hint_text: _("New shortcut…"), style: 'width: 10em' }); - this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); + this.actor.connect('captured-event', this._onCapturedEvent.bind(this)); }, _onCapturedEvent(actor, event) { @@ -127,7 +127,7 @@ var ActionComboBox = new Lang.Class({ _init() { this.actor = new St.Button({ style_class: 'button' }); - this.actor.connect('clicked', Lang.bind(this, this._onButtonClicked)); + this.actor.connect('clicked', this._onButtonClicked.bind(this)); this.actor.set_toggle_mode(true); let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL, @@ -216,17 +216,17 @@ var ActionEditor = new Lang.Class({ this.actor = new St.Widget({ layout_manager: boxLayout }); this._actionComboBox = new ActionComboBox(); - this._actionComboBox.connect('action-selected', Lang.bind(this, this._onActionSelected)); + this._actionComboBox.connect('action-selected', this._onActionSelected.bind(this)); this.actor.add_actor(this._actionComboBox.actor); this._keybindingEdit = new KeybindingEntry(); - this._keybindingEdit.connect('keybinding-edited', Lang.bind(this, this._onKeybindingEdited)); + this._keybindingEdit.connect('keybinding-edited', this._onKeybindingEdited.bind(this)); this.actor.add_actor(this._keybindingEdit.actor); this._doneButton = new St.Button({ label: _("Done"), style_class: 'button', x_expand: false}); - this._doneButton.connect('clicked', Lang.bind(this, this._onEditingDone)); + this._doneButton.connect('clicked', this._onEditingDone.bind(this)); this.actor.add_actor(this._doneButton); }, @@ -634,7 +634,7 @@ var PadOsd = new Lang.Class({ this._settings = settings; this._imagePath = imagePath; this._editionMode = editionMode; - this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); + this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this)); this._padChooser = null; let deviceManager = Clutter.DeviceManager.get_default(); @@ -670,7 +670,7 @@ var PadOsd = new Lang.Class({ y_expand: true, vertical: true, reactive: true }); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); Main.uiGroup.add_actor(this.actor); this._monitorIndex = monitorIndex; @@ -698,7 +698,7 @@ var PadOsd = new Lang.Class({ this._updatePadChooser(); this._actionEditor = new ActionEditor(); - this._actionEditor.connect('done', Lang.bind(this, this._endActionEdition)); + this._actionEditor.connect('done', this._endActionEdition.bind(this)); this._padDiagram = new PadDiagram({ image: this._imagePath, left_handed: settings.get_boolean('left-handed'), diff --git a/js/ui/panel.js b/js/ui/panel.js index a5dedf8a3..2f593247d 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -102,7 +102,7 @@ var AppMenuButton = new Lang.Class({ this._busyNotifyId = 0; let bin = new St.Bin({ name: 'appMenu' }); - bin.connect('style-changed', Lang.bind(this, this._onStyleChanged)); + bin.connect('style-changed', this._onStyleChanged.bind(this)); this.actor.add_actor(bin); this.actor.bind_property("reactive", this.actor, "can-focus", 0); @@ -113,7 +113,7 @@ var AppMenuButton = new Lang.Class({ let textureCache = St.TextureCache.get_default(); textureCache.connect('icon-theme-changed', - Lang.bind(this, this._onIconThemeChanged)); + this._onIconThemeChanged.bind(this)); this._iconBox = new St.Bin({ style_class: 'app-menu-icon' }); this._container.add_actor(this._iconBox); @@ -128,10 +128,10 @@ var AppMenuButton = new Lang.Class({ !Main.overview.visible; if (!this._visible) this.actor.hide(); - this._overviewHidingId = Main.overview.connect('hiding', Lang.bind(this, this._sync)); - this._overviewShowingId = Main.overview.connect('showing', Lang.bind(this, this._sync)); + this._overviewHidingId = Main.overview.connect('hiding', this._sync.bind(this)); + this._overviewShowingId = Main.overview.connect('showing', this._sync.bind(this)); this._showsAppMenuId = this._gtkSettings.connect('notify::gtk-shell-shows-app-menu', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._stop = true; @@ -140,11 +140,11 @@ var AppMenuButton = new Lang.Class({ let tracker = Shell.WindowTracker.get_default(); let appSys = Shell.AppSystem.get_default(); this._focusAppNotifyId = - tracker.connect('notify::focus-app', Lang.bind(this, this._focusAppChanged)); + tracker.connect('notify::focus-app', this._focusAppChanged.bind(this)); this._appStateChangedSignalId = - appSys.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged)); + appSys.connect('app-state-changed', this._onAppStateChanged.bind(this)); this._switchWorkspaceNotifyId = - global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync)); + global.window_manager.connect('switch-workspace', this._sync.bind(this)); this._sync(); }, @@ -298,9 +298,9 @@ var AppMenuButton = new Lang.Class({ this._targetApp = targetApp; if (this._targetApp) { - this._appMenuNotifyId = this._targetApp.connect('notify::menu', Lang.bind(this, this._sync)); - this._actionGroupNotifyId = this._targetApp.connect('notify::action-group', Lang.bind(this, this._sync)); - this._busyNotifyId = this._targetApp.connect('notify::busy', Lang.bind(this, this._sync)); + this._appMenuNotifyId = this._targetApp.connect('notify::menu', this._sync.bind(this)); + this._actionGroupNotifyId = this._targetApp.connect('notify::action-group', this._sync.bind(this)); + this._busyNotifyId = this._targetApp.connect('notify::busy', this._sync.bind(this)); this._label.set_text(this._targetApp.get_name()); this.actor.set_accessible_name(this._targetApp.get_name()); } @@ -414,8 +414,8 @@ var ActivitiesButton = new Lang.Class({ this.actor.label_actor = this._label; - this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); - this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease)); + this.actor.connect('captured-event', this._onCapturedEvent.bind(this)); + this.actor.connect_after('key-release-event', this._onKeyRelease.bind(this)); Main.overview.connect('showing', () => { this.actor.add_style_pseudo_class('overview'); @@ -435,8 +435,9 @@ var ActivitiesButton = new Lang.Class({ if (this._xdndTimeOut != 0) Mainloop.source_remove(this._xdndTimeOut); - this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, - Lang.bind(this, this._xdndToggleOverview, actor)); + this._xdndTimeOut = Mainloop.timeout_add(BUTTON_DND_ACTIVATION_TIMEOUT, () => { + this._xdndToggleOverview(actor); + }); GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview'); return DND.DragMotionResult.CONTINUE; @@ -491,8 +492,8 @@ var PanelCorner = new Lang.Class({ this._side = side; this.actor = new St.DrawingArea({ style_class: 'panel-corner' }); - this.actor.connect('style-changed', Lang.bind(this, this._styleChanged)); - this.actor.connect('repaint', Lang.bind(this, this._repaint)); + this.actor.connect('style-changed', this._styleChanged.bind(this)); + this.actor.connect('repaint', this._repaint.bind(this)); }, _findRightmostButton(container) { @@ -791,11 +792,11 @@ var Panel = new Lang.Class({ this._rightCorner = new PanelCorner(St.Side.RIGHT); this.actor.add_actor(this._rightCorner.actor); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); - this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress)); - this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); + this.actor.connect('button-press-event', this._onButtonPress.bind(this)); + this.actor.connect('key-press-event', this._onKeyPress.bind(this)); Main.overview.connect('showing', () => { this.actor.add_style_pseudo_class('overview'); @@ -810,12 +811,12 @@ var Panel = new Lang.Class({ Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'focus-top-bar-symbolic', { sortGroup: CtrlAltTab.SortGroup.TOP }); - Main.sessionMode.connect('updated', Lang.bind(this, this._updatePanel)); + Main.sessionMode.connect('updated', this._updatePanel.bind(this)); this._trackedWindows = new Map(); - global.window_group.connect('actor-added', Lang.bind(this, this._onWindowActorAdded)); - global.window_group.connect('actor-removed', Lang.bind(this, this._onWindowActorRemoved)); - global.window_manager.connect('switch-workspace', Lang.bind(this, this._updateSolidStyle)); + global.window_group.connect('actor-added', this._onWindowActorAdded.bind(this)); + global.window_group.connect('actor-removed', this._onWindowActorRemoved.bind(this)); + global.window_manager.connect('switch-workspace', this._updateSolidStyle.bind(this)); global.screen.connect('workareas-changed', () => { this.actor.queue_relayout(); }); this._updatePanel(); @@ -824,7 +825,7 @@ var Panel = new Lang.Class({ _onWindowActorAdded(container, metaWindowActor) { let signalIds = []; ['allocation-changed', 'notify::visible'].forEach(s => { - signalIds.push(metaWindowActor.connect(s, Lang.bind(this, this._updateSolidStyle))); + signalIds.push(metaWindowActor.connect(s, this._updateSolidStyle.bind(this))); }); this._trackedWindows.set(metaWindowActor, signalIds); }, @@ -1151,7 +1152,7 @@ var Panel = new Lang.Class({ emitter.disconnect(destroyId); container.destroy(); }); - indicator.connect('menu-set', Lang.bind(this, this._onMenuSet)); + indicator.connect('menu-set', this._onMenuSet.bind(this)); this._onMenuSet(indicator); }, diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index a503d98fa..b23d8e49f 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -25,11 +25,11 @@ var ButtonBox = new Lang.Class({ x_fill: true, child: this.actor }); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); - this.actor.connect('style-changed', Lang.bind(this, this._onStyleChanged)); + this.actor.connect('style-changed', this._onStyleChanged.bind(this)); this._minHPadding = this._natHPadding = 0.0; }, @@ -100,8 +100,8 @@ var Button = new Lang.Class({ accessible_name: nameText ? nameText : "", accessible_role: Atk.Role.MENU }); - this.actor.connect('event', Lang.bind(this, this._onEvent)); - this.actor.connect('notify::visible', Lang.bind(this, this._onVisibilityChanged)); + this.actor.connect('event', this._onEvent.bind(this)); + this.actor.connect('notify::visible', this._onVisibilityChanged.bind(this)); if (dontCreateMenu) this.menu = new PopupMenu.PopupDummyMenu(this.actor); @@ -122,8 +122,8 @@ var Button = new Lang.Class({ this.menu = menu; if (this.menu) { this.menu.actor.add_style_class_name('panel-menu'); - this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged)); - this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress)); + this.menu.connect('open-state-changed', this._onOpenStateChanged.bind(this)); + this.menu.actor.connect('key-press-event', this._onMenuKeyPress.bind(this)); Main.uiGroup.add_actor(this.menu.actor); this.menu.actor.hide(); @@ -220,7 +220,7 @@ var SystemIndicator = new Lang.Class({ _addIndicator() { let icon = new St.Icon({ style_class: 'system-status-icon' }); this.indicators.add_actor(icon); - icon.connect('notify::visible', Lang.bind(this, this._syncIndicatorsVisible)); + icon.connect('notify::visible', this._syncIndicatorsVisible.bind(this)); this._syncIndicatorsVisible(); return icon; } diff --git a/js/ui/pointerWatcher.js b/js/ui/pointerWatcher.js index 957fc663a..3b1fbdb8f 100644 --- a/js/ui/pointerWatcher.js +++ b/js/ui/pointerWatcher.js @@ -44,7 +44,7 @@ var PointerWatcher = new Lang.Class({ _init() { this._idleMonitor = Meta.IdleMonitor.get_core(); - this._idleMonitor.add_idle_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle)); + this._idleMonitor.add_idle_watch(IDLE_TIME, this._onIdleMonitorBecameIdle.bind(this)); this._idle = this._idleMonitor.get_idletime() > IDLE_TIME; this._watches = []; this.pointerX = null; @@ -88,7 +88,7 @@ var PointerWatcher = new Lang.Class({ _onIdleMonitorBecameIdle(monitor) { this._idle = true; - this._idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive)); + this._idleMonitor.add_user_active_watch(this._onIdleMonitorBecameActive.bind(this)); this._updateTimeout(); }, @@ -106,7 +106,7 @@ var PointerWatcher = new Lang.Class({ minInterval = Math.min(this._watches[i].interval, minInterval); this._timeoutId = Mainloop.timeout_add(minInterval, - Lang.bind(this, this._onTimeout)); + this._onTimeout.bind(this)); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout'); }, diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 353b30027..67b928c69 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -92,17 +92,17 @@ var PopupBaseMenuItem = new Lang.Class({ this.actor.add_style_class_name(params.style_class); if (this._activatable) { - this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPressEvent)); - this.actor.connect('button-release-event', Lang.bind(this, this._onButtonReleaseEvent)); - this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent)); - this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); + this.actor.connect('button-press-event', this._onButtonPressEvent.bind(this)); + this.actor.connect('button-release-event', this._onButtonReleaseEvent.bind(this)); + this.actor.connect('touch-event', this._onTouchEvent.bind(this)); + this.actor.connect('key-press-event', this._onKeyPressEvent.bind(this)); } if (params.reactive && params.hover) - this.actor.connect('notify::hover', Lang.bind(this, this._onHoverChanged)); + this.actor.connect('notify::hover', this._onHoverChanged.bind(this)); - this.actor.connect('key-focus-in', Lang.bind(this, this._onKeyFocusIn)); - this.actor.connect('key-focus-out', Lang.bind(this, this._onKeyFocusOut)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('key-focus-in', this._onKeyFocusIn.bind(this)); + this.actor.connect('key-focus-out', this._onKeyFocusOut.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); }, _getTopMenu() { @@ -262,7 +262,7 @@ var PopupSeparatorMenuItem = new Lang.Class({ this.actor.label_actor = this.label; this.label.connect('notify::text', - Lang.bind(this, this._syncVisibility)); + this._syncVisibility.bind(this)); this._syncVisibility(); this._separator = new St.Widget({ style_class: 'popup-separator-menu-item', @@ -439,7 +439,7 @@ var PopupMenuBase = new Lang.Class({ this._sensitive = true; - this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + this._sessionUpdatedId = Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); }, _getTopMenu() { @@ -650,7 +650,7 @@ var PopupMenuBase = new Lang.Class({ } if (menuItem instanceof PopupMenuSection) { - let activeChangeId = menuItem.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged)); + let activeChangeId = menuItem.connect('active-changed', this._subMenuActiveChanged.bind(this)); let parentOpenStateChangedId = this.connect('open-state-changed', (self, open) => { if (open) @@ -679,7 +679,7 @@ var PopupMenuBase = new Lang.Class({ this.box.insert_child_below(menuItem.menu.actor, before_item); this._connectItemSignals(menuItem); - let subMenuActiveChangeId = menuItem.menu.connect('active-changed', Lang.bind(this, this._subMenuActiveChanged)); + let subMenuActiveChangeId = menuItem.menu.connect('active-changed', this._subMenuActiveChanged.bind(this)); let closingId = this.connect('menu-closed', () => { menuItem.menu.close(BoxPointer.PopupAnimation.NONE); }); @@ -784,7 +784,7 @@ var PopupMenu = new Lang.Class({ if (this.sourceActor) this._keyPressId = this.sourceActor.connect('key-press-event', - Lang.bind(this, this._onKeyPress)); + this._onKeyPress.bind(this)); this._openedSubMenu = null; }, @@ -935,7 +935,7 @@ var PopupSubMenu = new Lang.Class({ this.actor.add_actor(this.box); this.actor._delegate = this; this.actor.clip_to_allocation = true; - this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); + this.actor.connect('key-press-event', this._onKeyPressEvent.bind(this)); this.actor.hide(); }, @@ -1116,7 +1116,7 @@ var PopupSubMenuMenuItem = new Lang.Class({ this.actor.add_accessible_state (Atk.StateType.EXPANDABLE); this.menu = new PopupSubMenu(this.actor, this._triangle); - this.menu.connect('open-state-changed', Lang.bind(this, this._subMenuOpenStateChanged)); + this.menu.connect('open-state-changed', this._subMenuOpenStateChanged.bind(this)); }, _setParent(parent) { @@ -1224,8 +1224,8 @@ var PopupMenuManager = new Lang.Class({ let menudata = { menu: menu, - openStateChangeId: menu.connect('open-state-changed', Lang.bind(this, this._onMenuOpenState)), - destroyId: menu.connect('destroy', Lang.bind(this, this._onMenuDestroy)), + openStateChangeId: menu.connect('open-state-changed', this._onMenuOpenState.bind(this)), + destroyId: menu.connect('destroy', this._onMenuDestroy.bind(this)), enterId: 0, focusInId: 0 }; @@ -1286,7 +1286,9 @@ var PopupMenuManager = new Lang.Class({ if (this.activeMenu) this.activeMenu.close(BoxPointer.PopupAnimation.FADE); this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor, - onUngrab: Lang.bind(this, this._closeMenu, menu) }); + onUngrab: isUser => { + this._closeMenu(isUser, menu); + } }); } else { this._grabHelper.ungrab({ actor: menu.actor }); } diff --git a/js/ui/remoteMenu.js b/js/ui/remoteMenu.js index 9688f9a83..848ab7537 100644 --- a/js/ui/remoteMenu.js +++ b/js/ui/remoteMenu.js @@ -44,7 +44,7 @@ var RemoteMenuSeparatorItemMapper = new Lang.Class({ _init(trackerItem) { this._trackerItem = trackerItem; this.menuItem = new PopupMenu.PopupSeparatorMenuItem(); - this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel)); + this._trackerItem.connect('notify::label', this._updateLabel.bind(this)); this._updateLabel(); this.menuItem.connect('destroy', () => { @@ -82,7 +82,7 @@ var RemoteMenuSubmenuItemMapper = new Lang.Class({ _init(trackerItem) { this._trackerItem = trackerItem; this.menuItem = new RequestSubMenu(); - this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel)); + this._trackerItem.connect('notify::label', this._updateLabel.bind(this)); this._updateLabel(); this._tracker = Shell.MenuTracker.new_for_item_submenu(this._trackerItem, @@ -129,10 +129,10 @@ var RemoteMenuItemMapper = new Lang.Class({ this._trackerItem.bind_property('visible', this.menuItem.actor, 'visible', GObject.BindingFlags.SYNC_CREATE); - this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel)); - this._trackerItem.connect('notify::sensitive', Lang.bind(this, this._updateSensitivity)); - this._trackerItem.connect('notify::role', Lang.bind(this, this._updateRole)); - this._trackerItem.connect('notify::toggled', Lang.bind(this, this._updateDecoration)); + this._trackerItem.connect('notify::label', this._updateLabel.bind(this)); + this._trackerItem.connect('notify::sensitive', this._updateSensitivity.bind(this)); + this._trackerItem.connect('notify::role', this._updateRole.bind(this)); + this._trackerItem.connect('notify::toggled', this._updateDecoration.bind(this)); this._updateLabel(); this._updateSensitivity(); diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index adc9601ec..1e8e6c947 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -261,13 +261,17 @@ var RemoteSearchProvider = new Lang.Class({ getInitialResultSet(terms, callback, cancellable) { this.proxy.GetInitialResultSetRemote(terms, - Lang.bind(this, this._getResultsFinished, callback), + (results, error) => { + this._getResultsFinished(results, error, callback); + }, cancellable); }, getSubsearchResultSet(previousResults, newTerms, callback, cancellable) { this.proxy.GetSubsearchResultSetRemote(previousResults, newTerms, - Lang.bind(this, this._getResultsFinished, callback), + (results, error) => { + this._getResultsFinished(results, error, callback); + }, cancellable); }, @@ -290,8 +294,9 @@ var RemoteSearchProvider = new Lang.Class({ resultMetas.push({ id: metas[i]['id'], name: metas[i]['name'], description: metas[i]['description'], - createIcon: Lang.bind(this, - this.createIcon, metas[i]), + createIcon: size => { + this.createIcon(size, metas[i]); + }, clipboardText: metas[i]['clipboardText'] }); } callback(resultMetas); @@ -299,7 +304,9 @@ var RemoteSearchProvider = new Lang.Class({ getResultMetas(ids, callback, cancellable) { this.proxy.GetResultMetasRemote(ids, - Lang.bind(this, this._getResultMetasFinished, callback), + (results, error) => { + this._getResultMetasFinished(results, error, callback); + }, cancellable); }, diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 6af49a2f8..82deab5a3 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -49,10 +49,10 @@ var RunDialog = new Lang.Class({ Main.createLookingGlass().open(); }, - 'r': Lang.bind(this, this._restart), + 'r': this._restart.bind(this), // Developer brain backwards compatibility - 'restart': Lang.bind(this, this._restart), + 'restart': this._restart.bind(this), 'debugexit': () => { Meta.quit(Meta.ExitCode.ERROR); @@ -106,7 +106,7 @@ var RunDialog = new Lang.Class({ this._errorBox.hide(); - this.setButtons([{ action: Lang.bind(this, this.close), + this.setButtons([{ action: this.close.bind(this), label: _("Close"), key: Clutter.Escape }]); diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 69aa81547..2d8d9b3f6 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -74,7 +74,7 @@ var Clock = new Lang.Class({ this.actor.add(this._date, { x_align: St.Align.MIDDLE }); this._wallClock = new GnomeDesktop.WallClock({ time_only: true }); - this._wallClock.connect('notify::clock', Lang.bind(this, this._updateClock)); + this._wallClock.connect('notify::clock', this._updateClock.bind(this)); this._updateClock(); }, @@ -117,7 +117,7 @@ var NotificationsBox = new Lang.Class({ }); this._updateVisibility(); - this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded)); + this._sourceAddedId = Main.messageTray.connect('source-added', this._sourceAdded.bind(this)); }, destroy() { @@ -353,7 +353,7 @@ var Arrow = new Lang.Class({ this.x_fill = this.y_fill = true; this._drawingArea = new St.DrawingArea(); - this._drawingArea.connect('repaint', Lang.bind(this, this._drawArrow)); + this._drawingArea.connect('repaint', this._drawArrow.bind(this)); this.child = this._drawingArea; this._shadowHelper = null; @@ -445,9 +445,9 @@ var ScreenShield = new Lang.Class({ visible: false, }); this._lockScreenGroup.connect('key-press-event', - Lang.bind(this, this._onLockScreenKeyPress)); + this._onLockScreenKeyPress.bind(this)); this._lockScreenGroup.connect('scroll-event', - Lang.bind(this, this._onLockScreenScroll)); + this._onLockScreenScroll.bind(this)); Main.ctrlAltTabManager.addGroup(this._lockScreenGroup, _("Lock"), 'changes-prevent-symbolic'); this._lockScreenContents = new St.Widget({ layout_manager: new Clutter.BinLayout(), @@ -463,7 +463,7 @@ var ScreenShield = new Lang.Class({ this._bgManagers = []; this._updateBackgrounds(); - Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._updateBackgrounds)); + Main.layoutManager.connect('monitors-changed', this._updateBackgrounds.bind(this)); this._arrowAnimationId = 0; this._arrowWatchId = 0; @@ -484,9 +484,9 @@ var ScreenShield = new Lang.Class({ this._lockScreenContents.add_actor(this._arrowContainer); this._dragAction = new Clutter.GestureAction(); - this._dragAction.connect('gesture-begin', Lang.bind(this, this._onDragBegin)); - this._dragAction.connect('gesture-progress', Lang.bind(this, this._onDragMotion)); - this._dragAction.connect('gesture-end', Lang.bind(this, this._onDragEnd)); + this._dragAction.connect('gesture-begin', this._onDragBegin.bind(this)); + this._dragAction.connect('gesture-progress', this._onDragMotion.bind(this)); + this._dragAction.connect('gesture-end', this._onDragEnd.bind(this)); this._lockScreenGroup.add_action(this._dragAction); this._lockDialogGroup = new St.Widget({ x_expand: true, @@ -528,7 +528,7 @@ var ScreenShield = new Lang.Class({ this._loginManager = LoginManager.getLoginManager(); this._loginManager.connect('prepare-for-sleep', - Lang.bind(this, this._prepareForSleep)); + this._prepareForSleep.bind(this)); this._loginSession = null; this._loginManager.getCurrentSessionProxy(sessionProxy => { @@ -537,15 +537,15 @@ var ScreenShield = new Lang.Class({ () => { this.lock(false); }); this._loginSession.connectSignal('Unlock', () => { this.deactivate(false); }); - this._loginSession.connect('g-properties-changed', Lang.bind(this, this._syncInhibitor)); + this._loginSession.connect('g-properties-changed', this._syncInhibitor.bind(this)); this._syncInhibitor(); }); this._settings = new Gio.Settings({ schema_id: SCREENSAVER_SCHEMA }); - this._settings.connect('changed::' + LOCK_ENABLED_KEY, Lang.bind(this, this._syncInhibitor)); + this._settings.connect('changed::' + LOCK_ENABLED_KEY, this._syncInhibitor.bind(this)); this._lockSettings = new Gio.Settings({ schema_id: LOCKDOWN_SCHEMA }); - this._lockSettings.connect('changed::' + DISABLE_LOCK_KEY, Lang.bind(this, this._syncInhibitor)); + this._lockSettings.connect('changed::' + DISABLE_LOCK_KEY, this._syncInhibitor.bind(this)); this._isModal = false; this._hasLockScreen = false; @@ -563,11 +563,11 @@ var ScreenShield = new Lang.Class({ this._longLightbox = new Lightbox.Lightbox(Main.uiGroup, { inhibitEvents: true, fadeFactor: 1 }); - this._longLightbox.connect('shown', Lang.bind(this, this._onLongLightboxShown)); + this._longLightbox.connect('shown', this._onLongLightboxShown.bind(this)); this._shortLightbox = new Lightbox.Lightbox(Main.uiGroup, { inhibitEvents: true, fadeFactor: 1 }); - this._shortLightbox.connect('shown', Lang.bind(this, this._onShortLightboxShown)); + this._shortLightbox.connect('shown', this._onShortLightboxShown.bind(this)); this.idleMonitor = Meta.IdleMonitor.get_core(); this._cursorTracker = Meta.CursorTracker.get_for_screen(global.screen); @@ -862,7 +862,7 @@ var ScreenShield = new Lang.Class({ lightbox.show(time); if (this._becameActiveId == 0) - this._becameActiveId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onUserBecameActive)); + this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this)); }, _onUserBecameActive() { @@ -954,7 +954,7 @@ var ScreenShield = new Lang.Class({ { y: -h, time: time, transition: 'easeInQuad', - onComplete: Lang.bind(this, this._hideLockScreenComplete), + onComplete: this._hideLockScreenComplete.bind(this), }); } else { this._hideLockScreenComplete(); @@ -984,7 +984,7 @@ var ScreenShield = new Lang.Class({ return false; } - this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed)); + this._dialog.connect('failed', this._onUnlockFailed.bind(this)); } this._dialog.allowCancel = allowCancel; @@ -1042,14 +1042,14 @@ var ScreenShield = new Lang.Class({ this._arrowActiveWatchId = 0; if (!this._arrowAnimationId) { - this._arrowAnimationId = Mainloop.timeout_add(6000, Lang.bind(this, this._animateArrows)); + this._arrowAnimationId = Mainloop.timeout_add(6000, this._animateArrows.bind(this)); GLib.Source.set_name_by_id(this._arrowAnimationId, '[gnome-shell] this._animateArrows'); this._animateArrows(); } if (!this._arrowWatchId) this._arrowWatchId = this.idleMonitor.add_idle_watch(ARROW_IDLE_TIME, - Lang.bind(this, this._pauseArrowAnimation)); + this._pauseArrowAnimation.bind(this)); }, _pauseArrowAnimation() { @@ -1059,7 +1059,7 @@ var ScreenShield = new Lang.Class({ } if (!this._arrowActiveWatchId) - this._arrowActiveWatchId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._startArrowAnimation)); + this._arrowActiveWatchId = this.idleMonitor.add_user_active_watch(this._startArrowAnimation.bind(this)); }, _stopArrowAnimation() { @@ -1148,7 +1148,7 @@ var ScreenShield = new Lang.Class({ this._lockScreenContents.add_actor(this._lockScreenContentsBox); this._notificationsBox = new NotificationsBox(); - this._wakeUpScreenId = this._notificationsBox.connect('wake-up-screen', Lang.bind(this, this._wakeUpScreen)); + this._wakeUpScreenId = this._notificationsBox.connect('wake-up-screen', this._wakeUpScreen.bind(this)); this._lockScreenContentsBox.add(this._notificationsBox.actor, { x_fill: true, y_fill: true, expand: true }); @@ -1234,7 +1234,7 @@ var ScreenShield = new Lang.Class({ scale_y: 0, time: animate ? Overview.ANIMATION_TIME : 0, transition: 'easeOutQuad', - onComplete: Lang.bind(this, this._completeDeactivate), + onComplete: this._completeDeactivate.bind(this), onCompleteScope: this }); }, diff --git a/js/ui/screencast.js b/js/ui/screencast.js index f4bf030ad..d1b2d2ad8 100644 --- a/js/ui/screencast.js +++ b/js/ui/screencast.js @@ -45,7 +45,7 @@ var ScreencastService = new Lang.Class({ this._lockdownSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.lockdown' }); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); }, get isRecording() { @@ -59,7 +59,7 @@ var ScreencastService = new Lang.Class({ screen: global.screen }); recorder._watchNameId = Gio.bus_watch_name(Gio.BusType.SESSION, sender, 0, null, - Lang.bind(this, this._onNameVanished)); + this._onNameVanished.bind(this)); this._recorders.set(sender, recorder); this.emit('updated'); } diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 5444d4051..0ce6a6650 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -83,7 +83,7 @@ var ScreenshotService = new Lang.Class({ let shooter = new Shell.Screenshot(); shooter._watchNameId = Gio.bus_watch_name(Gio.BusType.SESSION, sender, 0, null, - Lang.bind(this, this._onNameVanished)); + this._onNameVanished.bind(this)); this._screenShooter.set(sender, shooter); @@ -157,8 +157,10 @@ var ScreenshotService = new Lang.Class({ if (!screenshot) return; screenshot.screenshot_area (x, y, width, height, filename, - Lang.bind(this, this._onScreenshotComplete, - flash, invocation)); + (obj, result, area, filenameUsed) => { + this._onScreenshotComplete(obj, result, area, filenameUsed, + flash, invocation); + }); }, ScreenshotWindowAsync(params, invocation) { @@ -167,8 +169,10 @@ var ScreenshotService = new Lang.Class({ if (!screenshot) return; screenshot.screenshot_window (include_frame, include_cursor, filename, - Lang.bind(this, this._onScreenshotComplete, - flash, invocation)); + (obj, result, area, filenameUsed) => { + this._onScreenshotComplete(obj, result, area, filenameUsed, + flash, invocation); + }); }, ScreenshotAsync(params, invocation) { @@ -177,8 +181,10 @@ var ScreenshotService = new Lang.Class({ if (!screenshot) return; screenshot.screenshot(include_cursor, filename, - Lang.bind(this, this._onScreenshotComplete, - flash, invocation)); + (obj, result, area, filenameUsed) => { + this._onScreenshotComplete(obj, result, area, filenameUsed, + flash, invocation); + }); }, SelectAreaAsync(params, invocation) { @@ -233,11 +239,11 @@ var SelectArea = new Lang.Class({ this._grabHelper = new GrabHelper.GrabHelper(this._group); this._group.connect('button-press-event', - Lang.bind(this, this._onButtonPress)); + this._onButtonPress.bind(this)); this._group.connect('button-release-event', - Lang.bind(this, this._onButtonRelease)); + this._onButtonRelease.bind(this)); this._group.connect('motion-event', - Lang.bind(this, this._onMotionEvent)); + this._onMotionEvent.bind(this)); let constraint = new Clutter.BindConstraint({ source: global.stage, coordinate: Clutter.BindCoordinate.ALL }); @@ -252,7 +258,7 @@ var SelectArea = new Lang.Class({ show() { if (!this._grabHelper.grab({ actor: this._group, - onUngrab: Lang.bind(this, this._onUngrab) })) + onUngrab: this._onUngrab.bind(this) })) return; global.screen.set_cursor(Meta.Cursor.CROSSHAIR); diff --git a/js/ui/search.js b/js/ui/search.js index bf3b3a6a7..1fb54b4c9 100644 --- a/js/ui/search.js +++ b/js/ui/search.js @@ -59,7 +59,7 @@ var SearchResult = new Lang.Class({ y_fill: true }); this.actor._delegate = this; - this.actor.connect('clicked', Lang.bind(this, this.activate)); + this.actor.connect('clicked', this.activate.bind(this)); }, activate() { @@ -116,12 +116,12 @@ var ListSearchResult = new Lang.Class({ this._termsChangedId = this._resultsView.connect('terms-changed', - Lang.bind(this, this._highlightTerms)); + this._highlightTerms.bind(this)); this._highlightTerms(); } - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); }, _highlightTerms() { @@ -240,8 +240,8 @@ var SearchResultsBase = new Lang.Class({ metasNeeded.forEach((resultId, i) => { let meta = metas[i]; let display = this._createResultDisplay(meta); - display.connect('activate', Lang.bind(this, this._activateResult)); - display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); + display.connect('activate', this._activateResult.bind(this)); + display.actor.connect('key-focus-in', this._keyFocusIn.bind(this)); this._resultDisplays[resultId] = display; }); callback(true); @@ -292,7 +292,7 @@ var ListSearchResults = new Lang.Class({ this._container = new St.BoxLayout({ style_class: 'search-section-content' }); this.providerInfo = new ProviderInfo(provider); - this.providerInfo.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); + this.providerInfo.connect('key-focus-in', this._keyFocusIn.bind(this)); this.providerInfo.connect('clicked', () => { this.providerInfo.animateLaunch(); provider.launchSearch(this._terms); @@ -414,7 +414,7 @@ var SearchResults = new Lang.Class({ this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this._scrollView.add_actor(scrollChild); let action = new Clutter.PanAction({ interpolate: true }); - action.connect('pan', Lang.bind(this, this._onPan)); + action.connect('pan', this._onPan.bind(this)); this._scrollView.add_action(action); this.actor.add(this._scrollView, { x_fill: true, @@ -441,10 +441,10 @@ var SearchResults = new Lang.Class({ this._highlightRegex = null; this._searchSettings = new Gio.Settings({ schema_id: SEARCH_PROVIDERS_SCHEMA }); - this._searchSettings.connect('changed::disabled', Lang.bind(this, this._reloadRemoteProviders)); - this._searchSettings.connect('changed::enabled', Lang.bind(this, this._reloadRemoteProviders)); - this._searchSettings.connect('changed::disable-external', Lang.bind(this, this._reloadRemoteProviders)); - this._searchSettings.connect('changed::sort-order', Lang.bind(this, this._reloadRemoteProviders)); + this._searchSettings.connect('changed::disabled', this._reloadRemoteProviders.bind(this)); + this._searchSettings.connect('changed::enabled', this._reloadRemoteProviders.bind(this)); + this._searchSettings.connect('changed::disable-external', this._reloadRemoteProviders.bind(this)); + this._searchSettings.connect('changed::sort-order', this._reloadRemoteProviders.bind(this)); this._searchTimeoutId = 0; this._cancellable = new Gio.Cancellable(); @@ -460,7 +460,7 @@ var SearchResults = new Lang.Class({ }); RemoteSearch.loadRemoteSearchProviders(this._searchSettings, providers => { - providers.forEach(Lang.bind(this, this._registerProvider)); + providers.forEach(this._registerProvider.bind(this)); }); }, @@ -511,9 +511,18 @@ var SearchResults = new Lang.Class({ let previousProviderResults = previousResults[provider.id]; if (this._isSubSearch && previousProviderResults) - provider.getSubsearchResultSet(previousProviderResults, this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable); + provider.getSubsearchResultSet(previousProviderResults, + this._terms, + results => { + this._gotResults(results, provider); + }, + this._cancellable); else - provider.getInitialResultSet(this._terms, Lang.bind(this, this._gotResults, provider), this._cancellable); + provider.getInitialResultSet(this._terms, + results => { + this._gotResults(results, provider); + }, + this._cancellable); }); this._updateSearchProgress(); @@ -556,7 +565,7 @@ var SearchResults = new Lang.Class({ this._updateSearchProgress(); if (this._searchTimeoutId == 0) - this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, Lang.bind(this, this._onSearchTimeout)); + this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this)); let escapedTerms = this._terms.map(term => Shell.util_regex_escape(term)); this._highlightRegex = new RegExp(`(${escapedTerms.join('|')})`, 'gi'); @@ -585,7 +594,7 @@ var SearchResults = new Lang.Class({ else providerDisplay = new GridSearchResults(provider, this); - providerDisplay.connect('key-focus-in', Lang.bind(this, this._keyFocusIn)); + providerDisplay.connect('key-focus-in', this._keyFocusIn.bind(this)); providerDisplay.actor.hide(); this._content.add(providerDisplay.actor); provider.display = providerDisplay; diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 6fbc75976..c35e7f19c 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -99,9 +99,9 @@ var GnomeShell = new Lang.Class({ this._cachedOverviewVisible = false; Main.overview.connect('showing', - Lang.bind(this, this._checkOverviewVisibleChanged)); + this._checkOverviewVisibleChanged.bind(this)); Main.overview.connect('hidden', - Lang.bind(this, this._checkOverviewVisibleChanged)); + this._checkOverviewVisibleChanged.bind(this)); }, /** @@ -224,7 +224,7 @@ var GnomeShell = new Lang.Class({ if (!this._grabbers.has(sender)) { let id = Gio.bus_watch_name(Gio.BusType.SESSION, sender, 0, null, - Lang.bind(this, this._onGrabberBusNameVanished)); + this._onGrabberBusNameVanished.bind(this)); this._grabbers.set(sender, id); } @@ -333,7 +333,7 @@ var GnomeShellExtensions = new Lang.Class({ this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this); this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell'); ExtensionSystem.connect('extension-state-changed', - Lang.bind(this, this._extensionStateChanged)); + this._extensionStateChanged.bind(this)); }, diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js index 4e9892411..897a226fa 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -23,12 +23,12 @@ var EntryMenu = new Lang.Class({ // Populate menu let item; item = new PopupMenu.PopupMenuItem(_("Copy")); - item.connect('activate', Lang.bind(this, this._onCopyActivated)); + item.connect('activate', this._onCopyActivated.bind(this)); this.addMenuItem(item); this._copyItem = item; item = new PopupMenu.PopupMenuItem(_("Paste")); - item.connect('activate', Lang.bind(this, this._onPasteActivated)); + item.connect('activate', this._onPasteActivated.bind(this)); this.addMenuItem(item); this._pasteItem = item; @@ -40,8 +40,7 @@ var EntryMenu = new Lang.Class({ _makePasswordItem() { let item = new PopupMenu.PopupMenuItem(''); - item.connect('activate', Lang.bind(this, - this._onPasswordActivated)); + item.connect('activate', this._onPasswordActivated.bind(this)); this.addMenuItem(item); this._passwordItem = item; }, @@ -161,10 +160,14 @@ function addContextMenu(entry, params) { // Add an event handler to both the entry and its clutter_text; the former // so padding is included in the clickable area, the latter because the // event processing of ClutterText prevents event-bubbling. - entry.clutter_text.connect('button-press-event', Lang.bind(null, _onButtonPressEvent, entry)); - entry.connect('button-press-event', Lang.bind(null, _onButtonPressEvent, entry)); + entry.clutter_text.connect('button-press-event', (actor, event) => { + _onButtonPressEvent(actor, event, entry); + }); + entry.connect('button-press-event', (actor, event) => { + _onButtonPressEvent(actor, event, entry); + }); - entry.connect('popup-menu', Lang.bind(null, _onPopup, entry)); + entry.connect('popup-menu', actor => { _onPopup(actor, entry); }); entry.connect('destroy', () => { entry.menu.destroy(); diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index d14a5e192..dee7799e3 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -39,9 +39,8 @@ function _setButtonsForChoices(dialog, choices) { for (let idx = 0; idx < choices.length; idx++) { let button = idx; buttons.unshift({ label: choices[idx], - action: Lang.bind(dialog, function() { - dialog.emit('response', button); - })}); + action: () => { dialog.emit('response', button); } + }); } dialog.setButtons(buttons); @@ -88,7 +87,7 @@ var ListItem = new Lang.Class({ child: this._nameLabel }); layout.add(labelBin); - this.actor.connect('clicked', Lang.bind(this, this._onClicked)); + this.actor.connect('clicked', this._onClicked.bind(this)); }, _onClicked() { @@ -112,15 +111,15 @@ var ShellMountOperation = new Lang.Class({ this.mountOp = new Shell.MountOperation(); this.mountOp.connect('ask-question', - Lang.bind(this, this._onAskQuestion)); + this._onAskQuestion.bind(this)); this.mountOp.connect('ask-password', - Lang.bind(this, this._onAskPassword)); + this._onAskPassword.bind(this)); this.mountOp.connect('show-processes-2', - Lang.bind(this, this._onShowProcesses2)); + this._onShowProcesses2.bind(this)); this.mountOp.connect('aborted', - Lang.bind(this, this.close)); + this.close.bind(this)); this.mountOp.connect('show-unmount-progress', - Lang.bind(this, this._onShowUnmountProgress)); + this._onShowUnmountProgress.bind(this)); this._gicon = source.get_icon(); }, @@ -319,7 +318,7 @@ var ShellMountPasswordDialog = new Lang.Class({ text: "", can_focus: true}); ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); - this._passwordEntry.clutter_text.connect('activate', Lang.bind(this, this._onEntryActivate)); + this._passwordEntry.clutter_text.connect('activate', this._onEntryActivate.bind(this)); this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE this._passwordBox.add(this._passwordEntry, {expand: true }); this.setInitialKeyFocus(this._passwordEntry); @@ -342,11 +341,11 @@ var ShellMountPasswordDialog = new Lang.Class({ } let buttons = [{ label: _("Cancel"), - action: Lang.bind(this, this._onCancelButton), + action: this._onCancelButton.bind(this), key: Clutter.Escape }, { label: _("Unlock"), - action: Lang.bind(this, this._onUnlockButton), + action: this._onUnlockButton.bind(this), default: true }]; diff --git a/js/ui/slider.js b/js/ui/slider.js index c42d3aecd..9853929eb 100644 --- a/js/ui/slider.js +++ b/js/ui/slider.js @@ -23,11 +23,11 @@ var Slider = new Lang.Class({ can_focus: true, reactive: true, accessible_role: Atk.Role.SLIDER }); - this.actor.connect('repaint', Lang.bind(this, this._sliderRepaint)); - this.actor.connect('button-press-event', Lang.bind(this, this._startDragging)); - this.actor.connect('touch-event', Lang.bind(this, this._touchDragging)); - this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); - this.actor.connect('key-press-event', Lang.bind(this, this.onKeyPressEvent)); + this.actor.connect('repaint', this._sliderRepaint.bind(this)); + this.actor.connect('button-press-event', this._startDragging.bind(this)); + this.actor.connect('touch-event', this._touchDragging.bind(this)); + this.actor.connect('scroll-event', this._onScrollEvent.bind(this)); + this.actor.connect('key-press-event', this.onKeyPressEvent.bind(this)); this.actor.connect('allocation-changed', (actor, box) => { this._sliderWidth = box.get_width(); }); @@ -38,13 +38,13 @@ var Slider = new Lang.Class({ this._customAccessible = St.GenericAccessible.new_for_actor(this.actor); this.actor.set_accessible(this._customAccessible); - this._customAccessible.connect('get-current-value', Lang.bind(this, this._getCurrentValue)); - this._customAccessible.connect('get-minimum-value', Lang.bind(this, this._getMinimumValue)); - this._customAccessible.connect('get-maximum-value', Lang.bind(this, this._getMaximumValue)); - this._customAccessible.connect('get-minimum-increment', Lang.bind(this, this._getMinimumIncrement)); - this._customAccessible.connect('set-current-value', Lang.bind(this, this._setCurrentValue)); + this._customAccessible.connect('get-current-value', this._getCurrentValue.bind(this)); + this._customAccessible.connect('get-minimum-value', this._getMinimumValue.bind(this)); + this._customAccessible.connect('get-maximum-value', this._getMaximumValue.bind(this)); + this._customAccessible.connect('get-minimum-increment', this._getMinimumIncrement.bind(this)); + this._customAccessible.connect('set-current-value', this._setCurrentValue.bind(this)); - this.connect('value-changed', Lang.bind(this, this._valueChanged)); + this.connect('value-changed', this._valueChanged.bind(this)); }, setValue(value) { @@ -137,8 +137,8 @@ var Slider = new Lang.Class({ this._grabbedSequence = sequence; if (sequence == null) { - this._releaseId = this.actor.connect('button-release-event', Lang.bind(this, this._endDragging)); - this._motionId = this.actor.connect('motion-event', Lang.bind(this, this._motionEvent)); + this._releaseId = this.actor.connect('button-release-event', this._endDragging.bind(this)); + this._motionId = this.actor.connect('motion-event', this._motionEvent.bind(this)); } // We need to emit 'drag-begin' before moving the handle to make diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js index 46df281e9..adf3ca781 100644 --- a/js/ui/status/accessibility.js +++ b/js/ui/status/accessibility.js @@ -49,7 +49,7 @@ var ATIndicator = new Lang.Class({ this.actor.add_child(this._hbox); this._a11ySettings = new Gio.Settings({ schema_id: A11Y_SCHEMA }); - this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, Lang.bind(this, this._queueSyncMenuVisibility)); + this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, this._queueSyncMenuVisibility.bind(this)); let highContrast = this._buildHCItem(); this.menu.addMenuItem(highContrast); @@ -102,7 +102,7 @@ var ATIndicator = new Lang.Class({ if (this._syncMenuVisibilityIdle) return; - this._syncMenuVisibilityIdle = Mainloop.idle_add(Lang.bind(this, this._syncMenuVisibility)); + this._syncMenuVisibilityIdle = Mainloop.idle_add(this._syncMenuVisibility.bind(this)); GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility'); }, diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index fb379550f..7ffc8f767 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -43,7 +43,7 @@ var Indicator = new Lang.Class({ this._sync(); }); - this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync)); + this._proxy.connect('g-properties-changed', this._sync.bind(this)); this._item = new PopupMenu.PopupSubMenuMenuItem(_("Bluetooth"), true); this._item.icon.icon_name = 'bluetooth-active-symbolic'; @@ -59,10 +59,10 @@ var Indicator = new Lang.Class({ this._client = new GnomeBluetooth.Client(); this._model = this._client.get_model(); - this._model.connect('row-changed', Lang.bind(this, this._sync)); - this._model.connect('row-deleted', Lang.bind(this, this._sync)); - this._model.connect('row-inserted', Lang.bind(this, this._sync)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sync)); + this._model.connect('row-changed', this._sync.bind(this)); + this._model.connect('row-deleted', this._sync.bind(this)); + this._model.connect('row-inserted', this._sync.bind(this)); + Main.sessionMode.connect('updated', this._sync.bind(this)); this._sync(); }, diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js index 15f566040..55c5b0f34 100644 --- a/js/ui/status/brightness.js +++ b/js/ui/status/brightness.js @@ -32,7 +32,7 @@ var Indicator = new Lang.Class({ return; } - this._proxy.connect('g-properties-changed', Lang.bind(this, this._sync)); + this._proxy.connect('g-properties-changed', this._sync.bind(this)); this._sync(); }); @@ -40,7 +40,7 @@ var Indicator = new Lang.Class({ this.menu.addMenuItem(this._item); this._slider = new Slider.Slider(0); - this._slider.connect('value-changed', Lang.bind(this, this._sliderChanged)); + this._slider.connect('value-changed', this._sliderChanged.bind(this)); this._slider.actor.accessible_name = _("Brightness"); let icon = new St.Icon({ icon_name: 'display-brightness-symbolic', diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 5ae3678be..3dce2c9f9 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -199,7 +199,7 @@ var InputSourceSystemSettings = new Lang.Class({ this._BUS_PATH, null, Gio.DBusSignalFlags.NONE, - Lang.bind(this, this._reload)); + this._reload.bind(this)); }, _reload() { @@ -265,9 +265,9 @@ var InputSourceSessionSettings = new Lang.Class({ _init() { this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA }); - this._settings.connect('changed::' + this._KEY_INPUT_SOURCES, Lang.bind(this, this._emitInputSourcesChanged)); - this._settings.connect('changed::' + this._KEY_KEYBOARD_OPTIONS, Lang.bind(this, this._emitKeyboardOptionsChanged)); - this._settings.connect('changed::' + this._KEY_PER_WINDOW, Lang.bind(this, this._emitPerWindowChanged)); + this._settings.connect('changed::' + this._KEY_INPUT_SOURCES, this._emitInputSourcesChanged.bind(this)); + this._settings.connect('changed::' + this._KEY_KEYBOARD_OPTIONS, this._emitKeyboardOptionsChanged.bind(this)); + this._settings.connect('changed::' + this._KEY_PER_WINDOW, this._emitPerWindowChanged.bind(this)); }, _getSourcesList(key) { @@ -327,37 +327,37 @@ var InputSourceManager = new Lang.Class({ new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }), Meta.KeyBindingFlags.NONE, Shell.ActionMode.ALL, - Lang.bind(this, this._switchInputSource)); + this._switchInputSource.bind(this)); this._keybindingActionBackward = Main.wm.addKeybinding('switch-input-source-backward', new Gio.Settings({ schema_id: "org.gnome.desktop.wm.keybindings" }), Meta.KeyBindingFlags.IS_REVERSED, Shell.ActionMode.ALL, - Lang.bind(this, this._switchInputSource)); + this._switchInputSource.bind(this)); if (Main.sessionMode.isGreeter) this._settings = new InputSourceSystemSettings(); else this._settings = new InputSourceSessionSettings(); - this._settings.connect('input-sources-changed', Lang.bind(this, this._inputSourcesChanged)); - this._settings.connect('keyboard-options-changed', Lang.bind(this, this._keyboardOptionsChanged)); + this._settings.connect('input-sources-changed', this._inputSourcesChanged.bind(this)); + this._settings.connect('keyboard-options-changed', this._keyboardOptionsChanged.bind(this)); this._xkbInfo = KeyboardManager.getXkbInfo(); this._keyboardManager = KeyboardManager.getKeyboardManager(); this._ibusReady = false; this._ibusManager = IBusManager.getIBusManager(); - this._ibusManager.connect('ready', Lang.bind(this, this._ibusReadyCallback)); - this._ibusManager.connect('properties-registered', Lang.bind(this, this._ibusPropertiesRegistered)); - this._ibusManager.connect('property-updated', Lang.bind(this, this._ibusPropertyUpdated)); - this._ibusManager.connect('set-content-type', Lang.bind(this, this._ibusSetContentType)); + this._ibusManager.connect('ready', this._ibusReadyCallback.bind(this)); + this._ibusManager.connect('properties-registered', this._ibusPropertiesRegistered.bind(this)); + this._ibusManager.connect('property-updated', this._ibusPropertyUpdated.bind(this)); + this._ibusManager.connect('set-content-type', this._ibusSetContentType.bind(this)); - global.display.connect('modifiers-accelerator-activated', Lang.bind(this, this._modifiersSwitcher)); + global.display.connect('modifiers-accelerator-activated', this._modifiersSwitcher.bind(this)); this._sourcesPerWindow = false; this._focusWindowNotifyId = 0; this._overviewShowingId = 0; this._overviewHiddenId = 0; - this._settings.connect('per-window-changed', Lang.bind(this, this._sourcesPerWindowChanged)); + this._settings.connect('per-window-changed', this._sourcesPerWindowChanged.bind(this)); this._sourcesPerWindowChanged(); this._disableIBus = false; }, @@ -578,7 +578,7 @@ var InputSourceManager = new Lang.Class({ infosList[i].displayName, infosList[i].shortName, i); - is.connect('activate', Lang.bind(this, this.activateInputSource)); + is.connect('activate', this.activateInputSource.bind(this)); if (!(is.shortName in inputSourcesByShortName)) inputSourcesByShortName[is.shortName] = []; @@ -720,11 +720,11 @@ var InputSourceManager = new Lang.Class({ if (this._sourcesPerWindow && this._focusWindowNotifyId == 0) { this._focusWindowNotifyId = global.display.connect('notify::focus-window', - Lang.bind(this, this._setPerWindowInputSource)); + this._setPerWindowInputSource.bind(this)); this._overviewShowingId = Main.overview.connect('showing', - Lang.bind(this, this._setPerWindowInputSource)); + this._setPerWindowInputSource.bind(this)); this._overviewHiddenId = Main.overview.connect('hidden', - Lang.bind(this, this._setPerWindowInputSource)); + this._setPerWindowInputSource.bind(this)); } else if (!this._sourcesPerWindow && this._focusWindowNotifyId != 0) { global.display.disconnect(this._focusWindowNotifyId); this._focusWindowNotifyId = 0; @@ -784,9 +784,9 @@ var InputSourceIndicator = new Lang.Class({ this._indicatorLabels = {}; this._container = new Shell.GenericContainer(); - this._container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth)); - this._container.connect('get-preferred-height', Lang.bind(this, this._containerGetPreferredHeight)); - this._container.connect('allocate', Lang.bind(this, this._containerAllocate)); + this._container.connect('get-preferred-width', this._containerGetPreferredWidth.bind(this)); + this._container.connect('get-preferred-height', this._containerGetPreferredHeight.bind(this)); + this._container.connect('allocate', this._containerAllocate.bind(this)); this._hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' }); this._hbox.add_child(this._container); @@ -801,14 +801,14 @@ var InputSourceIndicator = new Lang.Class({ this._propSection.actor.hide(); this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); - this._showLayoutItem = this.menu.addAction(_("Show Keyboard Layout"), Lang.bind(this, this._showLayout)); + this._showLayoutItem = this.menu.addAction(_("Show Keyboard Layout"), this._showLayout.bind(this)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); this._inputSourceManager = getInputSourceManager(); - this._inputSourceManager.connect('sources-changed', Lang.bind(this, this._sourcesChanged)); - this._inputSourceManager.connect('current-source-changed', Lang.bind(this, this._currentSourceChanged)); + this._inputSourceManager.connect('sources-changed', this._sourcesChanged.bind(this)); + this._inputSourceManager.connect('current-source-changed', this._currentSourceChanged.bind(this)); this._inputSourceManager.reload(); }, diff --git a/js/ui/status/location.js b/js/ui/status/location.js index fd8f6b734..e59a50397 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -73,9 +73,9 @@ var Indicator = new Lang.Class({ this._settings = new Gio.Settings({ schema_id: LOCATION_SCHEMA }); this._settings.connect('changed::' + ENABLED, - Lang.bind(this, this._onMaxAccuracyLevelChanged)); + this._onMaxAccuracyLevelChanged.bind(this)); this._settings.connect('changed::' + MAX_ACCURACY_LEVEL, - Lang.bind(this, this._onMaxAccuracyLevelChanged)); + this._onMaxAccuracyLevelChanged.bind(this)); this._indicator = this._addIndicator(); this._indicator.icon_name = 'find-location-symbolic'; @@ -87,7 +87,7 @@ var Indicator = new Lang.Class({ this._agent.export(Gio.DBus.system, '/org/freedesktop/GeoClue2/Agent'); this._item.label.text = _("Location Enabled"); - this._onOffAction = this._item.menu.addAction(_("Disable"), Lang.bind(this, this._onOnOffAction)); + this._onOffAction = this._item.menu.addAction(_("Disable"), this._onOnOffAction.bind(this)); this._item.menu.addSettingsAction(_("Privacy Settings"), 'gnome-privacy-panel.desktop'); this.menu.addMenuItem(this._item); @@ -95,9 +95,9 @@ var Indicator = new Lang.Class({ this._watchId = Gio.bus_watch_name(Gio.BusType.SYSTEM, 'org.freedesktop.GeoClue2', 0, - Lang.bind(this, this._connectToGeoclue), - Lang.bind(this, this._onGeoclueVanished)); - Main.sessionMode.connect('updated', Lang.bind(this, this._onSessionUpdated)); + this._connectToGeoclue.bind(this), + this._onGeoclueVanished.bind(this)); + Main.sessionMode.connect('updated', this._onSessionUpdated.bind(this)); this._onSessionUpdated(); this._onMaxAccuracyLevelChanged(); this._connectToGeoclue(); @@ -143,7 +143,7 @@ var Indicator = new Lang.Class({ new GeoclueManager(Gio.DBus.system, 'org.freedesktop.GeoClue2', '/org/freedesktop/GeoClue2/Manager', - Lang.bind(this, this._onManagerProxyReady)); + this._onManagerProxyReady.bind(this)); return true; }, @@ -156,11 +156,11 @@ var Indicator = new Lang.Class({ this._managerProxy = proxy; this._propertiesChangedId = this._managerProxy.connect('g-properties-changed', - Lang.bind(this, this._onGeocluePropsChanged)); + this._onGeocluePropsChanged.bind(this)); this._syncIndicator(); - this._managerProxy.AddAgentRemote('gnome-shell', Lang.bind(this, this._onAgentRegistered)); + this._managerProxy.AddAgentRemote('gnome-shell', this._onAgentRegistered.bind(this)); }, _onAgentRegistered(result, error) { @@ -235,7 +235,7 @@ var Indicator = new Lang.Class({ _connectToPermissionStore() { this._permStoreProxy = null; - new PermissionStore.PermissionStore(Lang.bind(this, this._onPermStoreProxyReady), null); + new PermissionStore.PermissionStore(this._onPermStoreProxyReady.bind(this)); }, _onPermStoreProxyReady(proxy, error) { @@ -281,8 +281,7 @@ var AppAuthorizer = new Lang.Class({ this._permStoreProxy.LookupRemote(APP_PERMISSIONS_TABLE, APP_PERMISSIONS_ID, - Lang.bind(this, - this._onPermLookupDone)); + this._onPermLookupDone.bind(this)); }, _onPermLookupDone(result, error) { @@ -392,10 +391,10 @@ var GeolocationDialog = new Lang.Class({ this.contentLayout.add_actor(content); let button = this.addButton({ label: _("Deny Access"), - action: Lang.bind(this, this._onDenyClicked), + action: this._onDenyClicked.bind(this), key: Clutter.KEY_Escape }); this.addButton({ label: _("Grant Access"), - action: Lang.bind(this, this._onGrantClicked) }); + action: this._onGrantClicked.bind(this) }); this.setInitialKeyFocus(button); }, diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 33cd91f69..54ed5cabc 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -114,10 +114,10 @@ var NMConnectionItem = new Lang.Class({ _buildUI() { this.labelItem = new PopupMenu.PopupMenuItem(''); - this.labelItem.connect('activate', Lang.bind(this, this._toggle)); + this.labelItem.connect('activate', this._toggle.bind(this)); this.radioItem = new PopupMenu.PopupMenuItem(this._connection.get_id(), false); - this.radioItem.connect('activate', Lang.bind(this, this._activate)); + this.radioItem.connect('activate', this._activate.bind(this)); }, destroy() { @@ -186,7 +186,7 @@ var NMConnectionItem = new Lang.Class({ if (this._activeConnection) this._activeConnectionChangedId = this._activeConnection.connect('notify::state', - Lang.bind(this, this._connectionStateChanged)); + this._connectionStateChanged.bind(this)); this._sync(); }, @@ -210,7 +210,7 @@ var NMConnectionSection = new Lang.Class({ this.item.menu.addMenuItem(this._labelSection); this.item.menu.addMenuItem(this._radioSection); - this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged)); + this._notifyConnectivityId = this._client.connect('notify::connectivity', this._iconChanged.bind(this)); }, destroy() { @@ -281,7 +281,7 @@ var NMConnectionSection = new Lang.Class({ let pos = this._connections.indexOf(connection); this._connections.splice(pos, 1); - pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction)); + pos = Util.insertSorted(this._connections, connection, this._connectionSortFunction.bind(this)); this._labelSection.moveMenuItem(item.labelItem, pos); this._radioSection.moveMenuItem(item.radioItem, pos); @@ -297,9 +297,9 @@ var NMConnectionSection = new Lang.Class({ item.connect('activation-failed', (item, reason) => { this.emit('activation-failed', reason); }); - item.connect('name-changed', Lang.bind(this, this._sync)); + item.connect('name-changed', this._sync.bind(this)); - let pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction)); + let pos = Util.insertSorted(this._connections, connection, this._connectionSortFunction.bind(this)); this._labelSection.addMenuItem(item.labelItem, pos); this._radioSection.addMenuItem(item.radioItem, pos); this._connectionItems.set(connection.get_uuid(), item); @@ -333,11 +333,11 @@ var NMConnectionDevice = new Lang.Class({ this._device = device; this._description = ''; - this._autoConnectItem = this.item.menu.addAction(_("Connect"), Lang.bind(this, this._autoConnect)); - this._deactivateItem = this._radioSection.addAction(_("Turn Off"), Lang.bind(this, this.deactivateConnection)); + this._autoConnectItem = this.item.menu.addAction(_("Connect"), this._autoConnect.bind(this)); + this._deactivateItem = this._radioSection.addAction(_("Turn Off"), this.deactivateConnection.bind(this)); - this._stateChangedId = this._device.connect('state-changed', Lang.bind(this, this._deviceStateChanged)); - this._activeConnectionChangedId = this._device.connect('notify::active-connection', Lang.bind(this, this._activeConnectionChanged)); + this._stateChangedId = this._device.connect('state-changed', this._deviceStateChanged.bind(this)); + this._activeConnectionChangedId = this._device.connect('notify::active-connection', this._activeConnectionChanged.bind(this)); }, _canReachInternet() { @@ -547,7 +547,7 @@ var NMDeviceModem = new Lang.Class({ this._mobileDevice = new ModemManager.ModemGsm(device.udi); if (this._mobileDevice) { - this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync)); + this._operatorNameId = this._mobileDevice.connect('notify::operator-name', this._sync.bind(this)); this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', () => { this._iconChanged(); }); @@ -709,11 +709,11 @@ var NMWirelessDialog = new Lang.Class({ this._device = device; this._wirelessEnabledChangedId = this._client.connect('notify::wireless-enabled', - Lang.bind(this, this._syncView)); + this._syncView.bind(this)); this._rfkill = Rfkill.getRfkillManager(); this._airplaneModeChangedId = this._rfkill.connect('airplane-mode-changed', - Lang.bind(this, this._syncView)); + this._syncView.bind(this)); this._networks = []; this._buildLayout(); @@ -723,9 +723,9 @@ var NMWirelessDialog = new Lang.Class({ connection => device.connection_valid(connection) ); - this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded)); - this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved)); - this._activeApChangedId = device.connect('notify::active-access-point', Lang.bind(this, this._activeApChanged)); + this._apAddedId = device.connect('access-point-added', this._accessPointAdded.bind(this)); + this._apRemovedId = device.connect('access-point-removed', this._accessPointRemoved.bind(this)); + this._activeApChangedId = device.connect('notify::active-access-point', this._activeApChanged.bind(this)); // accessPointAdded will also create dialog items let accessPoints = device.get_access_points() || [ ]; @@ -738,7 +738,7 @@ var NMWirelessDialog = new Lang.Class({ this._updateSensitivity(); this._syncView(); - this._scanTimeoutId = Mainloop.timeout_add_seconds(15, Lang.bind(this, this._onScanTimeout)); + this._scanTimeoutId = Mainloop.timeout_add_seconds(15, this._onScanTimeout.bind(this)); GLib.Source.set_name_by_id(this._scanTimeoutId, '[gnome-shell] this._onScanTimeout'); this._onScanTimeout(); @@ -915,10 +915,10 @@ var NMWirelessDialog = new Lang.Class({ this.contentLayout.add(this._stack, { expand: true }); - this._disconnectButton = this.addButton({ action: Lang.bind(this, this.close), + this._disconnectButton = this.addButton({ action: this.close.bind(this), label: _("Cancel"), key: Clutter.Escape }); - this._connectButton = this.addButton({ action: Lang.bind(this, this._connect), + this._connectButton = this.addButton({ action: this._connect.bind(this), label: _("Connect"), key: Clutter.Return }); }, @@ -1064,7 +1064,7 @@ var NMWirelessDialog = new Lang.Class({ if (accessPoint.get_ssid() == null) { // This access point is not visible yet // Wait for it to get a ssid - accessPoint._notifySsidId = accessPoint.connect('notify::ssid', Lang.bind(this, this._notifySsidCb)); + accessPoint._notifySsidId = accessPoint.connect('notify::ssid', this._notifySsidCb.bind(this)); return; } @@ -1170,19 +1170,19 @@ var NMDeviceWireless = new Lang.Class({ this._description = ''; this.item = new PopupMenu.PopupSubMenuMenuItem('', true); - this.item.menu.addAction(_("Select Network"), Lang.bind(this, this._showDialog)); + this.item.menu.addAction(_("Select Network"), this._showDialog.bind(this)); this._toggleItem = new PopupMenu.PopupMenuItem(''); - this._toggleItem.connect('activate', Lang.bind(this, this._toggleWifi)); + this._toggleItem.connect('activate', this._toggleWifi.bind(this)); this.item.menu.addMenuItem(this._toggleItem); this.item.menu.addSettingsAction(_("Wi-Fi Settings"), 'gnome-wifi-panel.desktop'); - this._wirelessEnabledChangedId = this._client.connect('notify::wireless-enabled', Lang.bind(this, this._sync)); - this._wirelessHwEnabledChangedId = this._client.connect('notify::wireless-hardware-enabled', Lang.bind(this, this._sync)); - this._activeApChangedId = this._device.connect('notify::active-access-point', Lang.bind(this, this._activeApChanged)); - this._stateChangedId = this._device.connect('state-changed', Lang.bind(this, this._deviceStateChanged)); - this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged)); + this._wirelessEnabledChangedId = this._client.connect('notify::wireless-enabled', this._sync.bind(this)); + this._wirelessHwEnabledChangedId = this._client.connect('notify::wireless-hardware-enabled', this._sync.bind(this)); + this._activeApChangedId = this._device.connect('notify::active-access-point', this._activeApChanged.bind(this)); + this._stateChangedId = this._device.connect('state-changed', this._deviceStateChanged.bind(this)); + this._notifyConnectivityId = this._client.connect('notify::connectivity', this._iconChanged.bind(this)); this._sync(); }, @@ -1248,7 +1248,7 @@ var NMDeviceWireless = new Lang.Class({ _showDialog() { this._dialog = new NMWirelessDialog(this._client, this._device); - this._dialog.connect('closed', Lang.bind(this, this._dialogClosed)); + this._dialog.connect('closed', this._dialogClosed.bind(this)); this._dialog.open(); }, @@ -1271,7 +1271,7 @@ var NMDeviceWireless = new Lang.Class({ if (this._activeAccessPoint) { this._strengthChangedId = this._activeAccessPoint.connect('notify::strength', - Lang.bind(this, this._strengthChanged)); + this._strengthChanged.bind(this)); } this._sync(); @@ -1385,10 +1385,10 @@ var NMVpnConnectionItem = new Lang.Class({ _buildUI() { this.labelItem = new PopupMenu.PopupMenuItem(''); - this.labelItem.connect('activate', Lang.bind(this, this._toggle)); + this.labelItem.connect('activate', this._toggle.bind(this)); this.radioItem = new PopupMenu.PopupSwitchMenuItem(this._connection.get_id(), false); - this.radioItem.connect('toggled', Lang.bind(this, this._toggle)); + this.radioItem.connect('toggled', this._toggle.bind(this)); }, _sync() { @@ -1444,7 +1444,7 @@ var NMVpnConnectionItem = new Lang.Class({ if (this._activeConnection) this._activeConnectionChangedId = this._activeConnection.connect('vpn-state-changed', - Lang.bind(this, this._connectionStateChanged)); + this._connectionStateChanged.bind(this)); this._sync(); }, @@ -1548,8 +1548,8 @@ var DeviceCategory = new Lang.Class({ this.devices = []; this.section = new PopupMenu.PopupMenuSection(); - this.section.box.connect('actor-added', Lang.bind(this, this._sync)); - this.section.box.connect('actor-removed', Lang.bind(this, this._sync)); + this.section.box.connect('actor-added', this._sync.bind(this)); + this.section.box.connect('actor-removed', this._sync.bind(this)); this.addMenuItem(this.section); this._summaryItem = new PopupMenu.PopupSubMenuMenuItem('', true); @@ -1627,7 +1627,7 @@ var NMApplet = new Lang.Class({ this._ctypes[NM.SETTING_GSM_SETTING_NAME] = NMConnectionCategory.WWAN; this._ctypes[NM.SETTING_VPN_SETTING_NAME] = NMConnectionCategory.VPN; - NM.Client.new_async(null, Lang.bind(this, this._clientGot)); + NM.Client.new_async(null, this._clientGot.bind(this)); }, _clientGot(obj, result) { @@ -1655,8 +1655,8 @@ var NMApplet = new Lang.Class({ } this._vpnSection = new NMVpnSection(this._client); - this._vpnSection.connect('activation-failed', Lang.bind(this, this._onActivationFailed)); - this._vpnSection.connect('icon-changed', Lang.bind(this, this._updateIcon)); + this._vpnSection.connect('activation-failed', this._onActivationFailed.bind(this)); + this._vpnSection.connect('icon-changed', this._updateIcon.bind(this)); this.menu.addMenuItem(this._vpnSection.item); this._readConnections(); @@ -1665,19 +1665,19 @@ var NMApplet = new Lang.Class({ this._syncMainConnection(); this._syncVpnConnections(); - this._client.connect('notify::nm-running', Lang.bind(this, this._syncNMState)); - this._client.connect('notify::networking-enabled', Lang.bind(this, this._syncNMState)); - this._client.connect('notify::state', Lang.bind(this, this._syncNMState)); - this._client.connect('notify::primary-connection', Lang.bind(this, this._syncMainConnection)); - this._client.connect('notify::activating-connection', Lang.bind(this, this._syncMainConnection)); - this._client.connect('notify::active-connections', Lang.bind(this, this._syncVpnConnections)); - this._client.connect('notify::connectivity', Lang.bind(this, this._syncConnectivity)); - this._client.connect('device-added', Lang.bind(this, this._deviceAdded)); - this._client.connect('device-removed', Lang.bind(this, this._deviceRemoved)); - this._client.connect('connection-added', Lang.bind(this, this._connectionAdded)); - this._client.connect('connection-removed', Lang.bind(this, this._connectionRemoved)); + this._client.connect('notify::nm-running', this._syncNMState.bind(this)); + this._client.connect('notify::networking-enabled', this._syncNMState.bind(this)); + this._client.connect('notify::state', this._syncNMState.bind(this)); + this._client.connect('notify::primary-connection', this._syncMainConnection.bind(this)); + this._client.connect('notify::activating-connection', this._syncMainConnection.bind(this)); + this._client.connect('notify::active-connections', this._syncVpnConnections.bind(this)); + this._client.connect('notify::connectivity', this._syncConnectivity.bind(this)); + this._client.connect('device-added', this._deviceAdded.bind(this)); + this._client.connect('device-removed', this._deviceRemoved.bind(this)); + this._client.connect('connection-added', this._connectionAdded.bind(this)); + this._client.connect('connection-removed', this._connectionRemoved.bind(this)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, @@ -1766,7 +1766,7 @@ var NMApplet = new Lang.Class({ _addDeviceWrapper(wrapper) { wrapper._activationFailedId = wrapper.connect('activation-failed', - Lang.bind(this, this._onActivationFailed)); + this._onActivationFailed.bind(this)); let section = this._devices[wrapper.category].section; section.addMenuItem(wrapper.item); @@ -1833,8 +1833,8 @@ var NMApplet = new Lang.Class({ if (this._mainConnection) { if (this._mainConnection._primaryDevice) - this._mainConnectionIconChangedId = this._mainConnection._primaryDevice.connect('icon-changed', Lang.bind(this, this._updateIcon)); - this._mainConnectionStateChangedId = this._mainConnection.connect('notify::state', Lang.bind(this, this._mainConnectionStateChanged)); + this._mainConnectionIconChangedId = this._mainConnection._primaryDevice.connect('icon-changed', this._updateIcon.bind(this)); + this._mainConnectionStateChangedId = this._mainConnection.connect('notify::state', this._mainConnectionStateChanged.bind(this)); this._mainConnectionStateChanged(); } @@ -1880,7 +1880,7 @@ var NMApplet = new Lang.Class({ return; } - connection._updatedId = connection.connect('changed', Lang.bind(this, this._updateConnection)); + connection._updatedId = connection.connect('changed', this._updateConnection.bind(this)); this._updateConnection(connection); this._connections.push(connection); @@ -1888,7 +1888,7 @@ var NMApplet = new Lang.Class({ _readConnections() { let connections = this._client.get_connections(); - connections.forEach(Lang.bind(this, this._addConnection)); + connections.forEach(this._addConnection.bind(this)); }, _connectionAdded(client, connection) { @@ -2027,7 +2027,7 @@ var NMApplet = new Lang.Class({ } this._portalHelperProxy = proxy; - proxy.connectSignal('Done', Lang.bind(this, this._portalHelperDone)); + proxy.connectSignal('Done', this._portalHelperDone.bind(this)); proxy.AuthenticateRemote(path, '', timestamp); }); diff --git a/js/ui/status/nightLight.js b/js/ui/status/nightLight.js index 017fbb4d8..f2523b5f3 100644 --- a/js/ui/status/nightLight.js +++ b/js/ui/status/nightLight.js @@ -35,7 +35,7 @@ var Indicator = new Lang.Class({ return; } this._proxy.connect('g-properties-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._sync(); }); @@ -51,7 +51,7 @@ var Indicator = new Lang.Class({ this._item.menu.addSettingsAction(_("Display Settings"), 'gnome-display-panel.desktop'); this.menu.addMenuItem(this._item); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); this._sync(); }, diff --git a/js/ui/status/power.js b/js/ui/status/power.js index ef3eac334..a2bfd75a0 100644 --- a/js/ui/status/power.js +++ b/js/ui/status/power.js @@ -38,7 +38,7 @@ var Indicator = new Lang.Class({ this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' }); this._desktopSettings.connect('changed::' + SHOW_BATTERY_PERCENTAGE, - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._indicator = this._addIndicator(); this._percentageLabel = new St.Label({ y_expand: true, @@ -53,7 +53,7 @@ var Indicator = new Lang.Class({ return; } this._proxy.connect('g-properties-changed', - Lang.bind(this, this._sync)); + this._sync.bind(this)); this._sync(); }); @@ -61,7 +61,7 @@ var Indicator = new Lang.Class({ this._item.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop'); this.menu.addMenuItem(this._item); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, diff --git a/js/ui/status/rfkill.js b/js/ui/status/rfkill.js index 7ccbcacca..989a4f9ed 100644 --- a/js/ui/status/rfkill.js +++ b/js/ui/status/rfkill.js @@ -32,7 +32,7 @@ var RfkillManager = new Lang.Class({ return; } this._proxy.connect('g-properties-changed', - Lang.bind(this, this._changed)); + this._changed.bind(this)); this._changed(); }); }, @@ -76,7 +76,7 @@ var Indicator = new Lang.Class({ this.parent(); this._manager = getRfkillManager(); - this._manager.connect('airplane-mode-changed', Lang.bind(this, this._sync)); + this._manager.connect('airplane-mode-changed', this._sync.bind(this)); this._indicator = this._addIndicator(); this._indicator.icon_name = 'airplane-mode-symbolic'; @@ -93,7 +93,7 @@ var Indicator = new Lang.Class({ this._item.menu.addSettingsAction(_("Network Settings"), 'gnome-network-panel.desktop'); this.menu.addMenuItem(this._item); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, diff --git a/js/ui/status/screencast.js b/js/ui/status/screencast.js index c37ca705c..a084f1a96 100644 --- a/js/ui/status/screencast.js +++ b/js/ui/status/screencast.js @@ -17,7 +17,7 @@ var Indicator = new Lang.Class({ this._indicator.add_style_class_name('screencast-indicator'); this._sync(); - Main.screencastService.connect('updated', Lang.bind(this, this._sync)); + Main.screencastService.connect('updated', this._sync.bind(this)); }, _sync() { diff --git a/js/ui/status/system.js b/js/ui/status/system.js index 362716010..68a0b4b5b 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -21,26 +21,26 @@ var AltSwitcher = new Lang.Class({ _init(standard, alternate) { this._standard = standard; - this._standard.connect('notify::visible', Lang.bind(this, this._sync)); + this._standard.connect('notify::visible', this._sync.bind(this)); if (this._standard instanceof St.Button) this._standard.connect('clicked', () => { this._clickAction.release(); }); this._alternate = alternate; - this._alternate.connect('notify::visible', Lang.bind(this, this._sync)); + this._alternate.connect('notify::visible', this._sync.bind(this)); if (this._alternate instanceof St.Button) this._alternate.connect('clicked', () => { this._clickAction.release(); }); - this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); + this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this)); this._flipped = false; this._clickAction = new Clutter.ClickAction(); - this._clickAction.connect('long-press', Lang.bind(this, this._onLongPress)); + this._clickAction.connect('long-press', this._onLongPress.bind(this)); this.actor = new St.Bin(); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this.actor.connect('notify::mapped', () => { this._flipped = false; }); }, @@ -141,7 +141,7 @@ var Indicator = new Lang.Class({ }); this._updateMultiUser(); - Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); + Main.sessionMode.connect('updated', this._sessionUpdated.bind(this)); this._sessionUpdated(); }, @@ -251,8 +251,8 @@ var Indicator = new Lang.Class({ this._switchUserSubMenu.menu.addSettingsAction(_("Account Settings"), 'gnome-user-accounts-panel.desktop'); - this._user.connect('notify::is-loaded', Lang.bind(this, this._updateSwitchUserSubMenu)); - this._user.connect('changed', Lang.bind(this, this._updateSwitchUserSubMenu)); + this._user.connect('notify::is-loaded', this._updateSwitchUserSubMenu.bind(this)); + this._user.connect('changed', this._updateSwitchUserSubMenu.bind(this)); this.menu.addMenuItem(this._switchUserSubMenu); diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js index c0caaa885..3fa244541 100644 --- a/js/ui/status/thunderbolt.js +++ b/js/ui/status/thunderbolt.js @@ -82,7 +82,7 @@ var Client = new Lang.Class({ Gio.DBus.system, BOLT_DBUS_NAME, BOLT_DBUS_PATH, - Lang.bind(this, this._onProxyReady) + this._onProxyReady.bind(this) ); this.probing = false; @@ -94,8 +94,8 @@ var Client = new Lang.Class({ return; } this._proxy = proxy; - this._propsChangedId = this._proxy.connect('g-properties-changed', Lang.bind(this, this._onPropertiesChanged)); - this._deviceAddedId = this._proxy.connectSignal('DeviceAdded', Lang.bind(this, this._onDeviceAdded), true); + this._propsChangedId = this._proxy.connect('g-properties-changed', this._onPropertiesChanged.bind(this)); + this._deviceAddedId = this._proxy.connectSignal('DeviceAdded', this._onDeviceAdded.bind(this)); this.probing = this._proxy.Probing; if (this.probing) @@ -161,7 +161,7 @@ var AuthRobot = new Lang.Class({ this._devicesToEnroll = []; this._enrolling = false; - this._client.connect('device-added', Lang.bind(this, this._onDeviceAdded)); + this._client.connect('device-added', this._onDeviceAdded.bind(this)); }, close() { @@ -201,7 +201,7 @@ var AuthRobot = new Lang.Class({ this.enrolling = true; GLib.idle_add(GLib.PRIORITY_DEFAULT, - Lang.bind(this, this._enrollDevicesIdle)); + this._enrollDevicesIdle.bind(this)); }, _onEnrollDone(device, error) { @@ -216,7 +216,7 @@ var AuthRobot = new Lang.Class({ if (this._enrolling) GLib.idle_add(GLib.PRIORITY_DEFAULT, - Lang.bind(this, this._enrollDevicesIdle)); + this._enrollDevicesIdle.bind(this)); }, _enrollDevicesIdle() { @@ -228,7 +228,7 @@ var AuthRobot = new Lang.Class({ this._client.enrollDevice(dev.Uid, Policy.DEFAULT, - Lang.bind(this, this._onEnrollDone)); + this._onEnrollDone.bind(this)); return GLib.SOURCE_REMOVE; } @@ -249,14 +249,14 @@ var Indicator = new Lang.Class({ this._indicator.icon_name = 'thunderbolt-symbolic'; this._client = new Client(); - this._client.connect('probing-changed', Lang.bind(this, this._onProbing)); + this._client.connect('probing-changed', this._onProbing.bind(this)); this._robot = new AuthRobot(this._client); - this._robot.connect('enroll-device', Lang.bind(this, this._onEnrollDevice)); - this._robot.connect('enroll-failed', Lang.bind(this, this._onEnrollFailed)); + this._robot.connect('enroll-device', this._onEnrollDevice.bind(this)); + this._robot.connect('enroll-failed', this._onEnrollFailed.bind(this)); - Main.sessionMode.connect('updated', Lang.bind(this, this._sync)); + Main.sessionMode.connect('updated', this._sync.bind(this)); this._sync(); this._source = null; diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index b2ea53c0f..d814ef665 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -36,8 +36,8 @@ var StreamSlider = new Lang.Class({ this.item = new PopupMenu.PopupBaseMenuItem({ activate: false }); this._slider = new Slider.Slider(0); - this._slider.connect('value-changed', Lang.bind(this, this._sliderChanged)); - this._slider.connect('drag-end', Lang.bind(this, this._notifyVolumeChange)); + this._slider.connect('value-changed', this._sliderChanged.bind(this)); + this._slider.connect('drag-end', this._notifyVolumeChange.bind(this)); this._icon = new St.Icon({ style_class: 'popup-menu-icon' }); this.item.actor.add(this._icon); @@ -81,8 +81,8 @@ var StreamSlider = new Lang.Class({ }, _connectStream(stream) { - this._mutedChangedId = stream.connect('notify::is-muted', Lang.bind(this, this._updateVolume)); - this._volumeChangedId = stream.connect('notify::volume', Lang.bind(this, this._updateVolume)); + this._mutedChangedId = stream.connect('notify::is-muted', this._updateVolume.bind(this)); + this._volumeChangedId = stream.connect('notify::volume', this._updateVolume.bind(this)); }, _shouldBeVisible() { @@ -172,7 +172,7 @@ var OutputStreamSlider = new Lang.Class({ _connectStream(stream) { this.parent(stream); - this._portChangedId = stream.connect('notify::port', Lang.bind(this, this._portChanged)); + this._portChangedId = stream.connect('notify::port', this._portChanged.bind(this)); this._portChanged(); }, @@ -219,8 +219,8 @@ var InputStreamSlider = new Lang.Class({ _init(control) { this.parent(control); this._slider.actor.accessible_name = _("Microphone"); - this._control.connect('stream-added', Lang.bind(this, this._maybeShowInput)); - this._control.connect('stream-removed', Lang.bind(this, this._maybeShowInput)); + this._control.connect('stream-added', this._maybeShowInput.bind(this)); + this._control.connect('stream-removed', this._maybeShowInput.bind(this)); this._icon.icon_name = 'audio-input-microphone-symbolic'; }, @@ -265,9 +265,9 @@ var VolumeMenu = new Lang.Class({ this.hasHeadphones = false; this._control = control; - this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged)); - this._control.connect('default-sink-changed', Lang.bind(this, this._readOutput)); - this._control.connect('default-source-changed', Lang.bind(this, this._readInput)); + this._control.connect('state-changed', this._onControlStateChanged.bind(this)); + this._control.connect('default-sink-changed', this._readOutput.bind(this)); + this._control.connect('default-source-changed', this._readInput.bind(this)); this._output = new OutputStreamSlider(this._control); this._output.connect('stream-updated', () => { @@ -337,7 +337,7 @@ var Indicator = new Lang.Class({ this.menu.addMenuItem(this._volumeMenu); - this.indicators.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); + this.indicators.connect('scroll-event', this._onScrollEvent.bind(this)); }, _onScrollEvent(actor, event) { diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js index e76ed228f..a53b1e6e9 100644 --- a/js/ui/switcherPopup.js +++ b/js/ui/switcherPopup.js @@ -50,10 +50,10 @@ var SwitcherPopup = new Lang.Class({ this.actor = new Shell.GenericContainer({ style_class: 'switcher-popup', reactive: true, visible: false }); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); + this.actor.connect('destroy', this._onDestroy.bind(this)); Main.uiGroup.add_actor(this.actor); @@ -124,16 +124,16 @@ var SwitcherPopup = new Lang.Class({ this._haveModal = true; this._modifierMask = primaryModifier(mask); - this.actor.connect('key-press-event', Lang.bind(this, this._keyPressEvent)); - this.actor.connect('key-release-event', Lang.bind(this, this._keyReleaseEvent)); + this.actor.connect('key-press-event', this._keyPressEvent.bind(this)); + this.actor.connect('key-release-event', this._keyReleaseEvent.bind(this)); - this.actor.connect('button-press-event', Lang.bind(this, this._clickedOutside)); - this.actor.connect('scroll-event', Lang.bind(this, this._scrollEvent)); + this.actor.connect('button-press-event', this._clickedOutside.bind(this)); + this.actor.connect('scroll-event', this._scrollEvent.bind(this)); this.actor.add_actor(this._switcherList.actor); - this._switcherList.connect('item-activated', Lang.bind(this, this._itemActivated)); - this._switcherList.connect('item-entered', Lang.bind(this, this._itemEntered)); - this._switcherList.connect('item-removed', Lang.bind(this, this._itemRemoved)); + this._switcherList.connect('item-activated', this._itemActivated.bind(this)); + this._switcherList.connect('item-entered', this._itemEntered.bind(this)); + this._switcherList.connect('item-removed', this._itemRemoved.bind(this)); // Need to force an allocation so we can figure out whether we // need to scroll when selecting @@ -267,7 +267,7 @@ var SwitcherPopup = new Lang.Class({ if (this._motionTimeoutId != 0) Mainloop.source_remove(this._motionTimeoutId); - this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, Lang.bind(this, this._mouseTimedOut)); + this._motionTimeoutId = Mainloop.timeout_add(DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this)); GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut'); }, @@ -337,9 +337,9 @@ var SwitcherList = new Lang.Class({ _init(squareItems) { this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' }); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocateTop)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocateTop.bind(this)); // Here we use a GenericContainer so that we can force all the // children to have the same width. @@ -349,9 +349,9 @@ var SwitcherList = new Lang.Class({ this._list.spacing = this._list.get_theme_node().get_length('spacing'); }); - this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this._list.connect('allocate', Lang.bind(this, this._allocate)); + this._list.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this._list.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this._list.connect('allocate', this._allocate.bind(this)); this._scrollView = new St.ScrollView({ style_class: 'hfade', enable_mouse_scrolling: false }); diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index ed1df344f..1adaf417e 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -52,9 +52,9 @@ var UnlockDialog = new Lang.Class({ this.actor.add_child(this._promptBox); this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY); - this._authPrompt.connect('failed', Lang.bind(this, this._fail)); - this._authPrompt.connect('cancelled', Lang.bind(this, this._fail)); - this._authPrompt.connect('reset', Lang.bind(this, this._onReset)); + this._authPrompt.connect('failed', this._fail.bind(this)); + this._authPrompt.connect('cancelled', this._fail.bind(this)); + this._authPrompt.connect('reset', this._onReset.bind(this)); this._authPrompt.setPasswordChar('\u25cf'); this._authPrompt.nextButton.label = _("Unlock"); @@ -72,7 +72,7 @@ var UnlockDialog = new Lang.Class({ reactive: true, x_align: St.Align.START, x_fill: false }); - this._otherUserButton.connect('clicked', Lang.bind(this, this._otherUserClicked)); + this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this)); this._promptBox.add_child(this._otherUserButton); } else { this._otherUserButton = null; @@ -84,7 +84,7 @@ var UnlockDialog = new Lang.Class({ Main.ctrlAltTabManager.addGroup(this.actor, _("Unlock Window"), 'dialog-password-symbolic'); this._idleMonitor = Meta.IdleMonitor.get_core(); - this._idleWatchId = this._idleMonitor.add_idle_watch(IDLE_TIMEOUT * 1000, Lang.bind(this, this._escape)); + this._idleWatchId = this._idleMonitor.add_idle_watch(IDLE_TIMEOUT * 1000, this._escape.bind(this)); }, _updateSensitivity(sensitive) { diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index d365336f5..4e1ce25e9 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -38,7 +38,7 @@ var Avatar = new Lang.Class({ // Monitor the scaling factor to make sure we recreate the avatar when needed. let themeContext = St.ThemeContext.get_for_stage(global.stage); - themeContext.connect('notify::scale-factor', Lang.bind(this, this.update)); + themeContext.connect('notify::scale-factor', this.update.bind(this)); }, setSensitive(sensitive) { @@ -85,8 +85,8 @@ var UserWidgetLabel = new Lang.Class({ this._currentLabel = null; - this._userLoadedId = this._user.connect('notify::is-loaded', Lang.bind(this, this._updateUser)); - this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUser)); + this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this)); + this._userChangedId = this._user.connect('changed', this._updateUser.bind(this)); this._updateUser(); // We can't override the destroy vfunc because that might be called during @@ -94,7 +94,7 @@ var UserWidgetLabel = new Lang.Class({ // so we use a signal, that will be disconnected by GObject the first time // the actor is destroyed (which is guaranteed to be as part of a normal // destroy() call from JS, possibly from some ancestor) - this.connect('destroy', Lang.bind(this, this._onDestroy)); + this.connect('destroy', this._onDestroy.bind(this)); }, _onDestroy() { @@ -159,7 +159,7 @@ var UserWidget = new Lang.Class({ this.actor = new St.BoxLayout({ style_class: 'user-widget', vertical: false }); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._avatar = new Avatar(user); this.actor.add_child(this._avatar.actor); @@ -170,8 +170,8 @@ var UserWidget = new Lang.Class({ this._label.bind_property('label-actor', this.actor, 'label-actor', GObject.BindingFlags.SYNC_CREATE); - this._userLoadedId = this._user.connect('notify::is-loaded', Lang.bind(this, this._updateUser)); - this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUser)); + this._userLoadedId = this._user.connect('notify::is-loaded', this._updateUser.bind(this)); + this._userChangedId = this._user.connect('changed', this._updateUser.bind(this)); this._updateUser(); }, diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 14ee0fa5e..d06b4279d 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -57,7 +57,7 @@ var TouchpadShowOverviewAction = new Lang.Class({ Name: 'TouchpadShowOverviewAction', _init(actor) { - actor.connect('captured-event', Lang.bind(this, this._handleEvent)); + actor.connect('captured-event', this._handleEvent.bind(this)); }, _handleEvent(actor, event) { @@ -145,7 +145,7 @@ var ViewSelector = new Lang.Class({ this.actor = new Shell.Stack({ name: 'viewSelector' }); this._showAppsButton = showAppsButton; - this._showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled)); + this._showAppsButton.connect('notify::checked', this._onShowAppsButtonToggled.bind(this)); this._activePage = null; @@ -155,8 +155,8 @@ var ViewSelector = new Lang.Class({ ShellEntry.addContextMenu(this._entry); this._text = this._entry.clutter_text; - this._text.connect('text-changed', Lang.bind(this, this._onTextChanged)); - this._text.connect('key-press-event', Lang.bind(this, this._onKeyPress)); + this._text.connect('text-changed', this._onTextChanged.bind(this)); + this._text.connect('key-press-event', this._onKeyPress.bind(this)); this._text.connect('key-focus-in', () => { this._searchResults.highlightDefault(true); }); @@ -170,8 +170,8 @@ var ViewSelector = new Lang.Class({ this._entry.menu.close(); this._searchResults.popupMenuDefault(); }); - this._entry.connect('notify::mapped', Lang.bind(this, this._onMapped)); - global.stage.connect('notify::key-focus', Lang.bind(this, this._onStageKeyFocusChanged)); + this._entry.connect('notify::mapped', this._onMapped.bind(this)); + global.stage.connect('notify::key-focus', this._onStageKeyFocusChanged.bind(this)); this._entry.set_primary_icon(new St.Icon({ style_class: 'search-entry-icon', icon_name: 'edit-find-symbolic' })); @@ -208,7 +208,7 @@ var ViewSelector = new Lang.Class({ this._stageKeyPressId = 0; Main.overview.connect('showing', () => { this._stageKeyPressId = global.stage.connect('key-press-event', - Lang.bind(this, this._onStageKeyPress)); + this._onStageKeyPress.bind(this)); }); Main.overview.connect('hiding', () => { if (this._stageKeyPressId != 0) { @@ -233,14 +233,14 @@ var ViewSelector = new Lang.Class({ Meta.KeyBindingFlags.NONE, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._toggleAppsPage)); + this._toggleAppsPage.bind(this)); Main.wm.addKeybinding('toggle-overview', new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), Meta.KeyBindingFlags.NONE, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(Main.overview, Main.overview.toggle)); + Main.overview.toggle.bind(Main.overview)); let side; if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) @@ -258,11 +258,11 @@ var ViewSelector = new Lang.Class({ global.stage.add_action(gesture); gesture = new ShowOverviewAction(); - gesture.connect('activated', Lang.bind(this, this._pinchGestureActivated)); + gesture.connect('activated', this._pinchGestureActivated.bind(this)); global.stage.add_action(gesture); gesture = new TouchpadShowOverviewAction(global.stage); - gesture.connect('activated', Lang.bind(this, this._pinchGestureActivated)); + gesture.connect('activated', this._pinchGestureActivated.bind(this)); }, _pinchGestureActivated(action, scale) { @@ -484,7 +484,7 @@ var ViewSelector = new Lang.Class({ if (this._entry.mapped) { // Enable 'find-as-you-type' this._capturedEventId = global.stage.connect('captured-event', - Lang.bind(this, this._onCapturedEvent)); + this._onCapturedEvent.bind(this)); this._text.set_cursor_visible(true); this._text.set_selection(0, 0); } else { @@ -538,7 +538,7 @@ var ViewSelector = new Lang.Class({ if (this._iconClickedId == 0) this._iconClickedId = this._entry.connect('secondary-icon-clicked', - Lang.bind(this, this.reset)); + this.reset.bind(this)); } else { if (this._iconClickedId > 0) { this._entry.disconnect(this._iconClickedId); diff --git a/js/ui/windowAttentionHandler.js b/js/ui/windowAttentionHandler.js index 3de593546..524e47c0f 100644 --- a/js/ui/windowAttentionHandler.js +++ b/js/ui/windowAttentionHandler.js @@ -12,7 +12,7 @@ var WindowAttentionHandler = new Lang.Class({ _init() { this._tracker = Shell.WindowTracker.get_default(); this._windowDemandsAttentionId = global.display.connect('window-demands-attention', - Lang.bind(this, this._onWindowDemandsAttention)); + this._onWindowDemandsAttention.bind(this)); }, _getTitleAndBanner(app, window) { @@ -72,7 +72,7 @@ var Source = new Lang.Class({ this.signalIDs.push(this._window.connect('unmanaged', () => { this.destroy(); })); - this.connect('destroy', Lang.bind(this, this._onDestroy)); + this.connect('destroy', this._onDestroy.bind(this)); }, _onDestroy() { diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 7f7d63ce8..d450f35f9 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -82,13 +82,13 @@ var DisplayChangeDialog = new Lang.Class({ to avoid ellipsizing the labels. */ this._cancelButton = this.addButton({ label: _("Revert Settings"), - action: Lang.bind(this, this._onFailure), + action: this._onFailure.bind(this), key: Clutter.Escape }); this._okButton = this.addButton({ label: _("Keep Changes"), - action: Lang.bind(this, this._onSuccess), + action: this._onSuccess.bind(this), default: true }); - this._timeoutId = Mainloop.timeout_add(ONE_SECOND, Lang.bind(this, this._tick)); + this._timeoutId = Mainloop.timeout_add(ONE_SECOND, this._tick.bind(this)); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick'); }, @@ -198,17 +198,17 @@ var WorkspaceTracker = new Lang.Class({ this._pauseWorkspaceCheck = false; let tracker = Shell.WindowTracker.get_default(); - tracker.connect('startup-sequence-changed', Lang.bind(this, this._queueCheckWorkspaces)); + tracker.connect('startup-sequence-changed', this._queueCheckWorkspaces.bind(this)); - global.screen.connect('notify::n-workspaces', Lang.bind(this, this._nWorkspacesChanged)); - global.window_manager.connect('switch-workspace', Lang.bind(this, this._queueCheckWorkspaces)); + global.screen.connect('notify::n-workspaces', this._nWorkspacesChanged.bind(this)); + global.window_manager.connect('switch-workspace', this._queueCheckWorkspaces.bind(this)); - global.screen.connect('window-entered-monitor', Lang.bind(this, this._windowEnteredMonitor)); - global.screen.connect('window-left-monitor', Lang.bind(this, this._windowLeftMonitor)); - global.screen.connect('restacked', Lang.bind(this, this._windowsRestacked)); + global.screen.connect('window-entered-monitor', this._windowEnteredMonitor.bind(this)); + global.screen.connect('window-left-monitor', this._windowLeftMonitor.bind(this)); + global.screen.connect('restacked', this._windowsRestacked.bind(this)); this._workspaceSettings = this._getWorkspaceSettings(); - this._workspaceSettings.connect('changed::dynamic-workspaces', Lang.bind(this, this._queueCheckWorkspaces)); + this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this)); this._nWorkspacesChanged(); }, @@ -340,7 +340,7 @@ var WorkspaceTracker = new Lang.Class({ _queueCheckWorkspaces() { if (this._checkWorkspacesId == 0) - this._checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, this._checkWorkspaces)); + this._checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._checkWorkspaces.bind(this)); }, _nWorkspacesChanged() { @@ -360,8 +360,8 @@ var WorkspaceTracker = new Lang.Class({ for (w = oldNumWorkspaces; w < newNumWorkspaces; w++) { let workspace = this._workspaces[w]; - workspace._windowAddedId = workspace.connect('window-added', Lang.bind(this, this._queueCheckWorkspaces)); - workspace._windowRemovedId = workspace.connect('window-removed', Lang.bind(this, this._windowRemoved)); + workspace._windowAddedId = workspace.connect('window-added', this._queueCheckWorkspaces.bind(this)); + workspace._windowRemovedId = workspace.connect('window-removed', this._windowRemoved.bind(this)); } } else { @@ -454,7 +454,7 @@ var TilePreview = new Lang.Class({ { opacity: 0, time: WINDOW_ANIMATION_TIME, transition: 'easeOutQuad', - onComplete: Lang.bind(this, this._reset) + onComplete: this._reset.bind(this) }); }, @@ -483,7 +483,7 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({ _init(actor) { this._dx = 0; this._dy = 0; - actor.connect('captured-event', Lang.bind(this, this._handleEvent)); + actor.connect('captured-event', this._handleEvent.bind(this)); }, _checkActivated() { @@ -692,7 +692,7 @@ var WindowManager = new Lang.Class({ this._isWorkspacePrepended = false; this._switchData = null; - this._shellwm.connect('kill-switch-workspace', Lang.bind(this, this._switchWorkspaceDone)); + this._shellwm.connect('kill-switch-workspace', this._switchWorkspaceDone.bind(this)); this._shellwm.connect('kill-window-effects', (shellwm, actor) => { this._minimizeWindowDone(shellwm, actor); this._mapWindowDone(shellwm, actor); @@ -700,21 +700,21 @@ var WindowManager = new Lang.Class({ this._sizeChangeWindowDone(shellwm, actor); }); - this._shellwm.connect('switch-workspace', Lang.bind(this, this._switchWorkspace)); - this._shellwm.connect('show-tile-preview', Lang.bind(this, this._showTilePreview)); - this._shellwm.connect('hide-tile-preview', Lang.bind(this, this._hideTilePreview)); - this._shellwm.connect('show-window-menu', Lang.bind(this, this._showWindowMenu)); - this._shellwm.connect('minimize', Lang.bind(this, this._minimizeWindow)); - this._shellwm.connect('unminimize', Lang.bind(this, this._unminimizeWindow)); - this._shellwm.connect('size-change', Lang.bind(this, this._sizeChangeWindow)); - this._shellwm.connect('size-changed', Lang.bind(this, this._sizeChangedWindow)); - this._shellwm.connect('map', Lang.bind(this, this._mapWindow)); - this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow)); - this._shellwm.connect('filter-keybinding', Lang.bind(this, this._filterKeybinding)); - this._shellwm.connect('confirm-display-change', Lang.bind(this, this._confirmDisplayChange)); - this._shellwm.connect('create-close-dialog', Lang.bind(this, this._createCloseDialog)); - this._shellwm.connect('create-inhibit-shortcuts-dialog', Lang.bind(this, this._createInhibitShortcutsDialog)); - global.screen.connect('restacked', Lang.bind(this, this._syncStacking)); + this._shellwm.connect('switch-workspace', this._switchWorkspace.bind(this)); + this._shellwm.connect('show-tile-preview', this._showTilePreview.bind(this)); + this._shellwm.connect('hide-tile-preview', this._hideTilePreview.bind(this)); + this._shellwm.connect('show-window-menu', this._showWindowMenu.bind(this)); + this._shellwm.connect('minimize', this._minimizeWindow.bind(this)); + this._shellwm.connect('unminimize', this._unminimizeWindow.bind(this)); + this._shellwm.connect('size-change', this._sizeChangeWindow.bind(this)); + this._shellwm.connect('size-changed', this._sizeChangedWindow.bind(this)); + this._shellwm.connect('map', this._mapWindow.bind(this)); + this._shellwm.connect('destroy', this._destroyWindow.bind(this)); + this._shellwm.connect('filter-keybinding', this._filterKeybinding.bind(this)); + this._shellwm.connect('confirm-display-change', this._confirmDisplayChange.bind(this)); + this._shellwm.connect('create-close-dialog', this._createCloseDialog.bind(this)); + this._shellwm.connect('create-inhibit-shortcuts-dialog', this._createInhibitShortcutsDialog.bind(this)); + global.screen.connect('restacked', this._syncStacking.bind(this)); this._workspaceSwitcherPopup = null; this._tilePreview = null; @@ -735,187 +735,187 @@ var WindowManager = new Lang.Class({ this.setCustomKeybindingHandler('switch-to-workspace-left', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-right', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-up', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-down', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-last', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-left', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-right', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-up', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-down', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-1', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-2', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-3', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-4', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-5', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-6', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-7', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-8', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-9', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-10', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-11', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-to-workspace-12', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-1', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-2', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-3', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-4', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-5', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-6', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-7', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-8', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-9', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-10', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-11', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-12', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('move-to-workspace-last', Shell.ActionMode.NORMAL, - Lang.bind(this, this._showWorkspaceSwitcher)); + this._showWorkspaceSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-applications', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-group', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-applications-backward', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-group-backward', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-windows', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-windows-backward', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('cycle-windows', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('cycle-windows-backward', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('cycle-group', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('cycle-group-backward', Shell.ActionMode.NORMAL, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.setCustomKeybindingHandler('switch-panels', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.LOCK_SCREEN | Shell.ActionMode.UNLOCK_SCREEN | Shell.ActionMode.LOGIN_SCREEN, - Lang.bind(this, this._startA11ySwitcher)); + this._startA11ySwitcher.bind(this)); this.setCustomKeybindingHandler('switch-panels-backward', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.LOCK_SCREEN | Shell.ActionMode.UNLOCK_SCREEN | Shell.ActionMode.LOGIN_SCREEN, - Lang.bind(this, this._startA11ySwitcher)); + this._startA11ySwitcher.bind(this)); this.setCustomKeybindingHandler('switch-monitor', Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - Lang.bind(this, this._startSwitcher)); + this._startSwitcher.bind(this)); this.addKeybinding('pause-resume-tweens', new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), Meta.KeyBindingFlags.NONE, Shell.ActionMode.ALL, - Lang.bind(this, this._toggleTweens)); + this._toggleTweens.bind(this)); this.addKeybinding('open-application-menu', new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), Meta.KeyBindingFlags.NONE, Shell.ActionMode.NORMAL | Shell.ActionMode.POPUP, - Lang.bind(this, this._toggleAppMenu)); + this._toggleAppMenu.bind(this)); this.addKeybinding('toggle-message-tray', new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }), @@ -923,10 +923,10 @@ var WindowManager = new Lang.Class({ Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW | Shell.ActionMode.POPUP, - Lang.bind(this, this._toggleCalendar)); + this._toggleCalendar.bind(this)); - global.display.connect('show-resize-popup', Lang.bind(this, this._showResizePopup)); - global.display.connect('show-pad-osd', Lang.bind(this, this._showPadOsd)); + global.display.connect('show-resize-popup', this._showResizePopup.bind(this)); + global.display.connect('show-pad-osd', this._showPadOsd.bind(this)); global.display.connect('show-osd', (display, monitorIndex, iconName, label) => { let icon = Gio.Icon.new_for_string(iconName); Main.osdWindowManager.show(monitorIndex, icon, label, null); @@ -974,15 +974,15 @@ var WindowManager = new Lang.Class({ false, -1, 1); let gesture = new WorkspaceSwitchAction(); - gesture.connect('activated', Lang.bind(this, this._actionSwitchWorkspace)); + gesture.connect('activated', this._actionSwitchWorkspace.bind(this)); global.stage.add_action(gesture); // This is not a normal Clutter.GestureAction, doesn't need add_action() gesture = new TouchpadWorkspaceSwitchAction(global.stage); - gesture.connect('activated', Lang.bind(this, this._actionSwitchWorkspace)); + gesture.connect('activated', this._actionSwitchWorkspace.bind(this)); gesture = new AppSwitchAction(); - gesture.connect('activated', Lang.bind(this, this._switchApp)); + gesture.connect('activated', this._switchApp.bind(this)); global.stage.add_action(gesture); let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN; diff --git a/js/ui/workspace.js b/js/ui/workspace.js index c0772b7f2..d049eae61 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -138,7 +138,7 @@ var WindowClone = new Lang.Class({ this._stackAbove = null; this._windowClone._updateId = this.metaWindow.connect('size-changed', - Lang.bind(this, this._onRealWindowSizeChanged)); + this._onRealWindowSizeChanged.bind(this)); this._windowClone._destroyId = this.realWindow.connect('destroy', () => { // First destroy the clone and then destroy everything @@ -154,11 +154,11 @@ var WindowClone = new Lang.Class({ this.actor.y = this._boundingBox.y; let clickAction = new Clutter.ClickAction(); - clickAction.connect('clicked', Lang.bind(this, this._onClicked)); - clickAction.connect('long-press', Lang.bind(this, this._onLongPress)); + clickAction.connect('clicked', this._onClicked.bind(this)); + clickAction.connect('long-press', this._onLongPress.bind(this)); this.actor.add_action(clickAction); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress)); + this.actor.connect('destroy', this._onDestroy.bind(this)); + this.actor.connect('key-press-event', this._onKeyPress.bind(this)); this.actor.connect('enter-event', () => { this.emit('show-chrome'); }); this.actor.connect('key-focus-in', () => { this.emit('show-chrome'); }); @@ -171,9 +171,9 @@ var WindowClone = new Lang.Class({ manualMode: true, dragActorMaxSize: WINDOW_DND_SIZE, dragActorOpacity: DRAGGING_WINDOW_OPACITY }); - this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin)); - this._draggable.connect('drag-cancelled', Lang.bind(this, this._onDragCancelled)); - this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd)); + this._draggable.connect('drag-begin', this._onDragBegin.bind(this)); + this._draggable.connect('drag-cancelled', this._onDragCancelled.bind(this)); + this._draggable.connect('drag-end', this._onDragEnd.bind(this)); this.inDrag = false; this._selected = false; @@ -460,11 +460,11 @@ var WindowOverlay = new Lang.Class({ button._overlap = 0; this._idleToggleCloseId = 0; - button.connect('clicked', Lang.bind(this, this._closeWindow)); + button.connect('clicked', this._closeWindow.bind(this)); - windowClone.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - windowClone.connect('show-chrome', Lang.bind(this, this._onShowChrome)); - windowClone.connect('hide-chrome', Lang.bind(this, this._onHideChrome)); + windowClone.actor.connect('destroy', this._onDestroy.bind(this)); + windowClone.connect('show-chrome', this._onShowChrome.bind(this)); + windowClone.connect('hide-chrome', this._onHideChrome.bind(this)); this._windowAddedId = 0; @@ -482,10 +482,10 @@ var WindowOverlay = new Lang.Class({ parentActor.add_actor(this.title); parentActor.add_actor(this.closeButton); title.connect('style-changed', - Lang.bind(this, this._onStyleChanged)); + this._onStyleChanged.bind(this)); button.connect('style-changed', - Lang.bind(this, this._onStyleChanged)); - this.border.connect('style-changed', Lang.bind(this, this._onStyleChanged)); + this._onStyleChanged.bind(this)); + this.border.connect('style-changed', this._onStyleChanged.bind(this)); // force a style change if we are already on a stage - otherwise // the signal will be emitted normally when we are added if (parentActor.get_stage()) @@ -583,8 +583,7 @@ var WindowOverlay = new Lang.Class({ this._workspace = metaWindow.get_workspace(); this._windowAddedId = this._workspace.connect('window-added', - Lang.bind(this, - this._onWindowAdded)); + this._onWindowAdded.bind(this)); this._windowClone.deleteAll(); }, @@ -668,7 +667,7 @@ var WindowOverlay = new Lang.Class({ _onHideChrome() { if (this._idleToggleCloseId == 0) { - this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton)); + this._idleToggleCloseId = Mainloop.timeout_add(750, this._idleToggleCloseButton.bind(this)); GLib.Source.set_name_by_id(this._idleToggleCloseId, '[gnome-shell] this._idleToggleCloseButton'); } }, @@ -1126,7 +1125,7 @@ var Workspace = new Lang.Class({ this.actor.add_actor(this._dropRect); this.actor.add_actor(this._windowOverlaysGroup); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); let windows = global.get_window_actors().filter(this._isMyWindow, this); @@ -1143,14 +1142,14 @@ var Workspace = new Lang.Class({ // Track window changes if (this.metaWorkspace) { this._windowAddedId = this.metaWorkspace.connect('window-added', - Lang.bind(this, this._windowAdded)); + this._windowAdded.bind(this)); this._windowRemovedId = this.metaWorkspace.connect('window-removed', - Lang.bind(this, this._windowRemoved)); + this._windowRemoved.bind(this)); } this._windowEnteredMonitorId = global.screen.connect('window-entered-monitor', - Lang.bind(this, this._windowEnteredMonitor)); + this._windowEnteredMonitor.bind(this)); this._windowLeftMonitorId = global.screen.connect('window-left-monitor', - Lang.bind(this, this._windowLeftMonitor)); + this._windowLeftMonitor.bind(this)); this._repositionWindowsId = 0; this.leavingOverview = false; @@ -1480,7 +1479,7 @@ var Workspace = new Lang.Class({ this._currentLayout = null; this._repositionWindowsId = Mainloop.timeout_add(750, - Lang.bind(this, this._delayedWindowRepositioning)); + this._delayedWindowRepositioning.bind(this)); GLib.Source.set_name_by_id(this._repositionWindowsId, '[gnome-shell] this._delayedWindowRepositioning'); }, @@ -1586,8 +1585,7 @@ var Workspace = new Lang.Class({ fadeToOverview() { // We don't want to reposition windows while animating in this way. this._animatingWindowsFade = true; - this._overviewShownId = Main.overview.connect('shown', Lang.bind(this, - this._doneShowingOverview)); + this._overviewShownId = Main.overview.connect('shown', this._doneShowingOverview.bind(this)); if (this._windows.length == 0) return; @@ -1633,8 +1631,7 @@ var Workspace = new Lang.Class({ fadeFromOverview() { this.leavingOverview = true; - this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this, - this._doneLeavingOverview)); + this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this)); if (this._windows.length == 0) return; @@ -1731,8 +1728,7 @@ var Workspace = new Lang.Class({ Mainloop.source_remove(this._repositionWindowsId); this._repositionWindowsId = 0; } - this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this, - this._doneLeavingOverview)); + this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this)); if (this.metaWorkspace != null && this.metaWorkspace != currentWorkspace) return; @@ -1838,7 +1834,7 @@ var Workspace = new Lang.Class({ clone.positioned = positioned; clone.connect('selected', - Lang.bind(this, this._onCloneSelected)); + this._onCloneSelected.bind(this)); clone.connect('drag-begin', () => { Main.overview.beginWindowDrag(clone.metaWindow); overlay.hide(); @@ -1856,7 +1852,7 @@ var Workspace = new Lang.Class({ this.actor.add_actor(clone.actor); - overlay.connect('show-close-button', Lang.bind(this, this._onShowOverlayClose)); + overlay.connect('show-close-button', this._onShowOverlayClose.bind(this)); if (this._windows.length == 0) clone.setStackAbove(null); diff --git a/js/ui/workspaceSwitcherPopup.js b/js/ui/workspaceSwitcherPopup.js index 1f674d705..12bff85d9 100644 --- a/js/ui/workspaceSwitcherPopup.js +++ b/js/ui/workspaceSwitcherPopup.js @@ -36,9 +36,9 @@ var WorkspaceSwitcherPopup = new Lang.Class({ this._itemSpacing = this._list.get_theme_node().get_length('spacing'); }); - this._list.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this._list.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this._list.connect('allocate', Lang.bind(this, this._allocate)); + this._list.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this._list.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this._list.connect('allocate', this._allocate.bind(this)); this._container.add(this._list); this.actor.add_actor(this._container); @@ -48,8 +48,8 @@ var WorkspaceSwitcherPopup = new Lang.Class({ this.actor.hide(); this._globalSignals = []; - this._globalSignals.push(global.screen.connect('workspace-added', Lang.bind(this, this._redisplay))); - this._globalSignals.push(global.screen.connect('workspace-removed', Lang.bind(this, this._redisplay))); + this._globalSignals.push(global.screen.connect('workspace-added', this._redisplay.bind(this))); + this._globalSignals.push(global.screen.connect('workspace-removed', this._redisplay.bind(this))); }, _getPreferredHeight(actor, forWidth, alloc) { @@ -142,7 +142,7 @@ var WorkspaceSwitcherPopup = new Lang.Class({ this._redisplay(); if (this._timeoutId != 0) Mainloop.source_remove(this._timeoutId); - this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, Lang.bind(this, this._onTimeout)); + this._timeoutId = Mainloop.timeout_add(DISPLAY_TIMEOUT, this._onTimeout.bind(this)); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout'); this._show(); }, diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 64fa780f6..7d5d2c08c 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -69,7 +69,7 @@ var WindowClone = new Lang.Class({ this.metaWindow = realWindow.meta_window; this.clone._updateId = this.metaWindow.connect('position-changed', - Lang.bind(this, this._onPositionChanged)); + this._onPositionChanged.bind(this)); this.clone._destroyId = this.realWindow.connect('destroy', () => { // First destroy the clone and then destroy everything // This will ensure that we never see it in the _disconnectSignals loop @@ -79,19 +79,19 @@ var WindowClone = new Lang.Class({ this._onPositionChanged(); this.actor.connect('button-release-event', - Lang.bind(this, this._onButtonRelease)); + this._onButtonRelease.bind(this)); this.actor.connect('touch-event', - Lang.bind(this, this._onTouchEvent)); + this._onTouchEvent.bind(this)); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._draggable = DND.makeDraggable(this.actor, { restoreOnSuccess: true, dragActorMaxSize: Workspace.WINDOW_DND_SIZE, dragActorOpacity: Workspace.DRAGGING_WINDOW_OPACITY }); - this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin)); - this._draggable.connect('drag-cancelled', Lang.bind(this, this._onDragCancelled)); - this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd)); + this._draggable.connect('drag-begin', this._onDragBegin.bind(this)); + this._draggable.connect('drag-cancelled', this._onDragCancelled.bind(this)); + this._draggable.connect('drag-end', this._onDragEnd.bind(this)); this.inDrag = false; let iter = win => { @@ -153,8 +153,9 @@ var WindowClone = new Lang.Class({ let clone = new Clutter.Clone({ source: realDialog }); this._updateDialogPosition(realDialog, clone); - clone._updateId = metaDialog.connect('position-changed', - Lang.bind(this, this._updateDialogPosition, clone)); + clone._updateId = metaDialog.connect('position-changed', dialog => { + this._updateDialogPosition(dialog, clone); + }); clone._destroyId = realDialog.connect('destroy', () => { clone.destroy(); }); @@ -270,7 +271,7 @@ var WorkspaceThumbnail = new Lang.Class({ this._contents = new Clutter.Actor(); this.actor.add_child(this._contents); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); this._createBackground(); @@ -289,8 +290,7 @@ var WorkspaceThumbnail = new Lang.Class({ for (let i = 0; i < windows.length; i++) { let minimizedChangedId = windows[i].meta_window.connect('notify::minimized', - Lang.bind(this, - this._updateMinimized)); + this._updateMinimized.bind(this)); this._allWindows.push(windows[i].meta_window); this._minimizedChangedIds.push(minimizedChangedId); @@ -301,13 +301,13 @@ var WorkspaceThumbnail = new Lang.Class({ // Track window changes this._windowAddedId = this.metaWorkspace.connect('window-added', - Lang.bind(this, this._windowAdded)); + this._windowAdded.bind(this)); this._windowRemovedId = this.metaWorkspace.connect('window-removed', - Lang.bind(this, this._windowRemoved)); + this._windowRemoved.bind(this)); this._windowEnteredMonitorId = global.screen.connect('window-entered-monitor', - Lang.bind(this, this._windowEnteredMonitor)); + this._windowEnteredMonitor.bind(this)); this._windowLeftMonitorId = global.screen.connect('window-left-monitor', - Lang.bind(this, this._windowLeftMonitor)); + this._windowLeftMonitor.bind(this)); this.state = ThumbnailState.NORMAL; this._slidePosition = 0; // Fully slid in @@ -410,8 +410,7 @@ var WorkspaceThumbnail = new Lang.Class({ if (this._allWindows.indexOf(metaWin) == -1) { let minimizedChangedId = metaWin.connect('notify::minimized', - Lang.bind(this, - this._updateMinimized)); + this._updateMinimized.bind(this)); this._allWindows.push(metaWin); this._minimizedChangedIds.push(minimizedChangedId); } @@ -618,9 +617,9 @@ var ThumbnailsBox = new Lang.Class({ this.actor = new Shell.GenericContainer({ reactive: true, style_class: 'workspace-thumbnails', request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT }); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); this.actor._delegate = this; let indicator = new St.Bin({ style_class: 'workspace-thumbnail-indicator' }); @@ -651,30 +650,30 @@ var ThumbnailsBox = new Lang.Class({ this._thumbnails = []; this.actor.connect('button-press-event', () => Clutter.EVENT_STOP); - this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); - this.actor.connect('touch-event', Lang.bind(this, this._onTouchEvent)); + this.actor.connect('button-release-event', this._onButtonRelease.bind(this)); + this.actor.connect('touch-event', this._onTouchEvent.bind(this)); Main.overview.connect('showing', - Lang.bind(this, this._createThumbnails)); + this._createThumbnails.bind(this)); Main.overview.connect('hidden', - Lang.bind(this, this._destroyThumbnails)); + this._destroyThumbnails.bind(this)); Main.overview.connect('item-drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.overview.connect('item-drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('item-drag-cancelled', - Lang.bind(this, this._onDragCancelled)); + this._onDragCancelled.bind(this)); Main.overview.connect('window-drag-begin', - Lang.bind(this, this._onDragBegin)); + this._onDragBegin.bind(this)); Main.overview.connect('window-drag-end', - Lang.bind(this, this._onDragEnd)); + this._onDragEnd.bind(this)); Main.overview.connect('window-drag-cancelled', - Lang.bind(this, this._onDragCancelled)); + this._onDragCancelled.bind(this)); this._settings = new Gio.Settings({ schema_id: OVERRIDE_SCHEMA }); this._settings.connect('changed::dynamic-workspaces', - Lang.bind(this, this._updateSwitcherVisibility)); + this._updateSwitcherVisibility.bind(this)); Main.layoutManager.connect('monitors-changed', () => { this._destroyThumbnails(); @@ -721,7 +720,7 @@ var ThumbnailsBox = new Lang.Class({ _onDragBegin() { this._dragCancelled = false; this._dragMonitor = { - dragMotion: Lang.bind(this, this._onDragMotion) + dragMotion: this._onDragMotion.bind(this) }; DND.addDragMonitor(this._dragMonitor); }, @@ -865,13 +864,13 @@ var ThumbnailsBox = new Lang.Class({ _createThumbnails() { this._switchWorkspaceNotifyId = global.window_manager.connect('switch-workspace', - Lang.bind(this, this._activeWorkspaceChanged)); + this._activeWorkspaceChanged.bind(this)); this._nWorkspacesNotifyId = global.screen.connect('notify::n-workspaces', - Lang.bind(this, this._workspacesChanged)); + this._workspacesChanged.bind(this)); this._syncStackingId = Main.overview.connect('windows-restacked', - Lang.bind(this, this._syncStacking)); + this._syncStacking.bind(this)); this._targetScale = 0; this._scale = 0; @@ -1108,7 +1107,7 @@ var ThumbnailsBox = new Lang.Class({ return; Meta.later_add(Meta.LaterType.BEFORE_REDRAW, - Lang.bind(this, this._updateStates)); + this._updateStates.bind(this)); this._stateUpdateQueued = true; }, diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 7317114bb..563e43da4 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -32,7 +32,7 @@ var WorkspacesViewBase = new Lang.Class({ _init(monitorIndex) { this.actor = new St.Widget({ style_class: 'workspaces-view', reactive: true }); - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + this.actor.connect('destroy', this._onDestroy.bind(this)); global.focus_manager.add_group(this.actor); // The actor itself isn't a drop target, so we don't want to pick on its area @@ -44,8 +44,8 @@ var WorkspacesViewBase = new Lang.Class({ this._actualGeometry = null; this._inDrag = false; - this._windowDragBeginId = Main.overview.connect('window-drag-begin', Lang.bind(this, this._dragBegin)); - this._windowDragEndId = Main.overview.connect('window-drag-end', Lang.bind(this, this._dragEnd)); + this._windowDragBeginId = Main.overview.connect('window-drag-begin', this._dragBegin.bind(this)); + this._windowDragEndId = Main.overview.connect('window-drag-end', this._dragEnd.bind(this)); }, _onDestroy() { @@ -105,11 +105,11 @@ var WorkspacesView = new Lang.Class({ step_increment: 0, upper: global.screen.n_workspaces }); this.scrollAdjustment.connect('notify::value', - Lang.bind(this, this._onScroll)); + this._onScroll.bind(this)); this._workspaces = []; this._updateWorkspaces(); - this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', Lang.bind(this, this._updateWorkspaces)); + this._updateWorkspacesId = global.screen.connect('notify::n-workspaces', this._updateWorkspaces.bind(this)); this._overviewShownId = Main.overview.connect('shown', () => { @@ -119,7 +119,7 @@ var WorkspacesView = new Lang.Class({ this._switchWorkspaceNotifyId = global.window_manager.connect('switch-workspace', - Lang.bind(this, this._activeWorkspaceChanged)); + this._activeWorkspaceChanged.bind(this)); }, _setReservedSlot(window) { @@ -414,8 +414,8 @@ var WorkspacesDisplay = new Lang.Class({ _init() { this.actor = new DelegateFocusNavigator({ clip_to_allocation: true }); this.actor._delegate = this; - this.actor.connect('notify::allocation', Lang.bind(this, this._updateWorkspacesActualGeometry)); - this.actor.connect('parent-set', Lang.bind(this, this._parentSet)); + this.actor.connect('notify::allocation', this._updateWorkspacesActualGeometry.bind(this)); + this.actor.connect('parent-set', this._parentSet.bind(this)); let clickAction = new Clutter.ClickAction(); clickAction.connect('clicked', action => { @@ -432,7 +432,7 @@ var WorkspacesDisplay = new Lang.Class({ this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE); let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER }); - panAction.connect('pan', Lang.bind(this, this._onPan)); + panAction.connect('pan', this._onPan.bind(this)); panAction.connect('gesture-begin', () => { if (this._workspacesOnlyOnPrimary) { let event = Clutter.get_current_event(); @@ -464,8 +464,7 @@ var WorkspacesDisplay = new Lang.Class({ this._settings = new Gio.Settings({ schema_id: OVERRIDE_SCHEMA }); this._settings.connect('changed::workspaces-only-on-primary', - Lang.bind(this, - this._workspacesOnlyOnPrimaryChanged)); + this._workspacesOnlyOnPrimaryChanged.bind(this)); this._workspacesOnlyOnPrimaryChanged(); this._switchWorkspaceNotifyId = 0; @@ -501,12 +500,12 @@ var WorkspacesDisplay = new Lang.Class({ this._restackedNotifyId = Main.overview.connect('windows-restacked', - Lang.bind(this, this._onRestacked)); + this._onRestacked.bind(this)); if (this._scrollEventId == 0) - this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); + this._scrollEventId = Main.overview.connect('scroll-event', this._onScrollEvent.bind(this)); if (this._keyPressEventId == 0) - this._keyPressEventId = global.stage.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); + this._keyPressEventId = global.stage.connect('key-press-event', this._onKeyPressEvent.bind(this)); }, animateFromOverview(fadeOnPrimary) { @@ -561,11 +560,11 @@ var WorkspacesDisplay = new Lang.Class({ else view = new WorkspacesView(i); - view.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); + view.actor.connect('scroll-event', this._onScrollEvent.bind(this)); if (i == this._primaryIndex) { this._scrollAdjustment = view.scrollAdjustment; this._scrollAdjustment.connect('notify::value', - Lang.bind(this, this._scrollValueChanged)); + this._scrollValueChanged.bind(this)); } this._workspacesViews.push(view); diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js index deac147d0..9fc284c33 100644 --- a/js/ui/xdndHandler.js +++ b/js/ui/xdndHandler.js @@ -25,9 +25,9 @@ var XdndHandler = new Lang.Class({ global.init_xdnd(); var dnd = Meta.get_backend().get_dnd(); - dnd.connect('dnd-enter', Lang.bind(this, this._onEnter)); - dnd.connect('dnd-position-change', Lang.bind(this, this._onPositionChanged)); - dnd.connect('dnd-leave', Lang.bind(this, this._onLeave)); + dnd.connect('dnd-enter', this._onEnter.bind(this)); + dnd.connect('dnd-position-change', this._onPositionChanged.bind(this)); + dnd.connect('dnd-leave', this._onLeave.bind(this)); this._windowGroupVisibilityHandlerId = 0; }, @@ -49,7 +49,7 @@ var XdndHandler = new Lang.Class({ _onEnter() { this._windowGroupVisibilityHandlerId = global.window_group.connect('notify::visible', - Lang.bind(this, this._onWindowGroupVisibilityChanged)); + this._onWindowGroupVisibilityChanged.bind(this)); this.emit('drag-begin', global.get_current_time()); }, diff --git a/tests/interactive/scroll-view-sizing.js b/tests/interactive/scroll-view-sizing.js index 381a8813f..c927f5e97 100644 --- a/tests/interactive/scroll-view-sizing.js +++ b/tests/interactive/scroll-view-sizing.js @@ -39,9 +39,9 @@ function FlowedBoxes() { FlowedBoxes.prototype = { _init() { this.actor = new Shell.GenericContainer(); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); for (let i = 0; i < BOX_WIDTHS.length; i++) { let child = new St.Bin({ width: BOX_WIDTHS[i], height: BOX_HEIGHT, @@ -135,9 +135,9 @@ SizingIllustrator.prototype = { _init() { this.actor = new Shell.GenericContainer(); - this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); - this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); - this.actor.connect('allocate', Lang.bind(this, this._allocate)); + this.actor.connect('get-preferred-width', this._getPreferredWidth.bind(this)); + this.actor.connect('get-preferred-height', this._getPreferredHeight.bind(this)); + this.actor.connect('allocate', this._allocate.bind(this)); this.minWidthLine = new St.Bin({ style: 'background: red' }); this.actor.add_actor(this.minWidthLine); @@ -156,9 +156,9 @@ SizingIllustrator.prototype = { this.handle = new St.Bin({ style: 'background: yellow; border: 1px solid black;', reactive: true }); - this.handle.connect('button-press-event', Lang.bind(this, this._handlePressed)); - this.handle.connect('button-release-event', Lang.bind(this, this._handleReleased)); - this.handle.connect('motion-event', Lang.bind(this, this._handleMotion)); + this.handle.connect('button-press-event', this._handlePressed.bind(this)); + this.handle.connect('button-release-event', this._handleReleased.bind(this)); + this.handle.connect('motion-event', this._handleMotion.bind(this)); this.actor.add_actor(this.handle); this._inDrag = false;