cleanup: Use type-safe comparisons

We have been using type-safe comparisons in new code for quite a while
now, however old code has only been adapted slowly.

Change all the remaining bits to get rid of another legacy style
difference.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
This commit is contained in:
Florian Müllner 2023-08-07 02:51:19 +02:00 committed by Marge Bot
parent 9a3913d4a0
commit a42f7c2384
94 changed files with 847 additions and 845 deletions

View File

@ -71,9 +71,9 @@ export const AuthPrompt = GObject.registerClass({
this._cancelledRetries = 0; this._cancelledRetries = 0;
let reauthenticationOnly; let reauthenticationOnly;
if (this._mode == AuthPromptMode.UNLOCK_ONLY) if (this._mode === AuthPromptMode.UNLOCK_ONLY)
reauthenticationOnly = true; reauthenticationOnly = true;
else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN) else if (this._mode === AuthPromptMode.UNLOCK_OR_LOG_IN)
reauthenticationOnly = false; reauthenticationOnly = false;
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, {reauthenticationOnly}); this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, {reauthenticationOnly});
@ -337,7 +337,7 @@ export const AuthPrompt = GObject.registerClass({
} }
_onCredentialManagerAuthenticated() { _onCredentialManagerAuthenticated() {
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED) if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset(); this.reset();
} }
@ -352,11 +352,11 @@ export const AuthPrompt = GObject.registerClass({
// 2) Don't reset if we've already succeeded at verification and // 2) Don't reset if we've already succeeded at verification and
// the user is getting logged in. // the user is getting logged in.
if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) && if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
this.verificationStatus == AuthPromptStatus.VERIFYING && this.verificationStatus === AuthPromptStatus.VERIFYING &&
this.smartcardDetected) this.smartcardDetected)
return; return;
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED) if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset(); this.reset();
} }
@ -419,18 +419,18 @@ export const AuthPrompt = GObject.registerClass({
oldActor.remove_all_transitions(); oldActor.remove_all_transitions();
let wasSpinner; let wasSpinner;
if (oldActor == this._spinner) if (oldActor === this._spinner)
wasSpinner = true; wasSpinner = true;
else else
wasSpinner = false; wasSpinner = false;
let isSpinner; let isSpinner;
if (actor == this._spinner) if (actor === this._spinner)
isSpinner = true; isSpinner = true;
else else
isSpinner = false; isSpinner = false;
if (this._defaultButtonWellActor != actor && oldActor) { if (this._defaultButtonWellActor !== actor && oldActor) {
if (!animate) { if (!animate) {
oldActor.opacity = 0; oldActor.opacity = 0;
@ -538,7 +538,7 @@ export const AuthPrompt = GObject.registerClass({
} }
_fadeOutMessage() { _fadeOutMessage() {
if (this._message.opacity == 0) if (this._message.opacity === 0)
return; return;
this._message.remove_all_transitions(); this._message.remove_all_transitions();
this._message.ease({ this._message.ease({
@ -549,12 +549,12 @@ export const AuthPrompt = GObject.registerClass({
} }
setMessage(message, type, wiggleParameters = {duration: 0}) { setMessage(message, type, wiggleParameters = {duration: 0}) {
if (type == GdmUtil.MessageType.ERROR) if (type === GdmUtil.MessageType.ERROR)
this._message.add_style_class_name('login-dialog-message-warning'); this._message.add_style_class_name('login-dialog-message-warning');
else else
this._message.remove_style_class_name('login-dialog-message-warning'); this._message.remove_style_class_name('login-dialog-message-warning');
if (type == GdmUtil.MessageType.HINT) if (type === GdmUtil.MessageType.HINT)
this._message.add_style_class_name('login-dialog-message-hint'); this._message.add_style_class_name('login-dialog-message-hint');
else else
this._message.remove_style_class_name('login-dialog-message-hint'); this._message.remove_style_class_name('login-dialog-message-hint');
@ -627,14 +627,14 @@ export const AuthPrompt = GObject.registerClass({
this._updateEntry(true); this._updateEntry(true);
this.stopSpinning(); this.stopSpinning();
if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED) if (oldStatus === AuthPromptStatus.VERIFICATION_FAILED)
this.emit('failed'); this.emit('failed');
else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED) else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
this.emit('cancelled'); this.emit('cancelled');
let beginRequestType; let beginRequestType;
if (this._mode == AuthPromptMode.UNLOCK_ONLY) { if (this._mode === AuthPromptMode.UNLOCK_ONLY) {
// The user is constant at the unlock screen, so it will immediately // The user is constant at the unlock screen, so it will immediately
// respond to the request with the username // respond to the request with the username
if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED) if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
@ -694,7 +694,7 @@ export const AuthPrompt = GObject.registerClass({
} }
cancel() { cancel() {
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) if (this.verificationStatus === AuthPromptStatus.VERIFICATION_SUCCEEDED)
return; return;
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_IN_PROGRESS) { if (this.verificationStatus === AuthPromptStatus.VERIFICATION_IN_PROGRESS) {

View File

@ -94,7 +94,7 @@ export class Hold extends Task {
release() { release() {
this._acquisitions--; this._acquisitions--;
if (this._acquisitions == 0) if (this._acquisitions === 0)
this.emit('release'); this.emit('release');
} }

View File

@ -194,7 +194,7 @@ const UserList = GObject.registerClass({
if (!hasItems) if (!hasItems)
return; return;
if (global.stage.get_key_focus() != this) if (global.stage.get_key_focus() !== this)
return; return;
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
@ -364,7 +364,7 @@ const SessionMenuButton = GObject.registerClass({
_updateOrnament() { _updateOrnament() {
let itemIds = Object.keys(this._items); let itemIds = Object.keys(this._items);
for (let i = 0; i < itemIds.length; i++) { for (let i = 0; i < itemIds.length; i++) {
if (itemIds[i] == this._activeSessionId) if (itemIds[i] === this._activeSessionId)
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.DOT); this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.DOT);
else else
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.NONE); this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.NONE);
@ -372,7 +372,7 @@ const SessionMenuButton = GObject.registerClass({
} }
setActiveSession(sessionId) { setActiveSession(sessionId) {
if (sessionId == this._activeSessionId) if (sessionId === this._activeSessionId)
return; return;
this._activeSessionId = sessionId; this._activeSessionId = sessionId;
@ -774,13 +774,13 @@ export const LoginDialog = GObject.registerClass({
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY); let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
// Disable user list when there are no users. // Disable user list when there are no users.
if (this._userListLoaded && this._userList.numItems() == 0) if (this._userListLoaded && this._userList.numItems() === 0)
disableUserList = true; disableUserList = true;
if (disableUserList != this._disableUserList) { if (disableUserList !== this._disableUserList) {
this._disableUserList = disableUserList; this._disableUserList = disableUserList;
if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING) if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
this._authPrompt.reset(); this._authPrompt.reset();
if (this._disableUserList && this._timedLoginUserListHold) if (this._disableUserList && this._timedLoginUserListHold)
@ -793,7 +793,8 @@ export const LoginDialog = GObject.registerClass({
// Hide the cancel button if the user list is disabled and we're asking for // Hide the cancel button if the user list is disabled and we're asking for
// a username // a username
if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING && this._disableUserList) if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING &&
this._disableUserList)
cancelVisible = false; cancelVisible = false;
else else
cancelVisible = true; cancelVisible = true;
@ -860,7 +861,7 @@ export const LoginDialog = GObject.registerClass({
} }
_resetGreeterProxy() { _resetGreeterProxy() {
if (GLib.getenv('GDM_GREETER_TEST') != '1') { if (GLib.getenv('GDM_GREETER_TEST') !== '1') {
if (this._greeter) if (this._greeter)
this._greeter.run_dispose(); this._greeter.run_dispose();
@ -904,8 +905,8 @@ export const LoginDialog = GObject.registerClass({
} }
_shouldShowSessionMenuButton() { _shouldShowSessionMenuButton() {
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING && if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFYING &&
this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED) this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
return false; return false;
if (this._user && this._user.is_loaded && this._user.is_logged_in()) if (this._user && this._user.is_loaded && this._user.is_logged_in())
@ -968,7 +969,7 @@ export const LoginDialog = GObject.registerClass({
_bindOpacity() { _bindOpacity() {
this._bindings = Main.layoutManager.uiGroup.get_children() this._bindings = Main.layoutManager.uiGroup.get_children()
.filter(c => c != Main.layoutManager.screenShieldGroup) .filter(c => c !== Main.layoutManager.screenShieldGroup)
.map(c => this.bind_property('opacity', c, 'opacity', 0)); .map(c => this.bind_property('opacity', c, 'opacity', 0));
} }
@ -977,7 +978,8 @@ export const LoginDialog = GObject.registerClass({
} }
_loginScreenSessionActivated() { _loginScreenSessionActivated() {
if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING) if (this.opacity === 255 &&
this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
return; return;
if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.NOT_VERIFYING) if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
@ -1152,8 +1154,8 @@ export const LoginDialog = GObject.registerClass({
// Restart timed login on user interaction // Restart timed login on user interaction
global.stage.connect('captured-event', (actor, event) => { global.stage.connect('captured-event', (actor, event) => {
if (event.type() == Clutter.EventType.KEY_PRESS || if (event.type() === Clutter.EventType.KEY_PRESS ||
event.type() == Clutter.EventType.BUTTON_PRESS) event.type() === Clutter.EventType.BUTTON_PRESS)
this._startTimedLogin(userName, seconds); this._startTimedLogin(userName, seconds);
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;

View File

@ -84,7 +84,7 @@ export class Manager extends Signals.EventEmitter {
} }
} }
if (this._loginFormat != newLoginFormat) { if (this._loginFormat !== newLoginFormat) {
this._loginFormat = newLoginFormat; this._loginFormat = newLoginFormat;
this.emit('login-format-changed', newLoginFormat); this.emit('login-format-changed', newLoginFormat);
} }

View File

@ -289,7 +289,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
} }
_queueMessageTimeout() { _queueMessageTimeout() {
if (this._messageQueueTimeoutId != 0) if (this._messageQueueTimeoutId !== 0)
return; return;
const message = this.currentMessage; const message = this.currentMessage;
@ -337,7 +337,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
_clearMessageQueue() { _clearMessageQueue() {
this.finishMessageQueue(); this.finishMessageQueue();
if (this._messageQueueTimeoutId != 0) { if (this._messageQueueTimeoutId !== 0) {
GLib.source_remove(this._messageQueueTimeoutId); GLib.source_remove(this._messageQueueTimeoutId);
this._messageQueueTimeoutId = 0; this._messageQueueTimeoutId = 0;
} }
@ -383,12 +383,12 @@ export class ShellUserVerifier extends Signals.EventEmitter {
else else
smartcardDetected = this._smartcardManager.hasInsertedTokens(); smartcardDetected = this._smartcardManager.hasInsertedTokens();
if (smartcardDetected != this.smartcardDetected) { if (smartcardDetected !== this.smartcardDetected) {
this.smartcardDetected = smartcardDetected; this.smartcardDetected = smartcardDetected;
if (this.smartcardDetected) if (this.smartcardDetected)
this._preemptingService = SMARTCARD_SERVICE_NAME; this._preemptingService = SMARTCARD_SERVICE_NAME;
else if (this._preemptingService == SMARTCARD_SERVICE_NAME) else if (this._preemptingService === SMARTCARD_SERVICE_NAME)
this._preemptingService = null; this._preemptingService = null;
this.emit('smartcard-status-changed'); this.emit('smartcard-status-changed');
@ -504,7 +504,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
} }
serviceIsDefault(serviceName) { serviceIsDefault(serviceName) {
return serviceName == this._defaultService; return serviceName === this._defaultService;
} }
serviceIsFingerprint(serviceName) { serviceIsFingerprint(serviceName) {

View File

@ -54,9 +54,9 @@ export function recursivelyDeleteDir(dir, deleteParent) {
while ((info = children.next_file(null)) != null) { while ((info = children.next_file(null)) != null) {
let type = info.get_file_type(); let type = info.get_file_type();
let child = dir.get_child(info.get_name()); let child = dir.get_child(info.get_name());
if (type == Gio.FileType.REGULAR) if (type === Gio.FileType.REGULAR)
child.delete(null); child.delete(null);
else if (type == Gio.FileType.DIRECTORY) else if (type === Gio.FileType.DIRECTORY)
recursivelyDeleteDir(child, true); recursivelyDeleteDir(child, true);
} }
@ -80,9 +80,9 @@ export function recursivelyMoveDir(srcDir, destDir) {
let type = info.get_file_type(); let type = info.get_file_type();
let srcChild = srcDir.get_child(info.get_name()); let srcChild = srcDir.get_child(info.get_name());
let destChild = destDir.get_child(info.get_name()); let destChild = destDir.get_child(info.get_name());
if (type == Gio.FileType.REGULAR) if (type === Gio.FileType.REGULAR)
srcChild.move(destChild, Gio.FileCopyFlags.NONE, null, null); srcChild.move(destChild, Gio.FileCopyFlags.NONE, null, null);
else if (type == Gio.FileType.DIRECTORY) else if (type === Gio.FileType.DIRECTORY)
recursivelyMoveDir(srcChild, destChild); recursivelyMoveDir(srcChild, destChild);
} }
} }

View File

@ -36,8 +36,8 @@ const KEY_INPUTMETHOD = 'inputmethod';
function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) { function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) {
if ((IBus.MAJOR_VERSION > requiredMajor) || if ((IBus.MAJOR_VERSION > requiredMajor) ||
(IBus.MAJOR_VERSION == requiredMajor && IBus.MINOR_VERSION > requiredMinor) || (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION > requiredMinor) ||
(IBus.MAJOR_VERSION == requiredMajor && IBus.MINOR_VERSION == requiredMinor && (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION === requiredMinor &&
IBus.MICRO_VERSION >= requiredMicro)) IBus.MICRO_VERSION >= requiredMicro))
return; return;
@ -263,7 +263,7 @@ class IBusManager extends Signals.EventEmitter {
this._currentEngineName = engineName; this._currentEngineName = engineName;
this._candidatePopup.close(BoxPointer.PopupAnimation.NONE); this._candidatePopup.close(BoxPointer.PopupAnimation.NONE);
if (this._registerPropertiesId != 0) if (this._registerPropertiesId !== 0)
return; return;
this._registerPropertiesId = this._registerPropertiesId =
@ -341,7 +341,7 @@ class IBusManager extends Signals.EventEmitter {
if (!ids.includes(TYPING_BOOSTER_ENGINE)) if (!ids.includes(TYPING_BOOSTER_ENGINE))
ids.push(TYPING_BOOSTER_ENGINE); ids.push(TYPING_BOOSTER_ENGINE);
if (this._preloadEnginesId != 0) { if (this._preloadEnginesId !== 0) {
GLib.source_remove(this._preloadEnginesId); GLib.source_remove(this._preloadEnginesId);
this._preloadEnginesId = 0; this._preloadEnginesId = 0;
} }

View File

@ -172,7 +172,7 @@ export const InputMethod = GObject.registerClass({
} }
_onForwardKeyEvent(_context, keyval, keycode, state) { _onForwardKeyEvent(_context, keyval, keycode, state) {
let press = (state & IBus.ModifierType.RELEASE_MASK) == 0; let press = (state & IBus.ModifierType.RELEASE_MASK) === 0;
state &= ~IBus.ModifierType.RELEASE_MASK; state &= ~IBus.ModifierType.RELEASE_MASK;
let curEvent = Clutter.get_current_event(); let curEvent = Clutter.get_current_event();
@ -278,23 +278,23 @@ export const InputMethod = GObject.registerClass({
vfunc_update_content_purpose(purpose) { vfunc_update_content_purpose(purpose) {
let ibusPurpose = 0; let ibusPurpose = 0;
if (purpose == Clutter.InputContentPurpose.NORMAL) if (purpose === Clutter.InputContentPurpose.NORMAL)
ibusPurpose = IBus.InputPurpose.FREE_FORM; ibusPurpose = IBus.InputPurpose.FREE_FORM;
else if (purpose == Clutter.InputContentPurpose.ALPHA) else if (purpose === Clutter.InputContentPurpose.ALPHA)
ibusPurpose = IBus.InputPurpose.ALPHA; ibusPurpose = IBus.InputPurpose.ALPHA;
else if (purpose == Clutter.InputContentPurpose.DIGITS) else if (purpose === Clutter.InputContentPurpose.DIGITS)
ibusPurpose = IBus.InputPurpose.DIGITS; ibusPurpose = IBus.InputPurpose.DIGITS;
else if (purpose == Clutter.InputContentPurpose.NUMBER) else if (purpose === Clutter.InputContentPurpose.NUMBER)
ibusPurpose = IBus.InputPurpose.NUMBER; ibusPurpose = IBus.InputPurpose.NUMBER;
else if (purpose == Clutter.InputContentPurpose.PHONE) else if (purpose === Clutter.InputContentPurpose.PHONE)
ibusPurpose = IBus.InputPurpose.PHONE; ibusPurpose = IBus.InputPurpose.PHONE;
else if (purpose == Clutter.InputContentPurpose.URL) else if (purpose === Clutter.InputContentPurpose.URL)
ibusPurpose = IBus.InputPurpose.URL; ibusPurpose = IBus.InputPurpose.URL;
else if (purpose == Clutter.InputContentPurpose.EMAIL) else if (purpose === Clutter.InputContentPurpose.EMAIL)
ibusPurpose = IBus.InputPurpose.EMAIL; ibusPurpose = IBus.InputPurpose.EMAIL;
else if (purpose == Clutter.InputContentPurpose.NAME) else if (purpose === Clutter.InputContentPurpose.NAME)
ibusPurpose = IBus.InputPurpose.NAME; ibusPurpose = IBus.InputPurpose.NAME;
else if (purpose == Clutter.InputContentPurpose.PASSWORD) else if (purpose === Clutter.InputContentPurpose.PASSWORD)
ibusPurpose = IBus.InputPurpose.PASSWORD; ibusPurpose = IBus.InputPurpose.PASSWORD;
else if (purpose === Clutter.InputContentPurpose.TERMINAL && else if (purpose === Clutter.InputContentPurpose.TERMINAL &&
IBus.InputPurpose.TERMINAL) IBus.InputPurpose.TERMINAL)
@ -325,7 +325,7 @@ export const InputMethod = GObject.registerClass({
if (state & IBus.ModifierType.IGNORED_MASK) if (state & IBus.ModifierType.IGNORED_MASK)
return false; return false;
if (event.type() == Clutter.EventType.KEY_RELEASE) if (event.type() === Clutter.EventType.KEY_RELEASE)
state |= IBus.ModifierType.RELEASE_MASK; state |= IBus.ModifierType.RELEASE_MASK;
this._context.process_key_event_async( this._context.process_key_event_async(
@ -333,7 +333,7 @@ export const InputMethod = GObject.registerClass({
event.get_key_code() - 8, // Convert XKB keycodes to evcodes event.get_key_code() - 8, // Convert XKB keycodes to evcodes
state, -1, this._cancellable, state, -1, this._cancellable,
(context, res) => { (context, res) => {
if (context != this._context) if (context !== this._context)
return; return;
try { try {

View File

@ -81,7 +81,7 @@ export class IntrospectService {
for (let app of apps) { for (let app of apps) {
let appInfo = {}; let appInfo = {};
let isAppActive = focusedApp == app; let isAppActive = focusedApp === app;
if (!this._isStandaloneApp(app)) if (!this._isStandaloneApp(app))
continue; continue;
@ -100,7 +100,7 @@ export class IntrospectService {
if (this._runningApplicationsDirty || if (this._runningApplicationsDirty ||
(this._activeApplicationDirty && (this._activeApplicationDirty &&
this._activeApplication != newActiveApplication)) { this._activeApplication !== newActiveApplication)) {
this._runningApplications = newRunningApplications; this._runningApplications = newRunningApplications;
this._activeApplication = newActiveApplication; this._activeApplication = newActiveApplication;
@ -115,10 +115,10 @@ export class IntrospectService {
return false; return false;
let type = window.get_window_type(); let type = window.get_window_type();
return type == Meta.WindowType.NORMAL || return type === Meta.WindowType.NORMAL ||
type == Meta.WindowType.DIALOG || type === Meta.WindowType.DIALOG ||
type == Meta.WindowType.MODAL_DIALOG || type === Meta.WindowType.MODAL_DIALOG ||
type == Meta.WindowType.UTILITY; type === Meta.WindowType.UTILITY;
} }
async GetRunningApplicationsAsync(params, invocation) { async GetRunningApplicationsAsync(params, invocation) {
@ -160,7 +160,7 @@ export class IntrospectService {
'app-id': GLib.Variant.new('s', app.get_id()), 'app-id': GLib.Variant.new('s', app.get_id()),
'client-type': GLib.Variant.new('u', window.get_client_type()), 'client-type': GLib.Variant.new('u', window.get_client_type()),
'is-hidden': GLib.Variant.new('b', window.is_hidden()), 'is-hidden': GLib.Variant.new('b', window.is_hidden()),
'has-focus': GLib.Variant.new('b', window == focusWindow), 'has-focus': GLib.Variant.new('b', window === focusWindow),
'width': GLib.Variant.new('u', frameRect.width), 'width': GLib.Variant.new('u', frameRect.width),
'height': GLib.Variant.new('u', frameRect.height), 'height': GLib.Variant.new('u', frameRect.height),
}; };

View File

@ -37,7 +37,7 @@ export async function getCompletions(text, commandHeader, globalCompletionList)
// Look for the empty expression or partially entered words // Look for the empty expression or partially entered words
// not proceeded by a dot and match them against global constants // not proceeded by a dot and match them against global constants
matches = text.match(/^(\w*)$/); matches = text.match(/^(\w*)$/);
if (text == '' || matches) { if (text === '' || matches) {
[expr_, attrHead] = matches; [expr_, attrHead] = matches;
methods = globalCompletionList.filter( methods = globalCompletionList.filter(
attr => attr.slice(0, attrHead.length) === attrHead); attr => attr.slice(0, attrHead.length) === attrHead);
@ -72,7 +72,7 @@ function isStopChar(c) {
export function findMatchingQuote(expr, offset) { export function findMatchingQuote(expr, offset) {
let quoteChar = expr.charAt(offset); let quoteChar = expr.charAt(offset);
for (let i = offset - 1; i >= 0; --i) { for (let i = offset - 1; i >= 0; --i) {
if (expr.charAt(i) == quoteChar && expr.charAt(i - 1) != '\\') if (expr.charAt(i) === quoteChar && expr.charAt(i - 1) !== '\\')
return i; return i;
} }
return -1; return -1;
@ -86,7 +86,7 @@ export function findMatchingQuote(expr, offset) {
*/ */
export function findMatchingSlash(expr, offset) { export function findMatchingSlash(expr, offset) {
for (let i = offset - 1; i >= 0; --i) { for (let i = offset - 1; i >= 0; --i) {
if (expr.charAt(i) == '/' && expr.charAt(i - 1) != '\\') if (expr.charAt(i) === '/' && expr.charAt(i - 1) !== '\\')
return i; return i;
} }
return -1; return -1;
@ -120,16 +120,16 @@ export function findTheBrace(expr, offset, ...braces) {
if (offset < 0) if (offset < 0)
return -1; return -1;
if (expr.charAt(offset) == openBrace) if (expr.charAt(offset) === openBrace)
return offset; return offset;
if (expr.charAt(offset).match(/['"]/)) if (expr.charAt(offset).match(/['"]/))
return findTheBrace(expr, findMatchingQuote(expr, offset) - 1, ...braces); return findTheBrace(expr, findMatchingQuote(expr, offset) - 1, ...braces);
if (expr.charAt(offset) == '/') if (expr.charAt(offset) === '/')
return findTheBrace(expr, findMatchingSlash(expr, offset) - 1, ...braces); return findTheBrace(expr, findMatchingSlash(expr, offset) - 1, ...braces);
if (expr.charAt(offset) == closeBrace) if (expr.charAt(offset) === closeBrace)
return findTheBrace(expr, findTheBrace(expr, offset - 1, ...braces) - 1, ...braces); return findTheBrace(expr, findTheBrace(expr, offset - 1, ...braces) - 1, ...braces);
return findTheBrace(expr, offset - 1, ...braces); return findTheBrace(expr, offset - 1, ...braces);
@ -230,7 +230,7 @@ export function getCommonPrefix(words) {
let word = words[0]; let word = words[0];
for (let i = 0; i < word.length; i++) { for (let i = 0; i < word.length; i++) {
for (let w = 1; w < words.length; w++) { for (let w = 1; w < words.length; w++) {
if (words[w].charAt(i) != word.charAt(i)) if (words[w].charAt(i) !== word.charAt(i))
return word.slice(0, i); return word.slice(0, i);
} }
} }
@ -243,14 +243,14 @@ export function getCommonPrefix(words) {
* @param {string} str * @param {string} str
*/ */
export function removeLiterals(str) { export function removeLiterals(str) {
if (str.length == 0) if (str.length === 0)
return ''; return '';
let currChar = str.charAt(str.length - 1); let currChar = str.charAt(str.length - 1);
if (currChar == '"' || currChar == '\'') { if (currChar === '"' || currChar === '\'') {
return removeLiterals( return removeLiterals(
str.slice(0, findMatchingQuote(str, str.length - 1))); str.slice(0, findMatchingQuote(str, str.length - 1)));
} else if (currChar == '/') { } else if (currChar === '/') {
return removeLiterals( return removeLiterals(
str.slice(0, findMatchingSlash(str, str.length - 1))); str.slice(0, findMatchingSlash(str, str.length - 1)));
} }

View File

@ -62,9 +62,9 @@ class KeyboardManager {
let [layouts, variants] = this._buildGroupStrings(group); let [layouts, variants] = this._buildGroupStrings(group);
if (this._currentKeymap && if (this._currentKeymap &&
this._currentKeymap.layouts == layouts && this._currentKeymap.layouts === layouts &&
this._currentKeymap.variants == variants && this._currentKeymap.variants === variants &&
this._currentKeymap.options == options) this._currentKeymap.options === options)
return; return;
this._currentKeymap = {layouts, variants, options}; this._currentKeymap = {layouts, variants, options};
@ -80,8 +80,8 @@ class KeyboardManager {
if (!info) if (!info)
return; return;
if (this._current && this._current.group == info.group) { if (this._current && this._current.group === info.group) {
if (this._current.groupIndex != info.groupIndex) if (this._current.groupIndex !== info.groupIndex)
this._applyLayoutGroupIndex(info.groupIndex); this._applyLayoutGroupIndex(info.groupIndex);
} else { } else {
this._applyLayoutGroup(info.group); this._applyLayoutGroup(info.group);
@ -118,7 +118,7 @@ class KeyboardManager {
// handle mnemonics like Alt+Ф even if the user is // handle mnemonics like Alt+Ф even if the user is
// actually typing in a different layout. // actually typing in a different layout.
let groupIndex = i % (this.MAX_LAYOUTS_PER_GROUP - 1); let groupIndex = i % (this.MAX_LAYOUTS_PER_GROUP - 1);
if (groupIndex == 0) if (groupIndex === 0)
group = []; group = [];
let info = this._layoutInfos[id]; let info = this._layoutInfos[id];

View File

@ -25,7 +25,7 @@ function versionCompare(required, reference) {
for (let i = 0; i < required.length; i++) { for (let i = 0; i < required.length; i++) {
let requiredInt = parseInt(required[i]); let requiredInt = parseInt(required[i]);
let referenceInt = parseInt(reference[i]); let referenceInt = parseInt(reference[i]);
if (requiredInt != referenceInt) if (requiredInt !== referenceInt)
return requiredInt < referenceInt; return requiredInt < referenceInt;
} }
@ -122,7 +122,7 @@ class LoginManagerSystemd extends Signals.EventEmitter {
'org.freedesktop.login1', 'org.freedesktop.login1',
objectPath); objectPath);
log(`Considering ${session}, class=${sessionProxy.Class}`); log(`Considering ${session}, class=${sessionProxy.Class}`);
if (sessionProxy.Class == 'greeter') { if (sessionProxy.Class === 'greeter') {
log(`Yes, will monitor session ${session}`); log(`Yes, will monitor session ${session}`);
sessionId = session; sessionId = session;
break; break;

View File

@ -40,7 +40,7 @@ function _getMobileProvidersDatabase() {
// //
function _findProviderForMccMnc(operatorName, operatorCode) { function _findProviderForMccMnc(operatorName, operatorCode) {
if (operatorName) { if (operatorName) {
if (operatorName.length != 0 && if (operatorName.length !== 0 &&
(operatorName.length > 6 || operatorName.length < 5)) { (operatorName.length > 6 || operatorName.length < 5)) {
// this looks like a valid name, i.e. not an MCCMNC (that some // this looks like a valid name, i.e. not an MCCMNC (that some
// devices return when not yet connected // devices return when not yet connected
@ -55,9 +55,9 @@ function _findProviderForMccMnc(operatorName, operatorCode) {
} }
let needle; let needle;
if ((!operatorName || operatorName.length == 0) && operatorCode) if ((!operatorName || operatorName.length === 0) && operatorCode)
needle = operatorCode; needle = operatorCode;
else if (operatorName && (operatorName.length == 6 || operatorName.length == 5)) else if (operatorName && (operatorName.length === 6 || operatorName.length === 5))
needle = operatorName; needle = operatorName;
else // nothing to search else // nothing to search
return null; return null;
@ -132,14 +132,14 @@ const ModemBase = GObject.registerClass({
} }
_setOperatorName(operatorName) { _setOperatorName(operatorName) {
if (this._operatorName == operatorName) if (this._operatorName === operatorName)
return; return;
this._operatorName = operatorName; this._operatorName = operatorName;
this.notify('operator-name'); this.notify('operator-name');
} }
_setSignalQuality(signalQuality) { _setSignalQuality(signalQuality) {
if (this._signalQuality == signalQuality) if (this._signalQuality === signalQuality)
return; return;
this._signalQuality = signalQuality; this._signalQuality = signalQuality;
this.notify('signal-quality'); this.notify('signal-quality');
@ -281,7 +281,7 @@ export const BroadbandModem = GObject.registerClass({
newName += this.operator_name_3gpp; newName += this.operator_name_3gpp;
if (this.operator_name_cdma && this.operator_name_cdma.length > 0) { if (this.operator_name_cdma && this.operator_name_cdma.length > 0) {
if (newName != '') if (newName !== '')
newName += ', '; newName += ', ';
newName += this.operator_name_cdma; newName += this.operator_name_cdma;
} }

View File

@ -49,12 +49,12 @@ class SmartcardManager extends Signals.EventEmitter {
this._addToken(tokens[i]); this._addToken(tokens[i]);
this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => { this._objectManager.connect('interface-added', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token') if (interfaceName === 'org.gnome.SettingsDaemon.Smartcard.Token')
this._addToken(proxy); this._addToken(proxy);
}); });
this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => { this._objectManager.connect('interface-removed', (objectManager, interfaceName, proxy) => {
if (interfaceName == 'org.gnome.SettingsDaemon.Smartcard.Token') if (interfaceName === 'org.gnome.SettingsDaemon.Smartcard.Token')
this._removeToken(proxy); this._removeToken(proxy);
}); });
} }
@ -94,12 +94,12 @@ class SmartcardManager extends Signals.EventEmitter {
_removeToken(token) { _removeToken(token) {
let objectPath = token.get_object_path(); let objectPath = token.get_object_path();
if (this._insertedTokens[objectPath] == token) { if (this._insertedTokens[objectPath] === token) {
delete this._insertedTokens[objectPath]; delete this._insertedTokens[objectPath];
this.emit('smartcard-removed', token); this.emit('smartcard-removed', token);
} }
if (this._loginToken == token) if (this._loginToken === token)
this._loginToken = null; this._loginToken = null;
token.disconnectAll(); token.disconnectAll();

View File

@ -230,7 +230,7 @@ function lowerBound(array, val, cmp) {
let min, max, mid, v; let min, max, mid, v;
cmp ||= (a, b) => a - b; cmp ||= (a, b) => a - b;
if (array.length == 0) if (array.length === 0)
return 0; return 0;
min = 0; min = 0;
@ -245,7 +245,7 @@ function lowerBound(array, val, cmp) {
max = mid; max = mid;
} }
return min == max || cmp(array[min], val) < 0 ? max : min; return min === max || cmp(array[min], val) < 0 ? max : min;
} }
/** /**

View File

@ -210,7 +210,7 @@ export class WeatherClient extends Signals.EventEmitter {
} }
_locationsEqual(loc1, loc2) { _locationsEqual(loc1, loc2) {
if (loc1 == loc2) if (loc1 === loc2)
return true; return true;
if (loc1 == null || loc2 == null) if (loc1 == null || loc2 == null)
@ -235,7 +235,7 @@ export class WeatherClient extends Signals.EventEmitter {
_updateLocationMonitoring() { _updateLocationMonitoring() {
if (this._useAutoLocation) { if (this._useAutoLocation) {
if (this._gclueLocationChangedId != 0 || this._gclueService == null) if (this._gclueLocationChangedId !== 0 || this._gclueService == null)
return; return;
this._gclueLocationChangedId = this._gclueLocationChangedId =
@ -280,7 +280,7 @@ export class WeatherClient extends Signals.EventEmitter {
_onAutomaticLocationChanged() { _onAutomaticLocationChanged() {
let useAutoLocation = this._settings.get_boolean('automatic-location'); let useAutoLocation = this._settings.get_boolean('automatic-location');
if (this._autoLocationRequested == useAutoLocation) if (this._autoLocationRequested === useAutoLocation)
return; return;
this._autoLocationRequested = useAutoLocation; this._autoLocationRequested = useAutoLocation;
@ -317,12 +317,12 @@ export class WeatherClient extends Signals.EventEmitter {
_onPermStoreChanged(proxy, sender, params) { _onPermStoreChanged(proxy, sender, params) {
let [table, id, deleted_, data_, perms] = params; let [table, id, deleted_, data_, perms] = params;
if (table != 'gnome' || id != 'geolocation') if (table !== 'gnome' || id !== 'geolocation')
return; return;
let permission = perms['org.gnome.Weather'] || ['NONE']; let permission = perms['org.gnome.Weather'] || ['NONE'];
let [accuracy] = permission; let [accuracy] = permission;
this._weatherAuthorized = accuracy != 'NONE'; this._weatherAuthorized = accuracy !== 'NONE';
this._updateAutoLocation(); this._updateAutoLocation();
} }

View File

@ -95,7 +95,7 @@ class AccessDialog extends ModalDialog.ModalDialog {
} }
CloseAsync(invocation, _params) { CloseAsync(invocation, _params) {
if (this._invocation.get_sender() != invocation.get_sender()) { if (this._invocation.get_sender() !== invocation.get_sender()) {
invocation.return_error_literal( invocation.return_error_literal(
Gio.DBusError, Gio.DBusError,
Gio.DBusError.ACCESS_DENIED, Gio.DBusError.ACCESS_DENIED,
@ -112,7 +112,7 @@ class AccessDialog extends ModalDialog.ModalDialog {
this._requestExported = false; this._requestExported = false;
let results = {}; let results = {};
if (response == DialogResponse.OK) { if (response === DialogResponse.OK) {
for (let [id, check] of this._choices) { for (let [id, check] of this._choices) {
let checked = check.checked ? 'true' : 'false'; let checked = check.checked ? 'true' : 'false';
results[id] = new GLib.Variant('s', checked); results[id] = new GLib.Variant('s', checked);

View File

@ -118,18 +118,18 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
} }
_initialSelection(backward, binding) { _initialSelection(backward, binding) {
if (binding == 'switch-group') { if (binding === 'switch-group') {
if (backward) if (backward)
this._select(0, this._items[0].cachedWindows.length - 1); this._select(0, this._items[0].cachedWindows.length - 1);
else if (this._items[0].cachedWindows.length > 1) else if (this._items[0].cachedWindows.length > 1)
this._select(0, 1); this._select(0, 1);
else else
this._select(0, 0); this._select(0, 0);
} else if (binding == 'switch-group-backward') { } else if (binding === 'switch-group-backward') {
this._select(0, this._items[0].cachedWindows.length - 1); this._select(0, this._items[0].cachedWindows.length - 1);
} else if (binding == 'switch-applications-backward') { } else if (binding === 'switch-applications-backward') {
this._select(this._items.length - 1); this._select(this._items.length - 1);
} else if (this._items.length == 1) { } else if (this._items.length === 1) {
this._select(0); this._select(0);
} else if (backward) { } else if (backward) {
this._select(this._items.length - 1); this._select(this._items.length - 1);
@ -140,7 +140,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
_nextWindow() { _nextWindow() {
// We actually want the second window if we're in the unset state // We actually want the second window if we're in the unset state
if (this._currentWindow == -1) if (this._currentWindow === -1)
this._currentWindow = 0; this._currentWindow = 0;
return SwitcherPopup.mod( return SwitcherPopup.mod(
this._currentWindow + 1, this._currentWindow + 1,
@ -149,7 +149,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
_previousWindow() { _previousWindow() {
// Also assume second window here // Also assume second window here
if (this._currentWindow == -1) if (this._currentWindow === -1)
this._currentWindow = 1; this._currentWindow = 1;
return SwitcherPopup.mod( return SwitcherPopup.mod(
this._currentWindow - 1, this._currentWindow - 1,
@ -178,18 +178,18 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
if (action == Meta.KeyBindingAction.SWITCH_GROUP) { if (action === Meta.KeyBindingAction.SWITCH_GROUP) {
if (!this._thumbnailsFocused) if (!this._thumbnailsFocused)
this._select(this._selectedIndex, 0); this._select(this._selectedIndex, 0);
else else
this._select(this._selectedIndex, this._nextWindow()); this._select(this._selectedIndex, this._nextWindow());
} else if (action == Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD) { } else if (action === Meta.KeyBindingAction.SWITCH_GROUP_BACKWARD) {
this._select(this._selectedIndex, this._previousWindow()); this._select(this._selectedIndex, this._previousWindow());
} else if (action == Meta.KeyBindingAction.SWITCH_APPLICATIONS) { } else if (action === Meta.KeyBindingAction.SWITCH_APPLICATIONS) {
this._select(this._next()); this._select(this._next());
} else if (action == Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD) { } else if (action === Meta.KeyBindingAction.SWITCH_APPLICATIONS_BACKWARD) {
this._select(this._previous()); this._select(this._previous());
} else if (keysym == Clutter.KEY_q || keysym === Clutter.KEY_Q) { } else if (keysym === Clutter.KEY_q || keysym === Clutter.KEY_Q) {
this._quitApplication(this._selectedIndex); this._quitApplication(this._selectedIndex);
} else if (this._thumbnailsFocused) { } else if (this._thumbnailsFocused) {
if (keysym === Clutter.KEY_Left) if (keysym === Clutter.KEY_Left)
@ -202,11 +202,11 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
this._closeAppWindow(this._selectedIndex, this._currentWindow); this._closeAppWindow(this._selectedIndex, this._currentWindow);
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} else if (keysym == Clutter.KEY_Left) { } else if (keysym === Clutter.KEY_Left) {
this._select(rtl ? this._next() : this._previous()); this._select(rtl ? this._next() : this._previous());
} else if (keysym == Clutter.KEY_Right) { } else if (keysym === Clutter.KEY_Right) {
this._select(rtl ? this._previous() : this._next()); this._select(rtl ? this._previous() : this._next());
} else if (keysym == Clutter.KEY_Down) { } else if (keysym === Clutter.KEY_Down) {
this._select(this._selectedIndex, 0); this._select(this._selectedIndex, 0);
} else { } else {
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -216,9 +216,9 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
} }
_scrollHandler(direction) { _scrollHandler(direction) {
if (direction == Clutter.ScrollDirection.UP) { if (direction === Clutter.ScrollDirection.UP) {
if (this._thumbnailsFocused) { if (this._thumbnailsFocused) {
if (this._currentWindow == 0 || this._currentWindow == -1) if (this._currentWindow === 0 || this._currentWindow === -1)
this._select(this._previous()); this._select(this._previous());
else else
this._select(this._selectedIndex, this._previousWindow()); this._select(this._selectedIndex, this._previousWindow());
@ -229,9 +229,9 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
else else
this._select(this._previous()); this._select(this._previous());
} }
} else if (direction == Clutter.ScrollDirection.DOWN) { } else if (direction === Clutter.ScrollDirection.DOWN) {
if (this._thumbnailsFocused) { if (this._thumbnailsFocused) {
if (this._currentWindow == this._items[this._selectedIndex].cachedWindows.length - 1) if (this._currentWindow === this._items[this._selectedIndex].cachedWindows.length - 1)
this._select(this._next()); this._select(this._next());
else else
this._select(this._selectedIndex, this._nextWindow()); this._select(this._selectedIndex, this._nextWindow());
@ -249,7 +249,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
// If the user clicks on the selected app, activate the // If the user clicks on the selected app, activate the
// selected window; otherwise (eg, they click on an app while // selected window; otherwise (eg, they click on an app while
// !mouseActive) activate the clicked-on app. // !mouseActive) activate the clicked-on app.
if (n == this._selectedIndex && this._currentWindow >= 0) if (n === this._selectedIndex && this._currentWindow >= 0)
this._select(n, this._currentWindow); this._select(n, this._currentWindow);
else else
this._select(n); this._select(n);
@ -290,7 +290,7 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
} }
_onDestroy() { _onDestroy() {
if (this._thumbnailTimeoutId != 0) if (this._thumbnailTimeoutId !== 0)
GLib.source_remove(this._thumbnailTimeoutId); GLib.source_remove(this._thumbnailTimeoutId);
super._onDestroy(); super._onDestroy();
@ -323,12 +323,12 @@ class AppSwitcherPopup extends SwitcherPopup.SwitcherPopup {
* app list will have the keyboard focus. * app list will have the keyboard focus.
*/ */
_select(app, window, forceAppFocus) { _select(app, window, forceAppFocus) {
if (app != this._selectedIndex || window == null) { if (app !== this._selectedIndex || window == null) {
if (this._thumbnails) if (this._thumbnails)
this._destroyThumbnails(); this._destroyThumbnails();
} }
if (this._thumbnailTimeoutId != 0) { if (this._thumbnailTimeoutId !== 0) {
GLib.source_remove(this._thumbnailTimeoutId); GLib.source_remove(this._thumbnailTimeoutId);
this._thumbnailTimeoutId = 0; this._thumbnailTimeoutId = 0;
} }
@ -429,7 +429,7 @@ class CyclerHighlight extends St.Widget {
} }
set window(w) { set window(w) {
if (this._window == w) if (this._window === w)
return; return;
this._window?.disconnectObject(this); this._window?.disconnectObject(this);
@ -519,7 +519,7 @@ const CyclerPopup = GObject.registerClass({
window.unminimize(); window.unminimize();
} }
if (activeWs == ws) { if (activeWs === ws) {
Main.activateWindow(window); Main.activateWindow(window);
} else { } else {
// If the selected window is on a different workspace, we don't // If the selected window is on a different workspace, we don't
@ -564,9 +564,9 @@ class GroupCyclerPopup extends CyclerPopup {
} }
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
if (action == Meta.KeyBindingAction.CYCLE_GROUP) if (action === Meta.KeyBindingAction.CYCLE_GROUP)
this._select(this._next()); this._select(this._next());
else if (action == Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD) else if (action === Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
this._select(this._previous()); this._select(this._previous());
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -610,13 +610,13 @@ class WindowSwitcherPopup extends SwitcherPopup.SwitcherPopup {
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) if (action === Meta.KeyBindingAction.SWITCH_WINDOWS)
this._select(this._next()); this._select(this._next());
else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) else if (action === Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Left) else if (keysym === Clutter.KEY_Left)
this._select(rtl ? this._next() : this._previous()); this._select(rtl ? this._next() : this._previous());
else if (keysym == Clutter.KEY_Right) else if (keysym === Clutter.KEY_Right)
this._select(rtl ? this._previous() : this._next()); this._select(rtl ? this._previous() : this._next());
else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_W || keysym === Clutter.KEY_F4) else if (keysym === Clutter.KEY_w || keysym === Clutter.KEY_W || keysym === Clutter.KEY_F4)
this._closeWindow(this._selectedIndex); this._closeWindow(this._selectedIndex);
@ -653,9 +653,9 @@ class WindowCyclerPopup extends CyclerPopup {
} }
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
if (action == Meta.KeyBindingAction.CYCLE_WINDOWS) if (action === Meta.KeyBindingAction.CYCLE_WINDOWS)
this._select(this._next()); this._select(this._next());
else if (action == Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD) else if (action === Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
this._select(this._previous()); this._select(this._previous());
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -730,7 +730,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
} }
_onDestroy() { _onDestroy() {
if (this._mouseTimeOutId != 0) if (this._mouseTimeOutId !== 0)
GLib.source_remove(this._mouseTimeOutId); GLib.source_remove(this._mouseTimeOutId);
this.icons.forEach( this.icons.forEach(
@ -739,7 +739,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
_setIconSize() { _setIconSize() {
let j = 0; let j = 0;
while (this._items.length > 1 && this._items[j].style_class != 'item-box') while (this._items.length > 1 && this._items[j].style_class !== 'item-box')
j++; j++;
let themeNode = this._items[j].get_theme_node(); let themeNode = this._items[j].get_theme_node();
@ -878,7 +878,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
let item = this.addItem(appIcon, appIcon.label); let item = this.addItem(appIcon, appIcon.label);
appIcon.app.connectObject('notify::state', app => { appIcon.app.connectObject('notify::state', app => {
if (app.state != Shell.AppState.RUNNING) if (app.state !== Shell.AppState.RUNNING)
this._removeIcon(app); this._removeIcon(app);
}, this); }, this);
@ -887,7 +887,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
this.add_actor(arrow); this.add_actor(arrow);
this._arrows.push(arrow); this._arrows.push(arrow);
if (appIcon.cachedWindows.length == 1) if (appIcon.cachedWindows.length === 1)
arrow.hide(); arrow.hide();
else else
item.add_accessible_state(Atk.StateType.EXPANDABLE); item.add_accessible_state(Atk.StateType.EXPANDABLE);
@ -895,7 +895,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
_removeIcon(app) { _removeIcon(app) {
let index = this.icons.findIndex(icon => { let index = this.icons.findIndex(icon => {
return icon.app == app; return icon.app === app;
}); });
if (index === -1) if (index === -1)
return; return;
@ -1130,12 +1130,12 @@ class WindowSwitcher extends SwitcherPopup.SwitcherList {
highlight(index, justOutline) { highlight(index, justOutline) {
super.highlight(index, justOutline); super.highlight(index, justOutline);
this._label.set_text(index == -1 ? '' : this.icons[index].label.text); this._label.set_text(index === -1 ? '' : this.icons[index].label.text);
} }
_removeWindow(window) { _removeWindow(window) {
let index = this.icons.findIndex(icon => { let index = this.icons.findIndex(icon => {
return icon.window == window; return icon.window === window;
}); });
if (index === -1) if (index === -1)
return; return;

View File

@ -42,8 +42,8 @@ class Animation extends St.Bin {
} }
play() { play() {
if (this._isLoaded && this._timeoutId == 0) { if (this._isLoaded && this._timeoutId === 0) {
if (this._frame == 0) if (this._frame === 0)
this._showFrame(0); this._showFrame(0);
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, this._update.bind(this)); this._timeoutId = GLib.timeout_add(GLib.PRIORITY_LOW, this._speed, this._update.bind(this));

View File

@ -138,7 +138,7 @@ function _findBestFolderName(apps) {
// If a category is present in all apps, its counter will // If a category is present in all apps, its counter will
// reach appInfos.length // reach appInfos.length
if (category.length > 0 && if (category.length > 0 &&
categoryCounter[category] == appInfos.length) categoryCounter[category] === appInfos.length)
categories.push(category); categories.push(category);
} }
return categories; return categories;
@ -1256,7 +1256,7 @@ var BaseAppView = GObject.registerClass({
duration: VIEWS_SWITCH_TIME, duration: VIEWS_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
}; };
if (animationDirection == IconGrid.AnimationDirection.IN) { if (animationDirection === IconGrid.AnimationDirection.IN) {
this.show(); this.show();
params.opacity = 255; params.opacity = 255;
params.delay = VIEWS_SWITCH_ANIMATION_DELAY; params.delay = VIEWS_SWITCH_ANIMATION_DELAY;
@ -1604,7 +1604,7 @@ class AppDisplay extends BaseAppView {
super.animateSwitch(animationDirection); super.animateSwitch(animationDirection);
if (this._currentDialog && this._displayingDialog && if (this._currentDialog && this._displayingDialog &&
animationDirection == IconGrid.AnimationDirection.OUT) { animationDirection === IconGrid.AnimationDirection.OUT) {
this._currentDialog.ease({ this._currentDialog.ease({
opacity: 0, opacity: 0,
duration: VIEWS_SWITCH_TIME, duration: VIEWS_SWITCH_TIME,
@ -2185,7 +2185,7 @@ class FolderView extends BaseAppView {
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size); let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
let numItems = this._orderedItems.length; let numItems = this._orderedItems.length;
let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL; let rtl = icon.get_text_direction() === Clutter.TextDirection.RTL;
for (let i = 0; i < 4; i++) { for (let i = 0; i < 4; i++) {
const style = `width: ${subSize}px; height: ${subSize}px;`; const style = `width: ${subSize}px; height: ${subSize}px;`;
let bin = new St.Bin({style}); let bin = new St.Bin({style});
@ -2280,7 +2280,7 @@ class FolderView extends BaseAppView {
// Remove the folder if this is the last app icon; otherwise, // Remove the folder if this is the last app icon; otherwise,
// just remove the icon // just remove the icon
if (folderApps.length == 0) { if (folderApps.length === 0) {
this._deletingFolder = true; this._deletingFolder = true;
// Resetting all keys deletes the relocatable schema // Resetting all keys deletes the relocatable schema
@ -2379,7 +2379,7 @@ export const FolderIcon = GObject.registerClass({
} }
_setHoveringByDnd(hovering) { _setHoveringByDnd(hovering) {
if (this._otherIconIsHovering == hovering) if (this._otherIconIsHovering === hovering)
return; return;
super._setHoveringByDnd(hovering); super._setHoveringByDnd(hovering);
@ -2441,7 +2441,7 @@ export const FolderIcon = GObject.registerClass({
_updateName() { _updateName() {
let name = _getFolderName(this._folder); let name = _getFolderName(this._folder);
if (this.name == name) if (this.name === name)
return; return;
this._name = name; this._name = name;
@ -2806,7 +2806,7 @@ export const AppFolderDialog = GObject.registerClass({
} }
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
if (global.stage.get_key_focus() != this) if (global.stage.get_key_focus() !== this)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
// Since we need to only grab focus on one item child when the user // Since we need to only grab focus on one item child when the user
@ -2827,7 +2827,7 @@ export const AppFolderDialog = GObject.registerClass({
// and TAB_BACKWARD for up key and left key on ltr // and TAB_BACKWARD for up key and left key on ltr
// languages // languages
let direction; let direction;
let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR; let isLtr = Clutter.get_default_text_direction() === Clutter.TextDirection.LTR;
switch (event.get_key_symbol()) { switch (event.get_key_symbol()) {
case Clutter.KEY_Down: case Clutter.KEY_Down:
direction = St.DirectionType.TAB_FORWARD; direction = St.DirectionType.TAB_FORWARD;
@ -3062,7 +3062,7 @@ export const AppIcon = GObject.registerClass({
} }
_updateRunningStyle() { _updateRunningStyle() {
if (this.app.state != Shell.AppState.STOPPED) if (this.app.state !== Shell.AppState.STOPPED)
this._dot.show(); this._dot.show();
else else
this._dot.hide(); this._dot.hide();
@ -3159,13 +3159,13 @@ export const AppIcon = GObject.registerClass({
activate(button) { activate(button) {
let event = Clutter.get_current_event(); let event = Clutter.get_current_event();
let modifiers = event ? event.get_state() : 0; let modifiers = event ? event.get_state() : 0;
let isMiddleButton = button && button == Clutter.BUTTON_MIDDLE; let isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0; let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) !== 0;
let openNewWindow = this.app.can_open_new_window() && let openNewWindow = this.app.can_open_new_window() &&
this.app.state == Shell.AppState.RUNNING && this.app.state === Shell.AppState.RUNNING &&
(isCtrlPressed || isMiddleButton); (isCtrlPressed || isMiddleButton);
if (this.app.state == Shell.AppState.STOPPED || openNewWindow) if (this.app.state === Shell.AppState.STOPPED || openNewWindow)
this.animateLaunch(); this.animateLaunch();
if (openNewWindow) if (openNewWindow)
@ -3229,13 +3229,13 @@ export const AppIcon = GObject.registerClass({
_canAccept(source) { _canAccept(source) {
let view = _getViewFromIcon(source); let view = _getViewFromIcon(source);
return source != this && return source !== this &&
(source instanceof this.constructor) && (source instanceof this.constructor) &&
(view instanceof AppDisplay); (view instanceof AppDisplay);
} }
_setHoveringByDnd(hovering) { _setHoveringByDnd(hovering) {
if (this._otherIconIsHovering == hovering) if (this._otherIconIsHovering === hovering)
return; return;
super._setHoveringByDnd(hovering); super._setHoveringByDnd(hovering);

View File

@ -149,7 +149,7 @@ class AppFavorites extends Signals.EventEmitter {
return false; return false;
let ids = this._getIds(); let ids = this._getIds();
if (pos == -1) if (pos === -1)
ids.push(appId); ids.push(appId);
else else
ids.splice(pos, 0, appId); ids.splice(pos, 0, appId);
@ -183,7 +183,7 @@ class AppFavorites extends Signals.EventEmitter {
if (!(appId in this._favorites)) if (!(appId in this._favorites))
return false; return false;
let ids = this._getIds().filter(id => id != appId); let ids = this._getIds().filter(id => id !== appId);
global.settings.set_strv(this.FAVORITE_APPS_KEY, ids); global.settings.set_strv(this.FAVORITE_APPS_KEY, ids);
return true; return true;
} }

View File

@ -206,7 +206,7 @@ export class AudioDeviceSelectionDBus {
CloseAsync(params, invocation) { CloseAsync(params, invocation) {
if (this._audioSelectionDialog && if (this._audioSelectionDialog &&
this._audioSelectionDialog._sender == invocation.get_sender()) this._audioSelectionDialog._sender === invocation.get_sender())
this._audioSelectionDialog.close(); this._audioSelectionDialog.close();
invocation.return_value(null); invocation.return_value(null);

View File

@ -132,7 +132,7 @@ const ANIMATION_MIN_WAKEUP_INTERVAL = 1.0;
let _backgroundCache = null; let _backgroundCache = null;
function _fileEqual0(file1, file2) { function _fileEqual0(file1, file2) {
if (file1 == file2) if (file1 === file2)
return true; return true;
if (!file1 || !file2) if (!file1 || !file2)
@ -160,8 +160,8 @@ class BackgroundCache extends Signals.EventEmitter {
(obj, theFile, otherFile, eventType) => { (obj, theFile, otherFile, eventType) => {
// Ignore CHANGED and CREATED events, since in both cases // Ignore CHANGED and CREATED events, since in both cases
// we'll get a CHANGES_DONE_HINT event when done. // we'll get a CHANGES_DONE_HINT event when done.
if (eventType != Gio.FileMonitorEvent.CHANGED && if (eventType !== Gio.FileMonitorEvent.CHANGED &&
eventType != Gio.FileMonitorEvent.CREATED) eventType !== Gio.FileMonitorEvent.CREATED)
this.emit('file-changed', file); this.emit('file-changed', file);
}); });
@ -220,7 +220,7 @@ class BackgroundCache extends Signals.EventEmitter {
if (settingsSchema in this._backgroundSources) { if (settingsSchema in this._backgroundSources) {
let source = this._backgroundSources[settingsSchema]; let source = this._backgroundSources[settingsSchema];
source._useCount--; source._useCount--;
if (source._useCount == 0) { if (source._useCount === 0) {
delete this._backgroundSources[settingsSchema]; delete this._backgroundSources[settingsSchema];
source.destroy(); source.destroy();
} }
@ -361,7 +361,7 @@ const Background = GObject.registerClass({
let shadingType = this._settings.get_enum(COLOR_SHADING_TYPE_KEY); let shadingType = this._settings.get_enum(COLOR_SHADING_TYPE_KEY);
if (shadingType == GDesktopEnums.BackgroundShading.SOLID) if (shadingType === GDesktopEnums.BackgroundShading.SOLID)
this.set_color(color); this.set_color(color);
else else
this.set_gradient(shadingType, color, secondColor); this.set_gradient(shadingType, color, secondColor);
@ -418,14 +418,14 @@ const Background = GObject.registerClass({
let image = cache.load(files[i]); let image = cache.load(files[i]);
if (image.is_loaded()) { if (image.is_loaded()) {
numPendingImages--; numPendingImages--;
if (numPendingImages == 0) if (numPendingImages === 0)
finish(); finish();
} else { } else {
// eslint-disable-next-line no-loop-func // eslint-disable-next-line no-loop-func
let id = image.connect('loaded', () => { let id = image.connect('loaded', () => {
image.disconnect(id); image.disconnect(id);
numPendingImages--; numPendingImages--;
if (numPendingImages == 0) if (numPendingImages === 0)
finish(); finish();
}); });
} }
@ -433,7 +433,7 @@ const Background = GObject.registerClass({
} }
_queueUpdateAnimation() { _queueUpdateAnimation() {
if (this._updateAnimationTimeoutId != 0) if (this._updateAnimationTimeoutId !== 0)
return; return;
if (!this._cancellable || this._cancellable.is_cancelled()) if (!this._cancellable || this._cancellable.is_cancelled())
@ -598,7 +598,7 @@ class BackgroundSource {
style = GDesktopEnums.BackgroundStyle.ZOOM; // Hardcode style = GDesktopEnums.BackgroundStyle.ZOOM; // Hardcode
} else { } else {
style = this._settings.get_enum(BACKGROUND_STYLE_KEY); style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
if (style != GDesktopEnums.BackgroundStyle.NONE) { if (style !== GDesktopEnums.BackgroundStyle.NONE) {
const colorScheme = this._interfaceSettings.get_enum('color-scheme'); const colorScheme = this._interfaceSettings.get_enum('color-scheme');
const uri = this._settings.get_string( const uri = this._settings.get_string(
colorScheme === GDesktopEnums.ColorScheme.PREFER_DARK colorScheme === GDesktopEnums.ColorScheme.PREFER_DARK

View File

@ -41,12 +41,12 @@ export function addBackgroundMenu(actor, layoutManager) {
let clickAction = new Clutter.ClickAction(); let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, theActor, state) => { clickAction.connect('long-press', (action, theActor, state) => {
if (state == Clutter.LongPressState.QUERY) { if (state === Clutter.LongPressState.QUERY) {
return (action.get_button() == 0 || return (action.get_button() === 0 ||
action.get_button() == 1) && action.get_button() === 1) &&
!actor._backgroundMenu.isOpen; !actor._backgroundMenu.isOpen;
} }
if (state == Clutter.LongPressState.ACTIVATE) { if (state === Clutter.LongPressState.ACTIVATE) {
let [x, y] = action.get_coords(); let [x, y] = action.get_coords();
openMenu(x, y); openMenu(x, y);
actor._backgroundManager.ignoreRelease(); actor._backgroundManager.ignoreRelease();
@ -54,7 +54,7 @@ export function addBackgroundMenu(actor, layoutManager) {
return true; return true;
}); });
clickAction.connect('clicked', action => { clickAction.connect('clicked', action => {
if (action.get_button() == 3) { if (action.get_button() === 3) {
let [x, y] = action.get_coords(); let [x, y] = action.get_coords();
openMenu(x, y); openMenu(x, y);
} }

View File

@ -54,7 +54,7 @@ export const BarLevel = GObject.registerClass({
set value(value) { set value(value) {
value = Math.max(Math.min(value, this._maxValue), 0); value = Math.max(Math.min(value, this._maxValue), 0);
if (this._value == value) if (this._value === value)
return; return;
this._value = value; this._value = value;
@ -69,7 +69,7 @@ export const BarLevel = GObject.registerClass({
set maximumValue(value) { set maximumValue(value) {
value = Math.max(value, 1); value = Math.max(value, 1);
if (this._maxValue == value) if (this._maxValue === value)
return; return;
this._maxValue = value; this._maxValue = value;
@ -83,7 +83,7 @@ export const BarLevel = GObject.registerClass({
} }
set overdriveStart(value) { set overdriveStart(value) {
if (this._overdriveStart == value) if (this._overdriveStart === value)
return; return;
if (value > this._maxValue) { if (value > this._maxValue) {

View File

@ -178,8 +178,8 @@ export const BoxPointer = GObject.registerClass({
let borderWidth = themeNode.get_length('-arrow-border-width'); let borderWidth = themeNode.get_length('-arrow-border-width');
minSize += borderWidth * 2; minSize += borderWidth * 2;
natSize += borderWidth * 2; natSize += borderWidth * 2;
if ((!isWidth && (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)) || if ((!isWidth && (this._arrowSide === St.Side.TOP || this._arrowSide === St.Side.BOTTOM)) ||
(isWidth && (this._arrowSide == St.Side.LEFT || this._arrowSide == St.Side.RIGHT))) { (isWidth && (this._arrowSide === St.Side.LEFT || this._arrowSide === St.Side.RIGHT))) {
let rise = themeNode.get_length('-arrow-rise'); let rise = themeNode.get_length('-arrow-rise');
minSize += rise; minSize += rise;
natSize += rise; natSize += rise;
@ -258,8 +258,8 @@ export const BoxPointer = GObject.registerClass({
let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size(); let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size();
let [absX, absY] = this.get_transformed_position(); let [absX, absY] = this.get_transformed_position();
if (this._arrowSide == St.Side.TOP || if (this._arrowSide === St.Side.TOP ||
this._arrowSide == St.Side.BOTTOM) this._arrowSide === St.Side.BOTTOM)
this._arrowOrigin = sourceX - absX + sourceWidth / 2; this._arrowOrigin = sourceX - absX + sourceWidth / 2;
else else
this._arrowOrigin = sourceY - absY + sourceHeight / 2; this._arrowOrigin = sourceY - absY + sourceHeight / 2;
@ -275,7 +275,7 @@ export const BoxPointer = GObject.registerClass({
let [width, height] = area.get_surface_size(); let [width, height] = area.get_surface_size();
let [boxWidth, boxHeight] = [width, height]; let [boxWidth, boxHeight] = [width, height];
if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM) if (this._arrowSide === St.Side.TOP || this._arrowSide === St.Side.BOTTOM)
boxHeight -= rise; boxHeight -= rise;
else else
boxWidth -= rise; boxWidth -= rise;
@ -284,9 +284,9 @@ export const BoxPointer = GObject.registerClass({
// Translate so that box goes from 0,0 to boxWidth,boxHeight, // Translate so that box goes from 0,0 to boxWidth,boxHeight,
// with the arrow poking out of that // with the arrow poking out of that
if (this._arrowSide == St.Side.TOP) if (this._arrowSide === St.Side.TOP)
cr.translate(0, rise); cr.translate(0, rise);
else if (this._arrowSide == St.Side.LEFT) else if (this._arrowSide === St.Side.LEFT)
cr.translate(rise, 0); cr.translate(rise, 0);
let [x1, y1] = [halfBorder, halfBorder]; let [x1, y1] = [halfBorder, halfBorder];
@ -300,37 +300,37 @@ export const BoxPointer = GObject.registerClass({
if (rise) { if (rise) {
switch (this._arrowSide) { switch (this._arrowSide) {
case St.Side.TOP: case St.Side.TOP:
if (this._arrowOrigin == x1) if (this._arrowOrigin === x1)
skipTopLeft = true; skipTopLeft = true;
else if (this._arrowOrigin == x2) else if (this._arrowOrigin === x2)
skipTopRight = true; skipTopRight = true;
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
if (this._arrowOrigin == y1) if (this._arrowOrigin === y1)
skipTopRight = true; skipTopRight = true;
else if (this._arrowOrigin == y2) else if (this._arrowOrigin === y2)
skipBottomRight = true; skipBottomRight = true;
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
if (this._arrowOrigin == x1) if (this._arrowOrigin === x1)
skipBottomLeft = true; skipBottomLeft = true;
else if (this._arrowOrigin == x2) else if (this._arrowOrigin === x2)
skipBottomRight = true; skipBottomRight = true;
break; break;
case St.Side.LEFT: case St.Side.LEFT:
if (this._arrowOrigin == y1) if (this._arrowOrigin === y1)
skipTopLeft = true; skipTopLeft = true;
else if (this._arrowOrigin == y2) else if (this._arrowOrigin === y2)
skipBottomLeft = true; skipBottomLeft = true;
break; break;
} }
} }
cr.moveTo(x1 + borderRadius, y1); cr.moveTo(x1 + borderRadius, y1);
if (this._arrowSide == St.Side.TOP && rise) { if (this._arrowSide === St.Side.TOP && rise) {
if (skipTopLeft) { if (skipTopLeft) {
cr.moveTo(x1, y2 - borderRadius); cr.moveTo(x1, y2 - borderRadius);
cr.lineTo(x1, y1 - rise); cr.lineTo(x1, y1 - rise);
@ -353,7 +353,7 @@ export const BoxPointer = GObject.registerClass({
3 * Math.PI / 2, Math.PI * 2); 3 * Math.PI / 2, Math.PI * 2);
} }
if (this._arrowSide == St.Side.RIGHT && rise) { if (this._arrowSide === St.Side.RIGHT && rise) {
if (skipTopRight) { if (skipTopRight) {
cr.lineTo(x2 + rise, y1); cr.lineTo(x2 + rise, y1);
cr.lineTo(x2 + rise, y1 + halfBase); cr.lineTo(x2 + rise, y1 + halfBase);
@ -375,7 +375,7 @@ export const BoxPointer = GObject.registerClass({
0, Math.PI / 2); 0, Math.PI / 2);
} }
if (this._arrowSide == St.Side.BOTTOM && rise) { if (this._arrowSide === St.Side.BOTTOM && rise) {
if (skipBottomLeft) { if (skipBottomLeft) {
cr.lineTo(x1 + halfBase, y2); cr.lineTo(x1 + halfBase, y2);
cr.lineTo(x1, y2 + rise); cr.lineTo(x1, y2 + rise);
@ -397,7 +397,7 @@ export const BoxPointer = GObject.registerClass({
Math.PI / 2, Math.PI); Math.PI / 2, Math.PI);
} }
if (this._arrowSide == St.Side.LEFT && rise) { if (this._arrowSide === St.Side.LEFT && rise) {
if (skipTopLeft) { if (skipTopLeft) {
cr.lineTo(x1, y1 + halfBase); cr.lineTo(x1, y1 + halfBase);
cr.lineTo(x1 - rise, y1); cr.lineTo(x1 - rise, y1);
@ -437,7 +437,7 @@ export const BoxPointer = GObject.registerClass({
} }
setPosition(sourceActor, alignment) { setPosition(sourceActor, alignment) {
if (!this._sourceActor || sourceActor != this._sourceActor) { if (!this._sourceActor || sourceActor !== this._sourceActor) {
this._sourceActor?.disconnectObject(this); this._sourceActor?.disconnectObject(this);
this._sourceActor = sourceActor; this._sourceActor = sourceActor;
@ -587,7 +587,7 @@ export const BoxPointer = GObject.registerClass({
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from // the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
// the left for St.Side.TOP and St.Side.BOTTOM. // the left for St.Side.TOP and St.Side.BOTTOM.
setArrowOrigin(origin) { setArrowOrigin(origin) {
if (this._arrowOrigin != origin) { if (this._arrowOrigin !== origin) {
this._arrowOrigin = origin; this._arrowOrigin = origin;
this._border.queue_repaint(); this._border.queue_repaint();
} }
@ -597,7 +597,7 @@ export const BoxPointer = GObject.registerClass({
// Differently from setPosition, this will not move the boxpointer itself, // Differently from setPosition, this will not move the boxpointer itself,
// on the arrow // on the arrow
setArrowActor(actor) { setArrowActor(actor) {
if (this._arrowActor != actor) { if (this._arrowActor !== actor) {
this._arrowActor = actor; this._arrowActor = actor;
this._border.queue_repaint(); this._border.queue_repaint();
} }
@ -637,7 +637,7 @@ export const BoxPointer = GObject.registerClass({
_updateFlip(allocationBox) { _updateFlip(allocationBox) {
let arrowSide = this._calculateArrowSide(this._userArrowSide); let arrowSide = this._calculateArrowSide(this._userArrowSide);
if (this._arrowSide != arrowSide) { if (this._arrowSide !== arrowSide) {
this._arrowSide = arrowSide; this._arrowSide = arrowSide;
this._reposition(allocationBox); this._reposition(allocationBox);

View File

@ -24,15 +24,15 @@ const MESSAGE_ICON_SIZE = -1; // pick up from CSS
const NC_ = (context, str) => `${context}\u0004${str}`; const NC_ = (context, str) => `${context}\u0004${str}`;
function sameYear(dateA, dateB) { function sameYear(dateA, dateB) {
return dateA.getYear() == dateB.getYear(); return dateA.getYear() === dateB.getYear();
} }
function sameMonth(dateA, dateB) { function sameMonth(dateA, dateB) {
return sameYear(dateA, dateB) && (dateA.getMonth() == dateB.getMonth()); return sameYear(dateA, dateB) && (dateA.getMonth() === dateB.getMonth());
} }
function sameDay(dateA, dateB) { function sameDay(dateA, dateB) {
return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate()); return sameMonth(dateA, dateB) && (dateA.getDate() === dateB.getDate());
} }
function _isWorkDay(date) { function _isWorkDay(date) {
@ -540,7 +540,7 @@ export const Calendar = GObject.registerClass({
}); });
label.accessible_name = formatDateWithCFormatString(iter, '%A'); label.accessible_name = formatDateWithCFormatString(iter, '%A');
let col; let col;
if (this.get_text_direction() == Clutter.TextDirection.RTL) if (this.get_text_direction() === Clutter.TextDirection.RTL)
col = 6 - (7 + iter.getDay() - this._weekStart) % 7; col = 6 - (7 + iter.getDay() - this._weekStart) % 7;
else else
col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7; col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
@ -569,16 +569,16 @@ export const Calendar = GObject.registerClass({
_onPrevMonthButtonClicked() { _onPrevMonthButtonClicked() {
let newDate = new Date(this._selectedDate); let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth(); let oldMonth = newDate.getMonth();
if (oldMonth == 0) { if (oldMonth === 0) {
newDate.setMonth(11); newDate.setMonth(11);
newDate.setFullYear(newDate.getFullYear() - 1); newDate.setFullYear(newDate.getFullYear() - 1);
if (newDate.getMonth() != 11) { if (newDate.getMonth() !== 11) {
let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate(); let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate();
newDate = new Date(newDate.getFullYear() - 1, 11, day); newDate = new Date(newDate.getFullYear() - 1, 11, day);
} }
} else { } else {
newDate.setMonth(oldMonth - 1); newDate.setMonth(oldMonth - 1);
if (newDate.getMonth() != oldMonth - 1) { if (newDate.getMonth() !== oldMonth - 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth - 1, 32).getDate(); let day = 32 - new Date(newDate.getFullYear(), oldMonth - 1, 32).getDate();
newDate = new Date(newDate.getFullYear(), oldMonth - 1, day); newDate = new Date(newDate.getFullYear(), oldMonth - 1, day);
} }
@ -592,16 +592,16 @@ export const Calendar = GObject.registerClass({
_onNextMonthButtonClicked() { _onNextMonthButtonClicked() {
let newDate = new Date(this._selectedDate); let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth(); let oldMonth = newDate.getMonth();
if (oldMonth == 11) { if (oldMonth === 11) {
newDate.setMonth(0); newDate.setMonth(0);
newDate.setFullYear(newDate.getFullYear() + 1); newDate.setFullYear(newDate.getFullYear() + 1);
if (newDate.getMonth() != 0) { if (newDate.getMonth() !== 0) {
let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate(); let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate();
newDate = new Date(newDate.getFullYear() + 1, 0, day); newDate = new Date(newDate.getFullYear() + 1, 0, day);
} }
} else { } else {
newDate.setMonth(oldMonth + 1); newDate.setMonth(oldMonth + 1);
if (newDate.getMonth() != oldMonth + 1) { if (newDate.getMonth() !== oldMonth + 1) {
let day = 32 - new Date(newDate.getFullYear(), oldMonth + 1, 32).getDate(); let day = 32 - new Date(newDate.getFullYear(), oldMonth + 1, 32).getDate();
newDate = new Date(newDate.getFullYear(), oldMonth + 1, day); newDate = new Date(newDate.getFullYear(), oldMonth + 1, day);
} }
@ -653,7 +653,7 @@ export const Calendar = GObject.registerClass({
this._markedAsToday = now; this._markedAsToday = now;
let daysToWeekStart = (7 + beginDate.getDay() - this._weekStart) % 7; let daysToWeekStart = (7 + beginDate.getDay() - this._weekStart) % 7;
let startsOnWeekStart = daysToWeekStart == 0; let startsOnWeekStart = daysToWeekStart === 0;
let weekPadding = startsOnWeekStart ? 7 : 0; let weekPadding = startsOnWeekStart ? 7 : 0;
beginDate.setDate(beginDate.getDate() - (weekPadding + daysToWeekStart)); beginDate.setDate(beginDate.getDate() - (weekPadding + daysToWeekStart));
@ -669,7 +669,7 @@ export const Calendar = GObject.registerClass({
label: formatDateWithCFormatString(iter, C_('date day number format', '%d')), label: formatDateWithCFormatString(iter, C_('date day number format', '%d')),
can_focus: true, can_focus: true,
}); });
let rtl = button.get_text_direction() == Clutter.TextDirection.RTL; let rtl = button.get_text_direction() === Clutter.TextDirection.RTL;
if (this._eventSource instanceof EmptyEventSource) if (this._eventSource instanceof EmptyEventSource)
button.reactive = false; button.reactive = false;
@ -690,18 +690,18 @@ export const Calendar = GObject.registerClass({
styleClass += ' calendar-weekend'; styleClass += ' calendar-weekend';
// Hack used in lieu of border-collapse - see gnome-shell.css // Hack used in lieu of border-collapse - see gnome-shell.css
if (row == 2) if (row === 2)
styleClass = `calendar-day-top ${styleClass}`; styleClass = `calendar-day-top ${styleClass}`;
let leftMost = rtl let leftMost = rtl
? iter.getDay() == (this._weekStart + 6) % 7 ? iter.getDay() === (this._weekStart + 6) % 7
: iter.getDay() == this._weekStart; : iter.getDay() === this._weekStart;
if (leftMost) if (leftMost)
styleClass = `calendar-day-left ${styleClass}`; styleClass = `calendar-day-left ${styleClass}`;
if (sameDay(now, iter)) if (sameDay(now, iter))
styleClass += ' calendar-today'; styleClass += ' calendar-today';
else if (iter.getMonth() != this._selectedDate.getMonth()) else if (iter.getMonth() !== this._selectedDate.getMonth())
styleClass += ' calendar-other-month'; styleClass += ' calendar-other-month';
if (hasEvents) if (hasEvents)
@ -719,7 +719,7 @@ export const Calendar = GObject.registerClass({
this._buttons.push(button); this._buttons.push(button);
if (this._useWeekdate && iter.getDay() == 4) { if (this._useWeekdate && iter.getDay() === 4) {
const label = new St.Label({ const label = new St.Label({
text: formatDateWithCFormatString(iter, '%V'), text: formatDateWithCFormatString(iter, '%V'),
style_class: 'calendar-week-number', style_class: 'calendar-week-number',
@ -733,7 +733,7 @@ export const Calendar = GObject.registerClass({
iter.setDate(iter.getDate() + 1); iter.setDate(iter.getDate() + 1);
if (iter.getDay() == this._weekStart) if (iter.getDay() === this._weekStart)
row++; row++;
} }
@ -860,7 +860,7 @@ class NotificationSection extends MessageList.MessageListSection {
let message = new NotificationMessage(notification); let message = new NotificationMessage(notification);
message.setSecondaryActor(new TimeLabel(notification.datetime)); message.setSecondaryActor(new TimeLabel(notification.datetime));
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL; let isUrgent = notification.urgency === MessageTray.Urgency.CRITICAL;
notification.connectObject( notification.connectObject(
'destroy', () => { 'destroy', () => {
@ -888,7 +888,7 @@ class NotificationSection extends MessageList.MessageListSection {
vfunc_map() { vfunc_map() {
this._messages.forEach(message => { this._messages.forEach(message => {
if (message.notification.urgency != MessageTray.Urgency.CRITICAL) if (message.notification.urgency !== MessageTray.Urgency.CRITICAL)
message.notification.acknowledged = true; message.notification.acknowledged = true;
}); });
super.vfunc_map(); super.vfunc_map();

View File

@ -122,7 +122,7 @@ export const CloseDialog = GObject.registerClass({
let shouldTrack; let shouldTrack;
if (focusWindow != null) if (focusWindow != null)
shouldTrack = focusWindow == this._window; shouldTrack = focusWindow === this._window;
else else
shouldTrack = keyFocus && this._dialog.contains(keyFocus); shouldTrack = keyFocus && this._dialog.contains(keyFocus);

View File

@ -57,7 +57,7 @@ function isMountNonLocal(mount) {
if (volume == null) if (volume == null)
return true; return true;
return volume.get_identifier('class') == 'network'; return volume.get_identifier('class') === 'network';
} }
function startAppForMount(app, mount) { function startAppForMount(app, mount) {
@ -186,12 +186,12 @@ class AutorunDispatcher {
} }
_getSourceForMount(mount) { _getSourceForMount(mount) {
let filtered = this._sources.filter(source => source.mount == mount); let filtered = this._sources.filter(source => source.mount === mount);
// we always make sure not to add two sources for the same // we always make sure not to add two sources for the same
// mount in addMount(), so it's safe to assume filtered.length // mount in addMount(), so it's safe to assume filtered.length
// is always either 1 or 0. // is always either 1 or 0.
if (filtered.length == 1) if (filtered.length === 1)
return filtered[0]; return filtered[0];
return null; return null;
@ -224,15 +224,15 @@ class AutorunDispatcher {
// check at the settings for the first content type // check at the settings for the first content type
// to see whether we should ask // to see whether we should ask
if (setting == AutorunSetting.IGNORE) if (setting === AutorunSetting.IGNORE)
return; // return right away return; // return right away
let success = false; let success = false;
let app = null; let app = null;
if (setting == AutorunSetting.RUN) if (setting === AutorunSetting.RUN)
app = Gio.app_info_get_default_for_type(contentTypes[0], false); app = Gio.app_info_get_default_for_type(contentTypes[0], false);
else if (setting == AutorunSetting.FILES) else if (setting === AutorunSetting.FILES)
app = Gio.app_info_get_default_for_type('inode/directory', false); app = Gio.app_info_get_default_for_type('inode/directory', false);
if (app) if (app)

View File

@ -158,7 +158,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
_validateWpaPsk(secret) { _validateWpaPsk(secret) {
let value = secret.value; let value = secret.value;
if (value.length == 64) { if (value.length === 64) {
// must be composed of hexadecimal digits only // must be composed of hexadecimal digits only
for (let i = 0; i < 64; i++) { for (let i = 0; i < 64; i++) {
if (!((value[i] >= 'a' && value[i] <= 'f') || if (!((value[i] >= 'a' && value[i] <= 'f') ||
@ -174,15 +174,15 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
_validateStaticWep(secret) { _validateStaticWep(secret) {
let value = secret.value; let value = secret.value;
if (secret.wep_key_type == NM.WepKeyType.KEY) { if (secret.wep_key_type === NM.WepKeyType.KEY) {
if (value.length == 10 || value.length == 26) { if (value.length === 10 || value.length === 26) {
for (let i = 0; i < value.length; i++) { for (let i = 0; i < value.length; i++) {
if (!((value[i] >= 'a' && value[i] <= 'f') || if (!((value[i] >= 'a' && value[i] <= 'f') ||
(value[i] >= 'A' && value[i] <= 'F') || (value[i] >= 'A' && value[i] <= 'F') ||
(value[i] >= '0' && value[i] <= '9'))) (value[i] >= '0' && value[i] <= '9')))
return false; return false;
} }
} else if (value.length == 5 || value.length == 13) { } else if (value.length === 5 || value.length === 13) {
for (let i = 0; i < value.length; i++) { for (let i = 0; i < value.length; i++) {
if (!((value[i] >= 'a' && value[i] <= 'z') || if (!((value[i] >= 'a' && value[i] <= 'z') ||
(value[i] >= 'A' && value[i] <= 'Z'))) (value[i] >= 'A' && value[i] <= 'Z')))
@ -191,7 +191,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
} else { } else {
return false; return false;
} }
} else if (secret.wep_key_type == NM.WepKeyType.PASSPHRASE) { } else if (secret.wep_key_type === NM.WepKeyType.PASSPHRASE) {
if (value.length < 0 || value.length > 64) if (value.length < 0 || value.length > 64)
return false; return false;
} }
@ -201,7 +201,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
_getWirelessSecrets(secrets, _wirelessSetting) { _getWirelessSecrets(secrets, _wirelessSetting) {
let wirelessSecuritySetting = this._connection.get_setting_wireless_security(); let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
if (this._settingName == '802-1x') { if (this._settingName === '802-1x') {
this._get8021xSecrets(secrets); this._get8021xSecrets(secrets);
return; return;
} }
@ -230,7 +230,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
}); });
break; break;
case 'ieee8021x': case 'ieee8021x':
if (wirelessSecuritySetting.auth_alg == 'leap') { // Cisco LEAP if (wirelessSecuritySetting.auth_alg === 'leap') { // Cisco LEAP
secrets.push({ secrets.push({
label: _('Password'), label: _('Password'),
key: 'leap-password', key: 'leap-password',
@ -253,7 +253,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
let ieee8021xSetting = this._connection.get_setting_802_1x(); let ieee8021xSetting = this._connection.get_setting_802_1x();
/* If hints were given we know exactly what we need to ask */ /* If hints were given we know exactly what we need to ask */
if (this._settingName == '802-1x' && this._hints.length) { if (this._settingName === '802-1x' && this._hints.length) {
if (this._hints.includes('identity')) { if (this._hints.includes('identity')) {
secrets.push({ secrets.push({
label: _('Username'), label: _('Username'),
@ -344,7 +344,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
_getMobileSecrets(secrets, connectionType) { _getMobileSecrets(secrets, connectionType) {
let setting; let setting;
if (connectionType == 'bluetooth') if (connectionType === 'bluetooth')
setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm(); setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm();
else else
setting = this._connection.get_setting_by_name(connectionType); setting = this._connection.get_setting_by_name(connectionType);
@ -531,7 +531,7 @@ class VPNRequestHandler extends Signals.EventEmitter {
let [exited, exitStatus] = Shell.util_wifexited(status); let [exited, exitStatus] = Shell.util_wifexited(status);
if (exited) { if (exited) {
if (exitStatus != 0) if (exitStatus !== 0)
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
else else
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.CONFIRMED);
@ -543,11 +543,11 @@ class VPNRequestHandler extends Signals.EventEmitter {
} }
_vpnChildProcessLineOldStyle(line) { _vpnChildProcessLineOldStyle(line) {
if (this._previousLine != undefined) { if (this._previousLine !== undefined) {
// Two consecutive newlines mean that the child should be closed // Two consecutive newlines mean that the child should be closed
// (the actual newlines are eaten by Gio.DataInputStream) // (the actual newlines are eaten by Gio.DataInputStream)
// Send a termination message // Send a termination message
if (line == '' && this._previousLine == '') { if (line === '' && this._previousLine === '') {
try { try {
this._stdin.write('QUIT\n\n', null); this._stdin.write('QUIT\n\n', null);
} catch (e) { /* ignore broken pipe errors */ } } catch (e) { /* ignore broken pipe errors */ }
@ -603,7 +603,7 @@ class VPNRequestHandler extends Signals.EventEmitter {
data = new GLib.Bytes(this._dataStdout.peek_buffer()); data = new GLib.Bytes(this._dataStdout.peek_buffer());
keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE); keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE);
if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2) if (keyfile.get_integer(VPN_UI_GROUP, 'Version') !== 2)
throw new Error('Invalid plugin keyfile version, is %d'); throw new Error('Invalid plugin keyfile version, is %d');
contentOverride = { contentOverride = {
@ -614,7 +614,7 @@ class VPNRequestHandler extends Signals.EventEmitter {
let [groups, len_] = keyfile.get_groups(); let [groups, len_] = keyfile.get_groups();
for (let i = 0; i < groups.length; i++) { for (let i = 0; i < groups.length; i++) {
if (groups[i] == VPN_UI_GROUP) if (groups[i] === VPN_UI_GROUP)
continue; continue;
let value = keyfile.get_string(groups[i], 'Value'); let value = keyfile.get_string(groups[i], 'Value');
@ -810,7 +810,7 @@ class NetworkAgent {
} }
_handleRequest(requestId, connection, settingName, hints, flags) { _handleRequest(requestId, connection, settingName, hints, flags) {
if (settingName == 'vpn') { if (settingName === 'vpn') {
this._vpnRequest(requestId, connection, hints, flags); this._vpnRequest(requestId, connection, hints, flags);
return; return;
} }

View File

@ -335,7 +335,7 @@ const AuthenticationDialog = GObject.registerClass({
let resetDialog = () => { let resetDialog = () => {
this._sessionRequestTimeoutId = 0; this._sessionRequestTimeoutId = 0;
if (this.state != ModalDialog.State.OPENED) if (this.state !== ModalDialog.State.OPENED)
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
this._passwordEntry.hide(); this._passwordEntry.hide();

View File

@ -193,7 +193,7 @@ class TelepathyClient extends Tp.BaseClient {
/* Only observe contact text channels */ /* Only observe contact text channels */
if (!(channel instanceof Tp.TextChannel) || if (!(channel instanceof Tp.TextChannel) ||
targetHandleType != Tp.HandleType.CONTACT) targetHandleType !== Tp.HandleType.CONTACT)
continue; continue;
this._createChatSource(account, conn, channel, channel.get_target_contact()); this._createChatSource(account, conn, channel, channel.get_target_contact());
@ -267,7 +267,7 @@ class TelepathyClient extends Tp.BaseClient {
return; return;
} }
if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) { if (chanType === Tp.IFACE_CHANNEL_TYPE_TEXT) {
this._approveTextChannel(account, conn, channel, dispatchOp, context); this._approveTextChannel(account, conn, channel, dispatchOp, context);
} else { } else {
context.fail(new Tp.Error({ context.fail(new Tp.Error({
@ -280,7 +280,7 @@ class TelepathyClient extends Tp.BaseClient {
async _approveTextChannel(account, conn, channel, dispatchOp, context) { async _approveTextChannel(account, conn, channel, dispatchOp, context) {
let [targetHandle_, targetHandleType] = channel.get_handle(); let [targetHandle_, targetHandleType] = channel.get_handle();
if (targetHandleType != Tp.HandleType.CONTACT) { if (targetHandleType !== Tp.HandleType.CONTACT) {
context.fail(new Tp.Error({ context.fail(new Tp.Error({
code: Tp.Error.INVALID_ARGUMENT, code: Tp.Error.INVALID_ARGUMENT,
message: 'Unsupported handle type', message: 'Unsupported handle type',
@ -357,7 +357,7 @@ class ChatSource extends MessageTray.Source {
} }
_createPolicy() { _createPolicy() {
if (this._account.protocol_name == 'irc') if (this._account.protocol_name === 'irc')
return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari'); return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari');
return new MessageTray.NotificationApplicationPolicy('empathy'); return new MessageTray.NotificationApplicationPolicy('empathy');
} }
@ -377,7 +377,7 @@ class ChatSource extends MessageTray.Source {
let oldAlias = this.title; let oldAlias = this.title;
let newAlias = this._contact.get_alias(); let newAlias = this._contact.get_alias();
if (oldAlias == newAlias) if (oldAlias === newAlias)
return; return;
this.setTitle(newAlias); this.setTitle(newAlias);
@ -443,7 +443,7 @@ class ChatSource extends MessageTray.Source {
// fallback to something else if activation fails // fallback to something else if activation fails
let target; let target;
if (this._channel.connection.protocol_name == 'irc') if (this._channel.connection.protocol_name === 'irc')
target = 'org.freedesktop.Telepathy.Client.Polari'; target = 'org.freedesktop.Telepathy.Client.Polari';
else else
target = 'org.freedesktop.Telepathy.Client.Empathy.Chat'; target = 'org.freedesktop.Telepathy.Client.Empathy.Chat';
@ -475,7 +475,7 @@ class ChatSource extends MessageTray.Source {
for (let i = 0; i < pendingTpMessages.length; i++) { for (let i = 0; i < pendingTpMessages.length; i++) {
let message = pendingTpMessages[i]; let message = pendingTpMessages[i];
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT) if (message.get_message_type() === Tp.ChannelTextMessageType.DELIVERY_REPORT)
continue; continue;
pendingMessages.push(ChatMessage.newFromTpMessage(message, pendingMessages.push(ChatMessage.newFromTpMessage(message,
@ -495,7 +495,7 @@ class ChatSource extends MessageTray.Source {
// Skip any log messages that are also in pendingMessages // Skip any log messages that are also in pendingMessages
for (let j = 0; j < pendingMessages.length; j++) { for (let j = 0; j < pendingMessages.length; j++) {
let pending = pendingMessages[j]; let pending = pendingMessages[j];
if (logMessage.timestamp == pending.timestamp && logMessage.text == pending.text) { if (logMessage.timestamp === pending.timestamp && logMessage.text === pending.text) {
isPending = true; isPending = true;
break; break;
} }
@ -531,7 +531,7 @@ class ChatSource extends MessageTray.Source {
} }
// Keep source alive while the channel is open // Keep source alive while the channel is open
if (reason != MessageTray.NotificationDestroyedReason.SOURCE_CLOSED) if (reason !== MessageTray.NotificationDestroyedReason.SOURCE_CLOSED)
return; return;
if (this._destroyed) if (this._destroyed)
@ -562,7 +562,7 @@ class ChatSource extends MessageTray.Source {
} }
_messageReceived(channel, message) { _messageReceived(channel, message) {
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT) if (message.get_message_type() === Tp.ChannelTextMessageType.DELIVERY_REPORT)
return; return;
this._ensureNotification(); this._ensureNotification();
@ -575,7 +575,7 @@ class ChatSource extends MessageTray.Source {
// Wait a bit before notifying for the received message, a handler // Wait a bit before notifying for the received message, a handler
// could ack it in the meantime. // could ack it in the meantime.
if (this._notifyTimeoutId != 0) if (this._notifyTimeoutId !== 0)
GLib.source_remove(this._notifyTimeoutId); GLib.source_remove(this._notifyTimeoutId);
this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, this._notifyTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500,
this._notifyTimeout.bind(this)); this._notifyTimeout.bind(this));
@ -583,7 +583,7 @@ class ChatSource extends MessageTray.Source {
} }
_notifyTimeout() { _notifyTimeout() {
if (this._pendingMessages.length != 0) if (this._pendingMessages.length !== 0)
this.showNotification(); this.showNotification();
this._notifyTimeoutId = 0; this._notifyTimeoutId = 0;
@ -606,7 +606,7 @@ class ChatSource extends MessageTray.Source {
respond(text) { respond(text) {
let type; let type;
if (text.slice(0, 4) == '/me ') { if (text.slice(0, 4) === '/me ') {
type = Tp.ChannelTextMessageType.ACTION; type = Tp.ChannelTextMessageType.ACTION;
text = text.slice(4); text = text.slice(4);
} else { } else {
@ -624,7 +624,7 @@ class ChatSource extends MessageTray.Source {
// gnome-shell's entry and the Empathy conversation window. We could // gnome-shell's entry and the Empathy conversation window. We could
// keep track of it with the ChatStateChanged signal but it is good // keep track of it with the ChatStateChanged signal but it is good
// enough right now. // enough right now.
if (state != this._chatState) { if (state !== this._chatState) {
this._chatState = state; this._chatState = state;
this._channel.set_chat_state_async(state, null); this._channel.set_chat_state_async(state, null);
} }
@ -647,7 +647,7 @@ class ChatSource extends MessageTray.Source {
this.countUpdated(); this.countUpdated();
} }
if (this._pendingMessages.length == 0 && if (this._pendingMessages.length === 0 &&
this._banner && !this._banner.expanded) this._banner && !this._banner.expanded)
this._banner.hide(); this._banner.hide();
} }
@ -708,20 +708,20 @@ const ChatNotification = HAVE_TP ? GObject.registerClass({
let messageBody = GLib.markup_escape_text(message.text, -1); let messageBody = GLib.markup_escape_text(message.text, -1);
let styles = [message.direction]; let styles = [message.direction];
if (message.messageType == Tp.ChannelTextMessageType.ACTION) { if (message.messageType === Tp.ChannelTextMessageType.ACTION) {
let senderAlias = GLib.markup_escape_text(message.sender, -1); let senderAlias = GLib.markup_escape_text(message.sender, -1);
messageBody = `<i>${senderAlias}</i> ${messageBody}`; messageBody = `<i>${senderAlias}</i> ${messageBody}`;
styles.push('chat-action'); styles.push('chat-action');
} }
if (message.direction == NotificationDirection.RECEIVED) { if (message.direction === NotificationDirection.RECEIVED) {
this.update(this.source.title, messageBody, { this.update(this.source.title, messageBody, {
datetime: GLib.DateTime.new_from_unix_local(message.timestamp), datetime: GLib.DateTime.new_from_unix_local(message.timestamp),
bannerMarkup: true, bannerMarkup: true,
}); });
} }
let group = message.direction == NotificationDirection.RECEIVED let group = message.direction === NotificationDirection.RECEIVED
? 'received' : 'sent'; ? 'received' : 'sent';
this._append({ this._append({
@ -894,7 +894,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
// bottom // bottom
this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value; this._oldMaxScrollValue = this._scrollArea.vscroll.adjustment.value;
this._scrollArea.vscroll.adjustment.connect('changed', adjustment => { this._scrollArea.vscroll.adjustment.connect('changed', adjustment => {
if (adjustment.value == this._oldMaxScrollValue) if (adjustment.value === this._oldMaxScrollValue)
this.scrollTo(St.Side.BOTTOM); this.scrollTo(St.Side.BOTTOM);
this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size); this._oldMaxScrollValue = Math.max(adjustment.lower, adjustment.upper - adjustment.page_size);
}); });
@ -920,9 +920,9 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
scrollTo(side) { scrollTo(side) {
let adjustment = this._scrollArea.vscroll.adjustment; let adjustment = this._scrollArea.vscroll.adjustment;
if (side == St.Side.TOP) if (side === St.Side.TOP)
adjustment.value = adjustment.lower; adjustment.value = adjustment.lower;
else if (side == St.Side.BOTTOM) else if (side === St.Side.BOTTOM)
adjustment.value = adjustment.upper; adjustment.value = adjustment.upper;
} }
@ -938,7 +938,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
body.add_style_class_name(styles[i]); body.add_style_class_name(styles[i]);
let group = message.group; let group = message.group;
if (group != this._lastGroup) { if (group !== this._lastGroup) {
this._lastGroup = group; this._lastGroup = group;
body.add_style_class_name('chat-new-group'); body.add_style_class_name('chat-new-group');
} }
@ -974,7 +974,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
_onEntryActivated() { _onEntryActivated() {
let text = this._responseEntry.get_text(); let text = this._responseEntry.get_text();
if (text == '') if (text === '')
return; return;
this._inputHistory.addItem(text); this._inputHistory.addItem(text);
@ -1007,7 +1007,7 @@ class ChatNotificationBanner extends MessageTray.NotificationBanner {
this._composingTimeoutId = 0; this._composingTimeoutId = 0;
} }
if (text != '') { if (text !== '') {
this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING); this.notification.source.setChatState(Tp.ChannelChatState.COMPOSING);
this._composingTimeoutId = GLib.timeout_add_seconds( this._composingTimeoutId = GLib.timeout_add_seconds(

View File

@ -50,7 +50,7 @@ export class CtrlAltTabManager {
if (root instanceof St.Widget) if (root instanceof St.Widget)
global.focus_manager.remove_group(root); global.focus_manager.remove_group(root);
for (let i = 0; i < this._items.length; i++) { for (let i = 0; i < this._items.length; i++) {
if (this._items[i].root == root) { if (this._items[i].root === root) {
this._items.splice(i, 1); this._items.splice(i, 1);
return; return;
} }
@ -69,7 +69,7 @@ export class CtrlAltTabManager {
// they will have the same left-to-right ordering in the // they will have the same left-to-right ordering in the
// Ctrl-Alt-Tab dialog as they do onscreen. // Ctrl-Alt-Tab dialog as they do onscreen.
_sortItems(a, b) { _sortItems(a, b) {
if (a.sortGroup != b.sortGroup) if (a.sortGroup !== b.sortGroup)
return a.sortGroup - b.sortGroup; return a.sortGroup - b.sortGroup;
let [ax] = a.proxy.get_transformed_position(); let [ax] = a.proxy.get_transformed_position();
@ -94,7 +94,7 @@ export class CtrlAltTabManager {
for (let i = 0; i < windows.length; i++) { for (let i = 0; i < windows.length; i++) {
let icon = null; let icon = null;
let iconName = null; let iconName = null;
if (windows[i].get_window_type() == Meta.WindowType.DESKTOP) { if (windows[i].get_window_type() === Meta.WindowType.DESKTOP) {
iconName = 'video-display-symbolic'; iconName = 'video-display-symbolic';
} else { } else {
let app = windowTracker.get_window_app(windows[i]); let app = windowTracker.get_window_app(windows[i]);
@ -150,13 +150,13 @@ class CtrlAltTabPopup extends SwitcherPopup.SwitcherPopup {
} }
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
if (action == Meta.KeyBindingAction.SWITCH_PANELS) if (action === Meta.KeyBindingAction.SWITCH_PANELS)
this._select(this._next()); this._select(this._next());
else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD) else if (action === Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Left) else if (keysym === Clutter.KEY_Left)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Right) else if (keysym === Clutter.KEY_Right)
this._select(this._next()); this._select(this._next());
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;

View File

@ -157,7 +157,7 @@ class DashItemContainer extends St.Widget {
} }
setChild(actor) { setChild(actor) {
if (this.child == actor) if (this.child === actor)
return; return;
this.destroy_all_children(); this.destroy_all_children();
@ -417,7 +417,7 @@ export const Dash = GObject.registerClass({
}; };
DND.addDragMonitor(this._dragMonitor); DND.addDragMonitor(this._dragMonitor);
if (this._box.get_n_children() == 0) { if (this._box.get_n_children() === 0) {
this._emptyDropTarget = new EmptyDropTargetItem(); this._emptyDropTarget = new EmptyDropTargetItem();
this._box.insert_child_at_index(this._emptyDropTarget, 0); this._box.insert_child_at_index(this._emptyDropTarget, 0);
this._emptyDropTarget.show(true); this._emptyDropTarget.show(true);
@ -549,7 +549,7 @@ export const Dash = GObject.registerClass({
let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover(); let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover();
if (shouldShow) { if (shouldShow) {
if (this._showLabelTimeoutId == 0) { if (this._showLabelTimeoutId === 0) {
let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT;
this._showLabelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout, this._showLabelTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, timeout,
() => { () => {
@ -638,7 +638,7 @@ export const Dash = GObject.registerClass({
newIconSize = baseIconSizes[i]; newIconSize = baseIconSizes[i];
} }
if (newIconSize == this.iconSize) if (newIconSize === this.iconSize)
return; return;
let oldIconSize = this.iconSize; let oldIconSize = this.iconSize;
@ -736,7 +736,7 @@ export const Dash = GObject.registerClass({
let newApp = newApps.length > newIndex ? newApps[newIndex] : null; let newApp = newApps.length > newIndex ? newApps[newIndex] : null;
// No change at oldIndex/newIndex // No change at oldIndex/newIndex
if (oldApp == newApp) { if (oldApp === newApp) {
oldIndex++; oldIndex++;
newIndex++; newIndex++;
continue; continue;
@ -763,10 +763,10 @@ export const Dash = GObject.registerClass({
// App moved // App moved
let nextApp = newApps.length > newIndex + 1 let nextApp = newApps.length > newIndex + 1
? newApps[newIndex + 1] : null; ? newApps[newIndex + 1] : null;
let insertHere = nextApp && nextApp == oldApp; let insertHere = nextApp && nextApp === oldApp;
let alreadyRemoved = removedActors.reduce((result, actor) => { let alreadyRemoved = removedActors.reduce((result, actor) => {
let removedApp = actor.child._delegate.app; let removedApp = actor.child._delegate.app;
return result || removedApp == newApp; return result || removedApp === newApp;
}, false); }, false);
if (insertHere || alreadyRemoved) { if (insertHere || alreadyRemoved) {
@ -909,7 +909,7 @@ export const Dash = GObject.registerClass({
this._dragPlaceholderPos = pos; this._dragPlaceholderPos = pos;
// Don't allow positioning before or after self // Don't allow positioning before or after self
if (favPos != -1 && (pos == favPos || pos == favPos + 1)) { if (favPos !== -1 && (pos === favPos || pos === favPos + 1)) {
this._clearDragPlaceholder(); this._clearDragPlaceholder();
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
} }
@ -937,7 +937,7 @@ export const Dash = GObject.registerClass({
if (!this._dragPlaceholder) if (!this._dragPlaceholder)
return DND.DragMotionResult.NO_DROP; return DND.DragMotionResult.NO_DROP;
let srcIsFavorite = favPos != -1; let srcIsFavorite = favPos !== -1;
if (srcIsFavorite) if (srcIsFavorite)
return DND.DragMotionResult.MOVE_DROP; return DND.DragMotionResult.MOVE_DROP;
@ -966,11 +966,11 @@ export const Dash = GObject.registerClass({
let children = this._box.get_children(); let children = this._box.get_children();
for (let i = 0; i < this._dragPlaceholderPos; i++) { for (let i = 0; i < this._dragPlaceholderPos; i++) {
if (this._dragPlaceholder && if (this._dragPlaceholder &&
children[i] == this._dragPlaceholder) children[i] === this._dragPlaceholder)
continue; continue;
let childId = children[i].child._delegate.app.get_id(); let childId = children[i].child._delegate.app.get_id();
if (childId == id) if (childId === id)
continue; continue;
if (childId in favorites) if (childId in favorites)
favPos++; favPos++;

View File

@ -72,14 +72,14 @@ class Dialog extends St.Widget {
} }
vfunc_event(event) { vfunc_event(event) {
if (event.type() == Clutter.EventType.KEY_PRESS) { if (event.type() === Clutter.EventType.KEY_PRESS) {
this._pressedKey = event.get_key_symbol(); this._pressedKey = event.get_key_symbol();
} else if (event.type() == Clutter.EventType.KEY_RELEASE) { } else if (event.type() === Clutter.EventType.KEY_RELEASE) {
let pressedKey = this._pressedKey; let pressedKey = this._pressedKey;
this._pressedKey = null; this._pressedKey = null;
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol != pressedKey) if (symbol !== pressedKey)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
let buttonInfo = this._buttonKeys[symbol]; let buttonInfo = this._buttonKeys[symbol];

View File

@ -119,7 +119,7 @@ class _Draggable extends Signals.EventEmitter {
this.actor.connect('destroy', () => { this.actor.connect('destroy', () => {
this._actorDestroyed = true; this._actorDestroyed = true;
if (this._dragState == DragState.DRAGGING && this._dragCancellable) if (this._dragState === DragState.DRAGGING && this._dragCancellable)
this._cancelDrag(global.get_current_time()); this._cancelDrag(global.get_current_time());
this.disconnectAll(); this.disconnectAll();
}); });
@ -180,7 +180,7 @@ class _Draggable extends Signals.EventEmitter {
} }
_onButtonPress(actor, event) { _onButtonPress(actor, event) {
if (event.get_button() != 1) if (event.get_button() !== 1)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
this._grabActor(event.get_device()); this._grabActor(event.get_device());
@ -205,7 +205,7 @@ class _Draggable extends Signals.EventEmitter {
if (!Meta.is_wayland_compositor()) if (!Meta.is_wayland_compositor())
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (event.type() != Clutter.EventType.TOUCH_BEGIN || if (event.type() !== Clutter.EventType.TOUCH_BEGIN ||
!global.display.is_pointer_emulating_sequence(event.get_event_sequence())) !global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -271,15 +271,15 @@ class _Draggable extends Signals.EventEmitter {
} }
_eventIsRelease(event) { _eventIsRelease(event) {
if (event.type() == Clutter.EventType.BUTTON_RELEASE) { if (event.type() === Clutter.EventType.BUTTON_RELEASE) {
let buttonMask = Clutter.ModifierType.BUTTON1_MASK | let buttonMask = Clutter.ModifierType.BUTTON1_MASK |
Clutter.ModifierType.BUTTON2_MASK | Clutter.ModifierType.BUTTON2_MASK |
Clutter.ModifierType.BUTTON3_MASK; Clutter.ModifierType.BUTTON3_MASK;
/* We only obey the last button release from the device, /* We only obey the last button release from the device,
* other buttons may get pressed/released during the DnD op. * other buttons may get pressed/released during the DnD op.
*/ */
return (event.get_state() & buttonMask) == 0; return (event.get_state() & buttonMask) === 0;
} else if (event.type() == Clutter.EventType.TOUCH_END) { } else if (event.type() === Clutter.EventType.TOUCH_END) {
/* For touch, we only obey the pointer emulating sequence */ /* For touch, we only obey the pointer emulating sequence */
return global.display.is_pointer_emulating_sequence(event.get_event_sequence()); return global.display.is_pointer_emulating_sequence(event.get_event_sequence());
} }
@ -291,8 +291,8 @@ class _Draggable extends Signals.EventEmitter {
let device = event.get_device(); let device = event.get_device();
if (this._grabbedDevice && if (this._grabbedDevice &&
device != this._grabbedDevice && device !== this._grabbedDevice &&
device.get_device_type() != Clutter.InputDeviceType.KEYBOARD_DEVICE) device.get_device_type() !== Clutter.InputDeviceType.KEYBOARD_DEVICE)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
// We intercept BUTTON_RELEASE event to know that the button was released in case we // We intercept BUTTON_RELEASE event to know that the button was released in case we
@ -300,9 +300,9 @@ class _Draggable extends Signals.EventEmitter {
// to complete the drag and ensure that whatever happens to be under the pointer does // to complete the drag and ensure that whatever happens to be under the pointer does
// not get triggered if the drag was cancelled with Esc. // not get triggered if the drag was cancelled with Esc.
if (this._eventIsRelease(event)) { if (this._eventIsRelease(event)) {
if (this._dragState == DragState.DRAGGING) { if (this._dragState === DragState.DRAGGING) {
return this._dragActorDropped(event); return this._dragActorDropped(event);
} else if ((this._dragActor != null || this._dragState == DragState.CANCELLED) && } else if ((this._dragActor != null || this._dragState === DragState.CANCELLED) &&
!this._animationInProgress) { !this._animationInProgress) {
// Drag must have been cancelled with Esc. // Drag must have been cancelled with Esc.
this._dragComplete(); this._dragComplete();
@ -314,19 +314,19 @@ class _Draggable extends Signals.EventEmitter {
} }
// We intercept MOTION event to figure out if the drag has started and to draw // We intercept MOTION event to figure out if the drag has started and to draw
// this._dragActor under the pointer when dragging is in progress // this._dragActor under the pointer when dragging is in progress
} else if (event.type() == Clutter.EventType.MOTION || } else if (event.type() === Clutter.EventType.MOTION ||
(event.type() == Clutter.EventType.TOUCH_UPDATE && (event.type() === Clutter.EventType.TOUCH_UPDATE &&
global.display.is_pointer_emulating_sequence(event.get_event_sequence()))) { global.display.is_pointer_emulating_sequence(event.get_event_sequence()))) {
if (this._dragActor && this._dragState == DragState.DRAGGING) if (this._dragActor && this._dragState === DragState.DRAGGING)
return this._updateDragPosition(event); return this._updateDragPosition(event);
else if (this._dragActor == null && this._dragState != DragState.CANCELLED) else if (this._dragActor == null && this._dragState !== DragState.CANCELLED)
return this._maybeStartDrag(event); return this._maybeStartDrag(event);
// We intercept KEY_PRESS event so that we can process Esc key press to cancel // We intercept KEY_PRESS event so that we can process Esc key press to cancel
// dragging and ignore all other key presses. // dragging and ignore all other key presses.
} else if (event.type() == Clutter.EventType.KEY_PRESS && this._dragState == DragState.DRAGGING) { } else if (event.type() === Clutter.EventType.KEY_PRESS && this._dragState === DragState.DRAGGING) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Escape) { if (symbol === Clutter.KEY_Escape) {
this._cancelDrag(event.get_time()); this._cancelDrag(event.get_time());
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -363,13 +363,13 @@ class _Draggable extends Signals.EventEmitter {
if (currentDraggable) if (currentDraggable)
return; return;
if (device == undefined) { if (device === undefined) {
let event = Clutter.get_current_event(); let event = Clutter.get_current_event();
if (event) if (event)
device = event.get_device(); device = event.get_device();
if (device == undefined) { if (device === undefined) {
let seat = Clutter.get_default_backend().get_default_seat(); let seat = Clutter.get_default_backend().get_default_seat();
device = seat.get_pointer(); device = seat.get_pointer();
} }
@ -479,11 +479,11 @@ class _Draggable extends Signals.EventEmitter {
this._finishAnimation(); this._finishAnimation();
this._dragActor = null; this._dragActor = null;
if (this._dragState == DragState.DRAGGING) if (this._dragState === DragState.DRAGGING)
this._dragState = DragState.CANCELLED; this._dragState = DragState.CANCELLED;
}); });
this._dragOrigOpacity = this._dragActor.opacity; this._dragOrigOpacity = this._dragActor.opacity;
if (this._dragActorOpacity != undefined) if (this._dragActorOpacity !== undefined)
this._dragActor.opacity = this._dragActorOpacity; this._dragActor.opacity = this._dragActorOpacity;
this._snapBackX = this._dragStartX + this._dragOffsetX; this._snapBackX = this._dragStartX + this._dragOffsetX;
@ -500,7 +500,7 @@ class _Draggable extends Signals.EventEmitter {
this._dragX + this._dragOffsetX, this._dragX + this._dragOffsetX,
this._dragY + this._dragOffsetY); this._dragY + this._dragOffsetY);
if (this._dragActorMaxSize != undefined) { if (this._dragActorMaxSize !== undefined) {
let currentSize = Math.max(scaledWidth, scaledHeight); let currentSize = Math.max(scaledWidth, scaledHeight);
if (currentSize > this._dragActorMaxSize) { if (currentSize > this._dragActorMaxSize) {
let scale = this._dragActorMaxSize / currentSize; let scale = this._dragActorMaxSize / currentSize;
@ -604,7 +604,7 @@ class _Draggable extends Signals.EventEmitter {
let motionFunc = dragMonitors[i].dragMotion; let motionFunc = dragMonitors[i].dragMotion;
if (motionFunc) { if (motionFunc) {
let result = motionFunc(dragEvent); let result = motionFunc(dragEvent);
if (result != DragMotionResult.CONTINUE) { if (result !== DragMotionResult.CONTINUE) {
global.display.set_cursor(DRAG_CURSOR_MAP[result]); global.display.set_cursor(DRAG_CURSOR_MAP[result]);
dragEvent.targetActor.disconnect(targetActorDestroyHandlerId); dragEvent.targetActor.disconnect(targetActorDestroyHandlerId);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
@ -625,7 +625,7 @@ class _Draggable extends Signals.EventEmitter {
targX, targX,
targY, targY,
0); 0);
if (result != DragMotionResult.CONTINUE) { if (result !== DragMotionResult.CONTINUE) {
global.display.set_cursor(DRAG_CURSOR_MAP[result]); global.display.set_cursor(DRAG_CURSOR_MAP[result]);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
} }
@ -702,7 +702,7 @@ class _Draggable extends Signals.EventEmitter {
if (accepted) { if (accepted) {
// If it accepted the drop without taking the actor, // If it accepted the drop without taking the actor,
// handle it ourselves. // handle it ourselves.
if (this._dragActor && this._dragActor.get_parent() == Main.uiGroup) { if (this._dragActor && this._dragActor.get_parent() === Main.uiGroup) {
if (this._restoreOnSuccess) { if (this._restoreOnSuccess) {
this._restoreDragActor(event.get_time()); this._restoreDragActor(event.get_time());
return true; return true;
@ -756,7 +756,7 @@ class _Draggable extends Signals.EventEmitter {
_cancelDrag(eventTime) { _cancelDrag(eventTime) {
this.emit('drag-cancelled', eventTime); this.emit('drag-cancelled', eventTime);
let wasCancelled = this._dragState == DragState.CANCELLED; let wasCancelled = this._dragState === DragState.CANCELLED;
this._dragState = DragState.CANCELLED; this._dragState = DragState.CANCELLED;
if (this._actorDestroyed || wasCancelled) { if (this._actorDestroyed || wasCancelled) {

View File

@ -32,7 +32,7 @@ export const EdgeDragAction = GObject.registerClass({
} }
vfunc_gesture_prepare(_actor) { vfunc_gesture_prepare(_actor) {
if (this.get_n_current_points() == 0) if (this.get_n_current_points() === 0)
return false; return false;
if (!(this._allowedModes & Main.actionMode)) if (!(this._allowedModes & Main.actionMode))
@ -41,10 +41,10 @@ export const EdgeDragAction = GObject.registerClass({
let [x, y] = this.get_press_coords(0); let [x, y] = this.get_press_coords(0);
let monitorRect = this._getMonitorRect(x, y); let monitorRect = this._getMonitorRect(x, y);
return (this._side == St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) || return (this._side === St.Side.LEFT && x < monitorRect.x + EDGE_THRESHOLD) ||
(this._side == St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) || (this._side === St.Side.RIGHT && x > monitorRect.x + monitorRect.width - EDGE_THRESHOLD) ||
(this._side == St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) || (this._side === St.Side.TOP && y < monitorRect.y + EDGE_THRESHOLD) ||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD); (this._side === St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD);
} }
vfunc_gesture_progress(_actor) { vfunc_gesture_progress(_actor) {
@ -57,9 +57,9 @@ export const EdgeDragAction = GObject.registerClass({
return true; return true;
if ((offsetX > offsetY && if ((offsetX > offsetY &&
(this._side == St.Side.TOP || this._side == St.Side.BOTTOM)) || (this._side === St.Side.TOP || this._side === St.Side.BOTTOM)) ||
(offsetY > offsetX && (offsetY > offsetX &&
(this._side == St.Side.LEFT || this._side == St.Side.RIGHT))) { (this._side === St.Side.LEFT || this._side === St.Side.RIGHT))) {
this.cancel(); this.cancel();
return false; return false;
} }
@ -78,10 +78,10 @@ export const EdgeDragAction = GObject.registerClass({
let [x, y] = this.get_motion_coords(0); let [x, y] = this.get_motion_coords(0);
let monitorRect = this._getMonitorRect(startX, startY); let monitorRect = this._getMonitorRect(startX, startY);
if ((this._side == St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) || if ((this._side === St.Side.TOP && y > monitorRect.y + DRAG_DISTANCE) ||
(this._side == St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) || (this._side === St.Side.BOTTOM && y < monitorRect.y + monitorRect.height - DRAG_DISTANCE) ||
(this._side == St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) || (this._side === St.Side.LEFT && x > monitorRect.x + DRAG_DISTANCE) ||
(this._side == St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE)) (this._side === St.Side.RIGHT && x < monitorRect.x + monitorRect.width - DRAG_DISTANCE))
this.emit('activated'); this.emit('activated');
else else
this.cancel(); this.cancel();

View File

@ -363,7 +363,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
} }
_sync() { _sync() {
let open = this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED; let open = this.state === ModalDialog.State.OPENING || this.state === ModalDialog.State.OPENED;
if (!open) if (!open)
return; return;
@ -732,7 +732,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
} }
// Only consider updates and upgrades if PackageKit is available. // Only consider updates and upgrades if PackageKit is available.
if (this._pkOfflineProxy && this._type == DialogType.RESTART) { if (this._pkOfflineProxy && this._type === DialogType.RESTART) {
if (this._updateInfo.UpdateTriggered) if (this._updateInfo.UpdateTriggered)
this._type = DialogType.UPDATE_RESTART; this._type = DialogType.UPDATE_RESTART;
else if (this._updateInfo.UpgradeTriggered) else if (this._updateInfo.UpgradeTriggered)

View File

@ -110,21 +110,21 @@ function _getPropertyTarget(actor, propName) {
function _easeActor(actor, params) { function _easeActor(actor, params) {
actor.save_easing_state(); actor.save_easing_state();
if (params.duration != undefined) if (params.duration !== undefined)
actor.set_easing_duration(params.duration); actor.set_easing_duration(params.duration);
delete params.duration; delete params.duration;
if (params.delay != undefined) if (params.delay !== undefined)
actor.set_easing_delay(params.delay); actor.set_easing_delay(params.delay);
delete params.delay; delete params.delay;
let repeatCount = 0; let repeatCount = 0;
if (params.repeatCount != undefined) if (params.repeatCount !== undefined)
repeatCount = params.repeatCount; repeatCount = params.repeatCount;
delete params.repeatCount; delete params.repeatCount;
let autoReverse = false; let autoReverse = false;
if (params.autoReverse != undefined) if (params.autoReverse !== undefined)
autoReverse = params.autoReverse; autoReverse = params.autoReverse;
delete params.autoReverse; delete params.autoReverse;
@ -133,7 +133,7 @@ function _easeActor(actor, params) {
// whether the transition should finish where it started // whether the transition should finish where it started
const isReversed = autoReverse && numIterations % 2 === 0; const isReversed = autoReverse && numIterations % 2 === 0;
if (params.mode != undefined) if (params.mode !== undefined)
actor.set_easing_mode(params.mode); actor.set_easing_mode(params.mode);
delete params.mode; delete params.mode;
@ -185,12 +185,12 @@ function _easeActorProperty(actor, propName, target, params) {
let duration = Math.floor(params.duration || 0); let duration = Math.floor(params.duration || 0);
let repeatCount = 0; let repeatCount = 0;
if (params.repeatCount != undefined) if (params.repeatCount !== undefined)
repeatCount = params.repeatCount; repeatCount = params.repeatCount;
delete params.repeatCount; delete params.repeatCount;
let autoReverse = false; let autoReverse = false;
if (params.autoReverse != undefined) if (params.autoReverse !== undefined)
autoReverse = params.autoReverse; autoReverse = params.autoReverse;
delete params.autoReverse; delete params.autoReverse;
@ -217,7 +217,7 @@ function _easeActorProperty(actor, propName, target, params) {
// cancel overwritten transition // cancel overwritten transition
actor.remove_transition(propName); actor.remove_transition(propName);
if (duration == 0) { if (duration === 0) {
let [obj, prop] = _getPropertyTarget(actor, propName); let [obj, prop] = _getPropertyTarget(actor, propName);
if (!isReversed) if (!isReversed)

View File

@ -402,7 +402,7 @@ export class ExtensionManager extends Signals.EventEmitter {
throw new Error(`property "${prop}" is not of type ${typeName}`); throw new Error(`property "${prop}" is not of type ${typeName}`);
} }
if (uuid != meta.uuid) if (uuid !== meta.uuid)
throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name "${uuid}"`); throw new Error(`uuid "${meta.uuid}" from metadata.json does not match directory name "${uuid}"`);
let extension = { let extension = {

View File

@ -39,14 +39,14 @@ export class FocusCaretTracker extends Signals.EventEmitter {
} }
_onChanged(event) { _onChanged(event) {
if (event.type.indexOf(STATECHANGED) == 0) if (event.type.indexOf(STATECHANGED) === 0)
this.emit('focus-changed', event); this.emit('focus-changed', event);
else if (event.type == CARETMOVED) else if (event.type === CARETMOVED)
this.emit('caret-moved', event); this.emit('caret-moved', event);
} }
_initAtspi() { _initAtspi() {
if (!this._atspiInited && Atspi.init() == 0) { if (!this._atspiInited && Atspi.init() === 0) {
Atspi.set_timeout(250, 250); Atspi.set_timeout(250, 250);
this._atspiInited = true; this._atspiInited = true;
} }

View File

@ -39,7 +39,7 @@ export class GrabHelper {
_isWithinGrabbedActor(actor) { _isWithinGrabbedActor(actor) {
let currentActor = this.currentGrab.actor; let currentActor = this.currentGrab.actor;
while (actor) { while (actor) {
if (actor == currentActor) if (actor === currentActor)
return true; return true;
actor = actor.get_parent(); actor = actor.get_parent();
} }
@ -155,7 +155,7 @@ export class GrabHelper {
} }
_takeModalGrab() { _takeModalGrab() {
let firstGrab = this._modalCount == 0; let firstGrab = this._modalCount === 0;
if (firstGrab) { if (firstGrab) {
let grab = Main.pushModal(this._owner, this._modalParams); let grab = Main.pushModal(this._owner, this._modalParams);
if (grab.get_seat_state() !== Clutter.GrabState.ALL) { if (grab.get_seat_state() !== Clutter.GrabState.ALL) {
@ -244,20 +244,20 @@ export class GrabHelper {
onCapturedEvent(event) { onCapturedEvent(event) {
let type = event.type(); let type = event.type();
if (type == Clutter.EventType.KEY_PRESS && if (type === Clutter.EventType.KEY_PRESS &&
event.get_key_symbol() == Clutter.KEY_Escape) { event.get_key_symbol() === Clutter.KEY_Escape) {
this.ungrab({isUser: true}); this.ungrab({isUser: true});
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
let motion = type == Clutter.EventType.MOTION; let motion = type === Clutter.EventType.MOTION;
let press = type == Clutter.EventType.BUTTON_PRESS; let press = type === Clutter.EventType.BUTTON_PRESS;
let release = type == Clutter.EventType.BUTTON_RELEASE; let release = type === Clutter.EventType.BUTTON_RELEASE;
let button = press || release; let button = press || release;
let touchUpdate = type == Clutter.EventType.TOUCH_UPDATE; let touchUpdate = type === Clutter.EventType.TOUCH_UPDATE;
let touchBegin = type == Clutter.EventType.TOUCH_BEGIN; let touchBegin = type === Clutter.EventType.TOUCH_BEGIN;
let touchEnd = type == Clutter.EventType.TOUCH_END; let touchEnd = type === Clutter.EventType.TOUCH_END;
let touch = touchUpdate || touchBegin || touchEnd; let touch = touchUpdate || touchBegin || touchEnd;
if (touch && !global.display.is_pointer_emulating_sequence(event.get_event_sequence())) if (touch && !global.display.is_pointer_emulating_sequence(event.get_event_sequence()))

View File

@ -95,12 +95,12 @@ const CandidateArea = GObject.registerClass({
} }
setOrientation(orientation) { setOrientation(orientation) {
if (this._orientation == orientation) if (this._orientation === orientation)
return; return;
this._orientation = orientation; this._orientation = orientation;
if (this._orientation == IBus.Orientation.HORIZONTAL) { if (this._orientation === IBus.Orientation.HORIZONTAL) {
this.vertical = false; this.vertical = false;
this.remove_style_class_name('vertical'); this.remove_style_class_name('vertical');
this.add_style_class_name('horizontal'); this.add_style_class_name('horizontal');
@ -260,7 +260,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
let cursorPos = lookupTable.get_cursor_pos(); let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size(); let pageSize = lookupTable.get_page_size();
let nPages = Math.ceil(nCandidates / pageSize); let nPages = Math.ceil(nCandidates / pageSize);
let page = cursorPos == 0 ? 0 : Math.floor(cursorPos / pageSize); let page = cursorPos === 0 ? 0 : Math.floor(cursorPos / pageSize);
let startIndex = page * pageSize; let startIndex = page * pageSize;
let endIndex = Math.min((page + 1) * pageSize, nCandidates); let endIndex = Math.min((page + 1) * pageSize, nCandidates);
@ -336,7 +336,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
_setTextAttributes(clutterText, ibusAttrList) { _setTextAttributes(clutterText, ibusAttrList) {
let attr; let attr;
for (let i = 0; (attr = ibusAttrList.get(i)); ++i) { for (let i = 0; (attr = ibusAttrList.get(i)); ++i) {
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND) if (attr.get_attr_type() === IBus.AttrType.BACKGROUND)
clutterText.set_selection(attr.get_start_index(), attr.get_end_index()); clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
} }
} }

View File

@ -137,7 +137,7 @@ class KeyContainer extends St.Widget {
let row = this._rows[i]; let row = this._rows[i];
/* When starting a new row, see if we need some padding */ /* When starting a new row, see if we need some padding */
if (nCol == 0) { if (nCol === 0) {
let diff = this._maxCols - row.width; let diff = this._maxCols - row.width;
if (diff >= 1) if (diff >= 1)
nCol = diff * KEY_SIZE / 2; nCol = diff * KEY_SIZE / 2;
@ -238,7 +238,7 @@ class LanguageSelectionPopup extends PopupMenu.PopupMenu {
this.actor.contains(targetActor)) this.actor.contains(targetActor))
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (event.type() == Clutter.EventType.BUTTON_RELEASE || event.type() == Clutter.EventType.TOUCH_END) if (event.type() === Clutter.EventType.BUTTON_RELEASE || event.type() === Clutter.EventType.TOUCH_END)
this.close(true); this.close(true);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
@ -355,7 +355,7 @@ const Key = GObject.registerClass({
} }
_release(button, commitString) { _release(button, commitString) {
if (this._pressTimeoutId != 0) { if (this._pressTimeoutId !== 0) {
GLib.source_remove(this._pressTimeoutId); GLib.source_remove(this._pressTimeoutId);
this._pressTimeoutId = 0; this._pressTimeoutId = 0;
} }
@ -376,7 +376,7 @@ const Key = GObject.registerClass({
} }
cancel() { cancel() {
if (this._pressTimeoutId != 0) { if (this._pressTimeoutId !== 0) {
GLib.source_remove(this._pressTimeoutId); GLib.source_remove(this._pressTimeoutId);
this._pressTimeoutId = 0; this._pressTimeoutId = 0;
} }
@ -387,8 +387,8 @@ const Key = GObject.registerClass({
_onCapturedEvent(actor, event) { _onCapturedEvent(actor, event) {
let type = event.type(); let type = event.type();
let press = type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN; let press = type === Clutter.EventType.BUTTON_PRESS || type === Clutter.EventType.TOUCH_BEGIN;
let release = type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END; let release = type === Clutter.EventType.BUTTON_RELEASE || type === Clutter.EventType.TOUCH_END;
const targetActor = global.stage.get_event_actor(event); const targetActor = global.stage.get_event_actor(event);
if (targetActor === this._boxPointer.bin || if (targetActor === this._boxPointer.bin ||
@ -463,7 +463,7 @@ const Key = GObject.registerClass({
const slot = event.get_event_sequence().get_slot(); const slot = event.get_event_sequence().get_slot();
if (!this._touchPressSlot && if (!this._touchPressSlot &&
event.type() == Clutter.EventType.TOUCH_BEGIN) { event.type() === Clutter.EventType.TOUCH_BEGIN) {
this._touchPressSlot = slot; this._touchPressSlot = slot;
this._press(button, commitString); this._press(button, commitString);
button.add_style_pseudo_class('active'); button.add_style_pseudo_class('active');
@ -548,7 +548,7 @@ class KeyboardModel {
} }
getKeysForLevel(levelName) { getKeysForLevel(levelName) {
return this._model.levels.find(level => level == levelName); return this._model.levels.find(level => level === levelName);
} }
} }
@ -711,7 +711,7 @@ const EmojiPager = GObject.registerClass({
} }
set delta(value) { set delta(value) {
if (this._delta == value) if (this._delta === value)
return; return;
this._delta = value; this._delta = value;
@ -719,7 +719,7 @@ const EmojiPager = GObject.registerClass({
let followingPage = this.getFollowingPage(); let followingPage = this.getFollowingPage();
if (this._followingPage != followingPage) { if (this._followingPage !== followingPage) {
if (this._followingPanel) { if (this._followingPanel) {
this._followingPanel.destroy(); this._followingPanel.destroy();
this._followingPanel = null; this._followingPanel = null;
@ -756,7 +756,7 @@ const EmojiPager = GObject.registerClass({
} }
getFollowingPage() { getFollowingPage() {
if (this.delta == 0) if (this.delta === 0)
return null; return null;
if (this.delta < 0) if (this.delta < 0)
@ -810,7 +810,7 @@ const EmojiPager = GObject.registerClass({
let pageKeys; let pageKeys;
for (let j = 0; j < section.keys.length; j++) { for (let j = 0; j < section.keys.length; j++) {
if (j % itemsPerPage == 0) { if (j % itemsPerPage === 0) {
page++; page++;
pageKeys = []; pageKeys = [];
this._pages.push({pageKeys, nPages, page, section: this._sections[i]}); this._pages.push({pageKeys, nPages, page, section: this._sections[i]});
@ -825,7 +825,7 @@ const EmojiPager = GObject.registerClass({
for (let i = 0; i < this._pages.length; i++) { for (let i = 0; i < this._pages.length; i++) {
let page = this._pages[i]; let page = this._pages[i];
if (page.section == section && page.page == nPage) if (page.section === section && page.page === nPage)
return i; return i;
} }
@ -865,7 +865,7 @@ const EmojiPager = GObject.registerClass({
this._currentKey = key; this._currentKey = key;
}); });
key.connect('commit', (actor, keyval, str) => { key.connect('commit', (actor, keyval, str) => {
if (this._currentKey != key) if (this._currentKey !== key)
return; return;
this._currentKey = null; this._currentKey = null;
this.emit('emoji', str); this.emit('emoji', str);
@ -884,7 +884,7 @@ const EmojiPager = GObject.registerClass({
} }
setCurrentPage(nPage) { setCurrentPage(nPage) {
if (this._curPage == nPage) if (this._curPage === nPage)
return; return;
this._curPage = nPage; this._curPage = nPage;
@ -895,7 +895,7 @@ const EmojiPager = GObject.registerClass({
} }
/* Reuse followingPage if possible */ /* Reuse followingPage if possible */
if (nPage == this._followingPage) { if (nPage === this._followingPage) {
this._panel = this._followingPanel; this._panel = this._followingPanel;
this._followingPanel = null; this._followingPanel = null;
} }
@ -920,7 +920,7 @@ const EmojiPager = GObject.registerClass({
for (let i = 0; i < this._pages.length; i++) { for (let i = 0; i < this._pages.length; i++) {
let page = this._pages[i]; let page = this._pages[i];
if (page.section == section && page.page == nPage) { if (page.section === section && page.page === nPage) {
this.setCurrentPage(i); this.setCurrentPage(i);
break; break;
} }
@ -1013,7 +1013,7 @@ const EmojiSelection = GObject.registerClass({
for (let i = 0; i < this._sections.length; i++) { for (let i = 0; i < this._sections.length; i++) {
let sect = this._sections[i]; let sect = this._sections[i];
sect.button.setLatched(sectionLabel == sect.label); sect.button.setLatched(sectionLabel === sect.label);
} }
} }
@ -1024,7 +1024,7 @@ const EmojiSelection = GObject.registerClass({
_findSection(emoji) { _findSection(emoji) {
for (let i = 0; i < this._sections.length; i++) { for (let i = 0; i < this._sections.length; i++) {
if (this._sections[i].first == emoji) if (this._sections[i].first === emoji)
return this._sections[i]; return this._sections[i];
} }
@ -1221,7 +1221,7 @@ export class KeyboardManager extends Signals.EventEmitter {
return false; return false;
let deviceType = this._lastDevice.get_device_type(); let deviceType = this._lastDevice.get_device_type();
return deviceType == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE; return deviceType === Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
} }
_syncEnabled() { _syncEnabled() {
@ -1494,7 +1494,7 @@ export const Keyboard = GObject.registerClass({
* basically). We however make things consistent by skipping that * basically). We however make things consistent by skipping that
* second level. * second level.
*/ */
let level = i >= 1 && levels.length == 3 ? i + 1 : i; let level = i >= 1 && levels.length === 3 ? i + 1 : i;
let layout = new KeyContainer(); let layout = new KeyContainer();
layout.shiftKeys = []; layout.shiftKeys = [];
@ -1837,7 +1837,7 @@ export const Keyboard = GObject.registerClass({
} }
_onKeypadVisible(controller, visible) { _onKeypadVisible(controller, visible) {
if (visible == this._keypadVisible) if (visible === this._keypadVisible)
return; return;
this._keypadVisible = visible; this._keypadVisible = visible;
@ -1846,7 +1846,7 @@ export const Keyboard = GObject.registerClass({
} }
_onEmojiKeyVisible(controller, visible) { _onEmojiKeyVisible(controller, visible) {
if (visible == this._emojiKeyVisible) if (visible === this._emojiKeyVisible)
return; return;
this._emojiKeyVisible = visible; this._emojiKeyVisible = visible;
@ -1856,12 +1856,12 @@ export const Keyboard = GObject.registerClass({
_onKeyboardStateChanged(controller, state) { _onKeyboardStateChanged(controller, state) {
let enabled; let enabled;
if (state == Clutter.InputPanelState.OFF) if (state === Clutter.InputPanelState.OFF)
enabled = false; enabled = false;
else if (state == Clutter.InputPanelState.ON) else if (state === Clutter.InputPanelState.ON)
enabled = true; enabled = true;
else if (state == Clutter.InputPanelState.TOGGLE) else if (state === Clutter.InputPanelState.TOGGLE)
enabled = this._keyboardVisible == false; enabled = this._keyboardVisible === false;
else else
return; return;
@ -1876,7 +1876,7 @@ export const Keyboard = GObject.registerClass({
let layers = this._groups[activeGroupName]; let layers = this._groups[activeGroupName];
let currentPage = layers[activeLevel]; let currentPage = layers[activeLevel];
if (this._currentPage == currentPage) { if (this._currentPage === currentPage) {
this._updateCurrentPageVisible(); this._updateCurrentPageVisible();
return; return;
} }
@ -2211,14 +2211,14 @@ class KeyboardController extends Signals.EventEmitter {
let emojiVisible = false; let emojiVisible = false;
let keypadVisible = false; let keypadVisible = false;
if (purpose == Clutter.InputContentPurpose.NORMAL || if (purpose === Clutter.InputContentPurpose.NORMAL ||
purpose == Clutter.InputContentPurpose.ALPHA || purpose === Clutter.InputContentPurpose.ALPHA ||
purpose == Clutter.InputContentPurpose.PASSWORD || purpose === Clutter.InputContentPurpose.PASSWORD ||
purpose == Clutter.InputContentPurpose.TERMINAL) purpose === Clutter.InputContentPurpose.TERMINAL)
emojiVisible = true; emojiVisible = true;
if (purpose == Clutter.InputContentPurpose.DIGITS || if (purpose === Clutter.InputContentPurpose.DIGITS ||
purpose == Clutter.InputContentPurpose.NUMBER || purpose === Clutter.InputContentPurpose.NUMBER ||
purpose == Clutter.InputContentPurpose.PHONE) purpose === Clutter.InputContentPurpose.PHONE)
keypadVisible = true; keypadVisible = true;
this.emit('emoji-visible', emojiVisible); this.emit('emoji-visible', emojiVisible);
@ -2261,7 +2261,7 @@ class KeyboardController extends Signals.EventEmitter {
if (string == null) if (string == null)
return false; return false;
/* Let ibus methods fall through keyval emission */ /* Let ibus methods fall through keyval emission */
if (fromKey && this._currentSource.type == InputSourceManager.INPUT_SOURCE_TYPE_IBUS) if (fromKey && this._currentSource.type === InputSourceManager.INPUT_SOURCE_TYPE_IBUS)
return false; return false;
Main.inputMethod.commit(string); Main.inputMethod.commit(string);

View File

@ -91,7 +91,7 @@ export const MonitorConstraint = GObject.registerClass({
} }
set workArea(v) { set workArea(v) {
if (v == this._workArea) if (v === this._workArea)
return; return;
this._workArea = v; this._workArea = v;
if (this.actor) if (this.actor)
@ -200,7 +200,7 @@ export const LayoutManager = GObject.registerClass({
_init() { _init() {
super._init(); super._init();
this._rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; this._rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
this.monitors = []; this.monitors = [];
this.primaryMonitor = null; this.primaryMonitor = null;
this.primaryIndex = -1; this.primaryIndex = -1;
@ -391,9 +391,9 @@ export const LayoutManager = GObject.registerClass({
display.get_monitor_scale(i))); display.get_monitor_scale(i)));
} }
if (nMonitors == 0) { if (nMonitors === 0) {
this.primaryIndex = this.bottomIndex = -1; this.primaryIndex = this.bottomIndex = -1;
} else if (nMonitors == 1) { } else if (nMonitors === 1) {
this.primaryIndex = this.bottomIndex = 0; this.primaryIndex = this.bottomIndex = 0;
} else { } else {
// If there are monitors below the primary, then we need // If there are monitors below the primary, then we need
@ -407,7 +407,7 @@ export const LayoutManager = GObject.registerClass({
} }
} }
} }
if (this.primaryIndex != -1) { if (this.primaryIndex !== -1) {
this.primaryMonitor = this.monitors[this.primaryIndex]; this.primaryMonitor = this.monitors[this.primaryIndex];
this.bottomMonitor = this.monitors[this.bottomIndex]; this.bottomMonitor = this.monitors[this.bottomIndex];
@ -445,7 +445,7 @@ export const LayoutManager = GObject.registerClass({
let haveTopLeftCorner = true; let haveTopLeftCorner = true;
if (i != this.primaryIndex) { if (i !== this.primaryIndex) {
// Check if we have a top left (right for RTL) corner. // Check if we have a top left (right for RTL) corner.
// I.e. if there is no monitor directly above or to the left(right) // I.e. if there is no monitor directly above or to the left(right)
let besideX = this._rtl ? monitor.x + 1 : cornerX - 1; let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
@ -454,7 +454,7 @@ export const LayoutManager = GObject.registerClass({
let aboveY = cornerY - 1; let aboveY = cornerY - 1;
for (let j = 0; j < this.monitors.length; j++) { for (let j = 0; j < this.monitors.length; j++) {
if (i == j) if (i === j)
continue; continue;
let otherMonitor = this.monitors[j]; let otherMonitor = this.monitors[j];
if (besideX >= otherMonitor.x && if (besideX >= otherMonitor.x &&
@ -505,7 +505,7 @@ export const LayoutManager = GObject.registerClass({
_showSecondaryBackgrounds() { _showSecondaryBackgrounds() {
for (let i = 0; i < this.monitors.length; i++) { for (let i = 0; i < this.monitors.length; i++) {
if (i != this.primaryIndex) { if (i !== this.primaryIndex) {
let backgroundActor = this._bgManagers[i].backgroundActor; let backgroundActor = this._bgManagers[i].backgroundActor;
backgroundActor.show(); backgroundActor.show();
backgroundActor.opacity = 0; backgroundActor.opacity = 0;
@ -540,7 +540,7 @@ export const LayoutManager = GObject.registerClass({
let bgManager = this._createBackgroundManager(i); let bgManager = this._createBackgroundManager(i);
this._bgManagers.push(bgManager); this._bgManagers.push(bgManager);
if (i != this.primaryIndex && this._startingUp) if (i !== this.primaryIndex && this._startingUp)
bgManager.backgroundActor.hide(); bgManager.backgroundActor.hide();
} }
@ -879,7 +879,7 @@ export const LayoutManager = GObject.registerClass({
trackChrome(actor, params = {}) { trackChrome(actor, params = {}) {
let ancestor = actor.get_parent(); let ancestor = actor.get_parent();
let index = this._findActor(ancestor); let index = this._findActor(ancestor);
while (ancestor && index == -1) { while (ancestor && index === -1) {
ancestor = ancestor.get_parent(); ancestor = ancestor.get_parent();
index = this._findActor(ancestor); index = this._findActor(ancestor);
} }
@ -917,14 +917,14 @@ export const LayoutManager = GObject.registerClass({
_findActor(actor) { _findActor(actor) {
for (let i = 0; i < this._trackedActors.length; i++) { for (let i = 0; i < this._trackedActors.length; i++) {
let actorData = this._trackedActors[i]; let actorData = this._trackedActors[i];
if (actorData.actor == actor) if (actorData.actor === actor)
return i; return i;
} }
return -1; return -1;
} }
_trackActor(actor, params) { _trackActor(actor, params) {
if (this._findActor(actor) != -1) if (this._findActor(actor) !== -1)
throw new Error('trying to re-track existing chrome actor'); throw new Error('trying to re-track existing chrome actor');
let actorData = Params.parse(params, defaultParams); let actorData = Params.parse(params, defaultParams);
@ -944,7 +944,7 @@ export const LayoutManager = GObject.registerClass({
_untrackActor(actor) { _untrackActor(actor) {
let i = this._findActor(actor); let i = this._findActor(actor);
if (i == -1) if (i === -1)
return; return;
this._trackedActors.splice(i, 1); this._trackedActors.splice(i, 1);
@ -1012,7 +1012,7 @@ export const LayoutManager = GObject.registerClass({
_windowsRestacked() { _windowsRestacked() {
let changed = false; let changed = false;
if (this._isPopupWindowVisible != global.top_window_group.get_children().some(isPopupMetaWindow)) if (this._isPopupWindowVisible !== global.top_window_group.get_children().some(isPopupMetaWindow))
changed = true; changed = true;
if (changed) { if (changed) {
@ -1157,7 +1157,7 @@ class HotCorner extends Clutter.Actor {
let px = 0.0; let px = 0.0;
let py = 0.0; let py = 0.0;
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
px = 1.0; px = 1.0;
py = 0.0; py = 0.0;
} }
@ -1182,7 +1182,7 @@ class HotCorner extends Clutter.Actor {
} }
if (size > 0) { if (size > 0) {
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
this._verticalBarrier = new Meta.Barrier({ this._verticalBarrier = new Meta.Barrier({
display: global.display, display: global.display,
x1: this._x, x2: this._x, y1: this._y, y2: this._y + size, x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
@ -1234,7 +1234,7 @@ class HotCorner extends Clutter.Actor {
this.add_child(this._corner); this.add_child(this._corner);
layoutManager.addChrome(this); layoutManager.addChrome(this);
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) { if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
this._corner.set_position(this.width - this._corner.width, 0); this._corner.set_position(this.width - this._corner.width, 0);
this.set_pivot_point(1.0, 0.0); this.set_pivot_point(1.0, 0.0);
this.translation_x = -this.width; this.translation_x = -this.width;
@ -1269,7 +1269,7 @@ class HotCorner extends Clutter.Actor {
} }
handleDragOver(source, _actor, _x, _y, _time) { handleDragOver(source, _actor, _x, _y, _time) {
if (source != Main.xdndHandler) if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
this._toggleOverview(); this._toggleOverview();
@ -1286,7 +1286,7 @@ class HotCorner extends Clutter.Actor {
} }
_onCornerLeft(actor, event) { _onCornerLeft(actor, event) {
if (event.get_related() != this) if (event.get_related() !== this)
this._entered = false; this._entered = false;
// Consume event, otherwise this will confuse onEnvironsLeft // Consume event, otherwise this will confuse onEnvironsLeft
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
@ -1346,7 +1346,7 @@ class PressureBarrier extends Signals.EventEmitter {
} }
_isHorizontal(barrier) { _isHorizontal(barrier) {
return barrier.y1 == barrier.y2; return barrier.y1 === barrier.y2;
} }
_getDistanceAcrossBarrier(barrier, event) { _getDistanceAcrossBarrier(barrier, event) {

View File

@ -178,13 +178,13 @@ export const Lightbox = GObject.registerClass({
// and add it to this._children as the new topmost actor. // and add it to this._children as the new topmost actor.
this._container.set_child_above_sibling(this, newChild); this._container.set_child_above_sibling(this, newChild);
this._children.push(newChild); this._children.push(newChild);
} else if (newChildIndex == 0) { } else if (newChildIndex === 0) {
// Bottom of stack // Bottom of stack
this._children.unshift(newChild); this._children.unshift(newChild);
} else { } else {
// Somewhere else; insert it into the correct spot // Somewhere else; insert it into the correct spot
let prevChild = this._children.indexOf(children[newChildIndex - 1]); let prevChild = this._children.indexOf(children[newChildIndex - 1]);
if (prevChild != -1) // paranoia if (prevChild !== -1) // paranoia
this._children.splice(prevChild + 1, 0, newChild); this._children.splice(prevChild + 1, 0, newChild);
} }
} }
@ -243,10 +243,10 @@ export const Lightbox = GObject.registerClass({
_actorRemoved(container, child) { _actorRemoved(container, child) {
let index = this._children.indexOf(child); let index = this._children.indexOf(child);
if (index != -1) // paranoia if (index !== -1) // paranoia
this._children.splice(index, 1); this._children.splice(index, 1);
if (child == this._highlighted) if (child === this._highlighted)
this._highlighted = null; this._highlighted = null;
} }
@ -260,7 +260,7 @@ export const Lightbox = GObject.registerClass({
* @param {Clutter.Actor=} window actor to highlight * @param {Clutter.Actor=} window actor to highlight
*/ */
highlight(window) { highlight(window) {
if (this._highlighted == window) if (this._highlighted === window)
return; return;
// Walk this._children raising and lowering actors as needed. // Walk this._children raising and lowering actors as needed.
@ -271,9 +271,9 @@ export const Lightbox = GObject.registerClass({
let below = this; let below = this;
for (let i = this._children.length - 1; i >= 0; i--) { for (let i = this._children.length - 1; i >= 0; i--) {
if (this._children[i] == window) if (this._children[i] === window)
this._container.set_child_above_sibling(this._children[i], null); this._container.set_child_above_sibling(this._children[i], null);
else if (this._children[i] == this._highlighted) else if (this._children[i] === this._highlighted)
this._container.set_child_below_sibling(this._children[i], below); this._container.set_child_below_sibling(this._children[i], below);
else else
below = this._children[i]; below = this._children[i];

View File

@ -16,7 +16,7 @@ export class LocatePointer {
_syncEnabled() { _syncEnabled() {
let enabled = this._settings.get_boolean(LOCATE_POINTER_KEY); let enabled = this._settings.get_boolean(LOCATE_POINTER_KEY);
if (enabled == !!this._ripples) if (enabled === !!this._ripples)
return; return;
if (enabled) { if (enabled) {

View File

@ -76,12 +76,12 @@ class AutoComplete extends Signals.EventEmitter {
} }
_processCompletionRequest(event) { _processCompletionRequest(event) {
if (event.completions.length == 0) if (event.completions.length === 0)
return; return;
// Unique match = go ahead and complete; multiple matches + single tab = complete the common starting string; // Unique match = go ahead and complete; multiple matches + single tab = complete the common starting string;
// multiple matches + double tab = emit a suggest event with all possible options // multiple matches + double tab = emit a suggest event with all possible options
if (event.completions.length == 1) { if (event.completions.length === 1) {
this.additionalCompletionText(event.completions[0], event.attrHead); this.additionalCompletionText(event.completions[0], event.attrHead);
this.emit('completion', {completion: event.completions[0], type: 'whole-word'}); this.emit('completion', {completion: event.completions[0], type: 'whole-word'});
} else if (event.completions.length > 1 && event.tabType === 'single') { } else if (event.completions.length > 1 && event.tabType === 'single') {
@ -115,7 +115,7 @@ class AutoComplete extends Signals.EventEmitter {
_entryKeyPressEvent(actor, event) { _entryKeyPressEvent(actor, event) {
let cursorPos = this._entry.clutter_text.get_cursor_position(); let cursorPos = this._entry.clutter_text.get_cursor_position();
let text = this._entry.get_text(); let text = this._entry.get_text();
if (cursorPos != -1) if (cursorPos !== -1)
text = text.slice(0, cursorPos); text = text.slice(0, cursorPos);
if (event.get_key_symbol() === Clutter.KEY_Tab) if (event.get_key_symbol() === Clutter.KEY_Tab)
@ -181,7 +181,7 @@ const Notebook = GObject.registerClass({
vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData)); vAdjust.connect('changed', () => this._onAdjustScopeChanged(tabData));
vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData)); vAdjust.connect('notify::value', () => this._onAdjustValueChanged(tabData));
if (this._selectedIndex == -1) if (this._selectedIndex === -1)
this.selectIndex(0); this.selectIndex(0);
} }
@ -195,7 +195,7 @@ const Notebook = GObject.registerClass({
} }
selectIndex(index) { selectIndex(index) {
if (index == this._selectedIndex) if (index === this._selectedIndex)
return; return;
if (index < 0) { if (index < 0) {
this._unselect(); this._unselect();
@ -222,7 +222,7 @@ const Notebook = GObject.registerClass({
} else { } else {
for (let i = 0; i < this._tabs.length; i++) { for (let i = 0; i < this._tabs.length; i++) {
let tabData = this._tabs[i]; let tabData = this._tabs[i];
if (tabData.child == child) { if (tabData.child === child) {
this.selectIndex(i); this.selectIndex(i);
return; return;
} }
@ -266,7 +266,7 @@ const Notebook = GObject.registerClass({
}); });
function objectToString(o) { function objectToString(o) {
if (typeof o == typeof objectToString) { if (typeof o === typeof objectToString) {
// special case this since the default is way, way too verbose // special case this since the default is way, way too verbose
return '<js function>'; return '<js function>';
} else if (o && o.toString === undefined) { } else if (o && o.toString === undefined) {
@ -441,7 +441,7 @@ class ObjInspector extends St.ScrollView {
}); });
button.connect('clicked', this.close.bind(this)); button.connect('clicked', this.close.bind(this));
hbox.add(button); hbox.add(button);
if (typeof obj == typeof {}) { if (typeof obj === typeof {}) {
let properties = []; let properties = [];
for (let propName in obj) for (let propName in obj)
properties.push(propName); properties.push(propName);
@ -671,11 +671,11 @@ const Inspector = GObject.registerClass({
case Clutter.ScrollDirection.DOWN: case Clutter.ScrollDirection.DOWN:
// select child // select child
if (this._target != this._pointerTarget) { if (this._target !== this._pointerTarget) {
let child = this._pointerTarget; let child = this._pointerTarget;
while (child) { while (child) {
let parent = child.get_parent(); let parent = child.get_parent();
if (parent == this._target) if (parent === this._target)
break; break;
child = parent; child = parent;
} }
@ -702,7 +702,7 @@ const Inspector = GObject.registerClass({
let target = global.stage.get_actor_at_pos( let target = global.stage.get_actor_at_pos(
Clutter.PickMode.ALL, stageX, stageY); Clutter.PickMode.ALL, stageX, stageY);
if (target != this._pointerTarget) if (target !== this._pointerTarget)
this._target = target; this._target = target;
this._pointerTarget = target; this._pointerTarget = target;
@ -748,7 +748,7 @@ const Extensions = GObject.registerClass({
return; return;
let extensionDisplay = this._createExtensionDisplay(extension); let extensionDisplay = this._createExtensionDisplay(extension);
if (this._numExtensions == 0) if (this._numExtensions === 0)
this._extensionsList.remove_actor(this._noExtensions); this._extensionsList.remove_actor(this._noExtensions);
this._numExtensions++; this._numExtensions++;
@ -1425,7 +1425,7 @@ class LookingGlass extends St.BoxLayout {
// If a completion is completed unambiguously, the currently-displayed completion // If a completion is completed unambiguously, the currently-displayed completion
// suggestions become irrelevant. // suggestions become irrelevant.
this._autoComplete.connect('completion', (a, e) => { this._autoComplete.connect('completion', (a, e) => {
if (e.type == 'whole-word') if (e.type === 'whole-word')
this._hideCompletions(); this._hideCompletions();
}); });
@ -1606,15 +1606,15 @@ class LookingGlass extends St.BoxLayout {
// Handle key events which are relevant for all tabs of the LookingGlass // Handle key events which are relevant for all tabs of the LookingGlass
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Escape) { if (symbol === Clutter.KEY_Escape) {
this.close(); this.close();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
// Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view // Ctrl+PgUp and Ctrl+PgDown switches tabs in the notebook view
if (event.get_state() & Clutter.ModifierType.CONTROL_MASK) { if (event.get_state() & Clutter.ModifierType.CONTROL_MASK) {
if (symbol == Clutter.KEY_Page_Up) if (symbol === Clutter.KEY_Page_Up)
this._notebook.prevTab(); this._notebook.prevTab();
else if (symbol == Clutter.KEY_Page_Down) else if (symbol === Clutter.KEY_Page_Down)
this._notebook.nextTab(); this._notebook.nextTab();
} }
return super.vfunc_key_press_event(event); return super.vfunc_key_press_event(event);

View File

@ -80,7 +80,7 @@ const MouseSpriteContent = GObject.registerClass({
} }
set texture(coglTexture) { set texture(coglTexture) {
if (this._texture == coglTexture) if (this._texture === coglTexture)
return; return;
let oldTexture = this._texture; let oldTexture = this._texture;
@ -88,8 +88,8 @@ const MouseSpriteContent = GObject.registerClass({
this.invalidate(); this.invalidate();
if (!oldTexture || !coglTexture || if (!oldTexture || !coglTexture ||
oldTexture.get_width() != coglTexture.get_width() || oldTexture.get_width() !== coglTexture.get_width() ||
oldTexture.get_height() != coglTexture.get_height()) oldTexture.get_height() !== coglTexture.get_height())
this.invalidate_size(); this.invalidate_size();
} }
}); });
@ -214,7 +214,7 @@ export class Magnifier extends Signals.EventEmitter {
isActive() { isActive() {
// Sufficient to check one ZoomRegion since Magnifier's active // Sufficient to check one ZoomRegion since Magnifier's active
// state applies to all of them. // state applies to all of them.
if (this._zoomRegions.length == 0) if (this._zoomRegions.length === 0)
return false; return false;
else else
return this._zoomRegions[0].isActive(); return this._zoomRegions[0].isActive();
@ -616,7 +616,7 @@ export class Magnifier extends Signals.EventEmitter {
if (zoomRegion) { if (zoomRegion) {
// Mag factor is accurate to two decimal places. // Mag factor is accurate to two decimal places.
let aPref = parseFloat(this._settings.get_double(MAG_FACTOR_KEY).toFixed(2)); let aPref = parseFloat(this._settings.get_double(MAG_FACTOR_KEY).toFixed(2));
if (aPref != 0.0) if (aPref !== 0.0)
zoomRegion.setMagFactor(aPref, aPref); zoomRegion.setMagFactor(aPref, aPref);
aPref = this._settings.get_enum(SCREEN_POSITION_KEY); aPref = this._settings.get_enum(SCREEN_POSITION_KEY);
@ -668,7 +668,7 @@ export class Magnifier extends Signals.EventEmitter {
if (this._zoomRegions.length) { if (this._zoomRegions.length) {
let position = this._settings.get_enum(SCREEN_POSITION_KEY); let position = this._settings.get_enum(SCREEN_POSITION_KEY);
this._zoomRegions[0].setScreenPosition(position); this._zoomRegions[0].setScreenPosition(position);
if (position != GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN) if (position !== GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN)
this._updateLensMode(); this._updateLensMode();
} }
} }
@ -825,7 +825,7 @@ class ZoomRegion {
} }
_updateScreenPosition() { _updateScreenPosition() {
if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) { if (this._screenPosition === GDesktopEnums.MagnifierScreenPosition.NONE) {
this._setViewPort({ this._setViewPort({
x: this._viewPortX, x: this._viewPortX,
y: this._viewPortY, y: this._viewPortY,
@ -899,7 +899,7 @@ class ZoomRegion {
_updateFocus(caller, event) { _updateFocus(caller, event) {
let component = event.source.get_component_iface(); let component = event.source.get_component_iface();
if (!component || event.detail1 != 1) if (!component || event.detail1 !== 1)
return; return;
let extents; let extents;
try { try {
@ -959,7 +959,7 @@ class ZoomRegion {
* @param {boolean} activate Boolean to show/hide the ZoomRegion. * @param {boolean} activate Boolean to show/hide the ZoomRegion.
*/ */
setActive(activate) { setActive(activate) {
if (activate == this.isActive()) if (activate === this.isActive())
return; return;
if (activate) { if (activate) {
@ -1061,7 +1061,7 @@ class ZoomRegion {
} }
_syncFocusTracking() { _syncFocusTracking() {
let enabled = this._focusTrackingMode != GDesktopEnums.MagnifierFocusTrackingMode.NONE && let enabled = this._focusTrackingMode !== GDesktopEnums.MagnifierFocusTrackingMode.NONE &&
this.isActive(); this.isActive();
if (enabled) if (enabled)
@ -1071,7 +1071,7 @@ class ZoomRegion {
} }
_syncCaretTracking() { _syncCaretTracking() {
let enabled = this._caretTrackingMode != GDesktopEnums.MagnifierCaretTrackingMode.NONE && let enabled = this._caretTrackingMode !== GDesktopEnums.MagnifierCaretTrackingMode.NONE &&
this.isActive(); this.isActive();
if (enabled) if (enabled)
@ -1297,7 +1297,7 @@ class ZoomRegion {
*/ */
scrollToMousePos() { scrollToMousePos() {
this._followingCursor = true; this._followingCursor = true;
if (this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE) if (this._mouseTrackingMode !== GDesktopEnums.MagnifierMouseTrackingMode.NONE)
this._changeROI({redoCursorTracking: true}); this._changeROI({redoCursorTracking: true});
else else
this._updateMousePosition(); this._updateMousePosition();
@ -1521,7 +1521,7 @@ class ZoomRegion {
} }
_destroyActors() { _destroyActors() {
if (this._mouseActor == this._mouseSourceActor) if (this._mouseActor === this._mouseSourceActor)
this._mouseActor.get_parent().remove_actor(this._mouseActor); this._mouseActor.get_parent().remove_actor(this._mouseActor);
if (this._crossHairs) if (this._crossHairs)
this._crossHairs.removeFromParent(this._crossHairsActor); this._crossHairs.removeFromParent(this._crossHairsActor);
@ -1587,7 +1587,7 @@ class ZoomRegion {
this._yMagFactor = params.yMagFactor; this._yMagFactor = params.yMagFactor;
if (params.redoCursorTracking && if (params.redoCursorTracking &&
this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE) { this._mouseTrackingMode !== GDesktopEnums.MagnifierMouseTrackingMode.NONE) {
// This depends on this.xMagFactor/yMagFactor already being updated // This depends on this.xMagFactor/yMagFactor already being updated
[params.xCenter, params.yCenter] = this._centerFromMousePosition(); [params.xCenter, params.yCenter] = this._centerFromMousePosition();
} }
@ -1640,10 +1640,10 @@ class ZoomRegion {
// doesn't necessarily imply // doesn't necessarily imply
// this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN; // this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
if (this._viewPortX != 0 || this._viewPortY != 0) if (this._viewPortX !== 0 || this._viewPortY !== 0)
return false; return false;
if (this._viewPortWidth != global.screen_width || if (this._viewPortWidth !== global.screen_width ||
this._viewPortHeight != global.screen_height) this._viewPortHeight !== global.screen_height)
return false; return false;
return true; return true;
} }
@ -1655,11 +1655,11 @@ class ZoomRegion {
let xMouse = this._magnifier.xMouse; let xMouse = this._magnifier.xMouse;
let yMouse = this._magnifier.yMouse; let yMouse = this._magnifier.yMouse;
if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL) if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.PROPORTIONAL)
return this._centerFromPointProportional(xMouse, yMouse); return this._centerFromPointProportional(xMouse, yMouse);
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.PUSH) else if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
return this._centerFromPointPush(xMouse, yMouse); return this._centerFromPointPush(xMouse, yMouse);
else if (this._mouseTrackingMode == GDesktopEnums.MagnifierMouseTrackingMode.CENTERED) else if (this._mouseTrackingMode === GDesktopEnums.MagnifierMouseTrackingMode.CENTERED)
return this._centerFromPointCentered(xMouse, yMouse); return this._centerFromPointCentered(xMouse, yMouse);
return null; // Should never be hit return null; // Should never be hit
@ -1669,11 +1669,11 @@ class ZoomRegion {
let xCaret = this._xCaret; let xCaret = this._xCaret;
let yCaret = this._yCaret; let yCaret = this._yCaret;
if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.PROPORTIONAL) if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.PROPORTIONAL)
[xCaret, yCaret] = this._centerFromPointProportional(xCaret, yCaret); [xCaret, yCaret] = this._centerFromPointProportional(xCaret, yCaret);
else if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.PUSH) else if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.PUSH)
[xCaret, yCaret] = this._centerFromPointPush(xCaret, yCaret); [xCaret, yCaret] = this._centerFromPointPush(xCaret, yCaret);
else if (this._caretTrackingMode == GDesktopEnums.MagnifierCaretTrackingMode.CENTERED) else if (this._caretTrackingMode === GDesktopEnums.MagnifierCaretTrackingMode.CENTERED)
[xCaret, yCaret] = this._centerFromPointCentered(xCaret, yCaret); [xCaret, yCaret] = this._centerFromPointCentered(xCaret, yCaret);
this._scrollContentsToDelayed(xCaret, yCaret); this._scrollContentsToDelayed(xCaret, yCaret);
@ -1683,11 +1683,11 @@ class ZoomRegion {
let xFocus = this._xFocus; let xFocus = this._xFocus;
let yFocus = this._yFocus; let yFocus = this._yFocus;
if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.PROPORTIONAL) if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.PROPORTIONAL)
[xFocus, yFocus] = this._centerFromPointProportional(xFocus, yFocus); [xFocus, yFocus] = this._centerFromPointProportional(xFocus, yFocus);
else if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.PUSH) else if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.PUSH)
[xFocus, yFocus] = this._centerFromPointPush(xFocus, yFocus); [xFocus, yFocus] = this._centerFromPointPush(xFocus, yFocus);
else if (this._focusTrackingMode == GDesktopEnums.MagnifierFocusTrackingMode.CENTERED) else if (this._focusTrackingMode === GDesktopEnums.MagnifierFocusTrackingMode.CENTERED)
[xFocus, yFocus] = this._centerFromPointCentered(xFocus, yFocus); [xFocus, yFocus] = this._centerFromPointCentered(xFocus, yFocus);
this._scrollContentsToDelayed(xFocus, yFocus); this._scrollContentsToDelayed(xFocus, yFocus);
@ -1914,7 +1914,7 @@ class Crosshairs extends Clutter.Actor {
* addToZoomRegion * addToZoomRegion
*/ */
removeFromParent(childActor) { removeFromParent(childActor) {
if (childActor == this) if (childActor === this)
childActor.get_parent().remove_actor(childActor); childActor.get_parent().remove_actor(childActor);
else else
childActor.destroy(); childActor.destroy();

View File

@ -304,14 +304,14 @@ async function _initializeUI() {
} }
layoutManager.connect('startup-complete', () => { layoutManager.connect('startup-complete', () => {
if (actionMode == Shell.ActionMode.NONE) if (actionMode === Shell.ActionMode.NONE)
actionMode = Shell.ActionMode.NORMAL; actionMode = Shell.ActionMode.NORMAL;
if (screenShield) if (screenShield)
screenShield.lockIfWasLocked(); screenShield.lockIfWasLocked();
if (sessionMode.currentMode != 'gdm' && if (sessionMode.currentMode !== 'gdm' &&
sessionMode.currentMode != 'initial-setup') { sessionMode.currentMode !== 'initial-setup') {
GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, { GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
'MESSAGE': `GNOME Shell started at ${_startDate}`, 'MESSAGE': `GNOME Shell started at ${_startDate}`,
'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID, 'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID,
@ -646,7 +646,7 @@ export function pushModal(actor, params) {
* global.get_current_time() is assumed. * global.get_current_time() is assumed.
*/ */
export function popModal(grab, timestamp) { export function popModal(grab, timestamp) {
if (timestamp == undefined) if (timestamp === undefined)
timestamp = global.get_current_time(); timestamp = global.get_current_time();
let focusIndex = _findModal(grab); let focusIndex = _findModal(grab);
@ -664,7 +664,7 @@ export function popModal(grab, timestamp) {
record.grab.dismiss(); record.grab.dismiss();
if (focusIndex == modalActorFocusStack.length - 1) { if (focusIndex === modalActorFocusStack.length - 1) {
if (record.prevFocus) if (record.prevFocus)
record.prevFocus.disconnect(record.prevFocusDestroyId); record.prevFocus.disconnect(record.prevFocusDestroyId);
actionMode = record.actionMode; actionMode = record.actionMode;
@ -752,7 +752,7 @@ export function activateWindow(window, time, workspaceNum) {
if (!time) if (!time)
time = global.get_current_time(); time = global.get_current_time();
if (windowWorkspaceNum != activeWorkspaceNum) { if (windowWorkspaceNum !== activeWorkspaceNum) {
let workspace = workspaceManager.get_workspace_by_index(windowWorkspaceNum); let workspace = workspaceManager.get_workspace_by_index(windowWorkspaceNum);
workspace.activate_with_focus(window, time); workspace.activate_with_focus(window, time);
} else { } else {
@ -811,7 +811,7 @@ function _runDeferredWork(workId) {
_deferredWorkQueue.splice(index, 1); _deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback(); _deferredWorkData[workId].callback();
if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) { if (_deferredWorkQueue.length === 0 && _deferredTimeoutId > 0) {
GLib.source_remove(_deferredTimeoutId); GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0; _deferredTimeoutId = 0;
} }
@ -832,7 +832,7 @@ function _runBeforeRedrawQueue() {
function _queueBeforeRedraw(workId) { function _queueBeforeRedraw(workId) {
_beforeRedrawQueue.push(workId); _beforeRedrawQueue.push(workId);
if (_beforeRedrawQueue.length == 1) { if (_beforeRedrawQueue.length === 1) {
const laters = global.compositor.get_laters(); const laters = global.compositor.get_laters();
laters.add(Meta.LaterType.BEFORE_REDRAW, () => { laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
_runBeforeRedrawQueue(); _runBeforeRedrawQueue();
@ -902,7 +902,7 @@ export function queueDeferredWork(workId) {
_deferredWorkQueue.push(workId); _deferredWorkQueue.push(workId);
if (data.actor.mapped) { if (data.actor.mapped) {
_queueBeforeRedraw(workId); _queueBeforeRedraw(workId);
} else if (_deferredTimeoutId == 0) { } else if (_deferredTimeoutId === 0) {
_deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => { _deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork(); _runAllDeferredWork();
_deferredTimeoutId = 0; _deferredTimeoutId = 0;

View File

@ -57,7 +57,7 @@ class URLHighlighter extends St.Label {
let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false); let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false);
if (hasColor) { if (hasColor) {
let linkColor = color.to_string().substr(0, 7); let linkColor = color.to_string().substr(0, 7);
if (linkColor != this._linkColor) { if (linkColor !== this._linkColor) {
this._linkColor = linkColor; this._linkColor = linkColor;
this._highlightUrls(); this._highlightUrls();
} }
@ -73,7 +73,7 @@ class URLHighlighter extends St.Label {
// Don't try to URL highlight when invisible. // Don't try to URL highlight when invisible.
// The MessageTray doesn't actually hide us, so // The MessageTray doesn't actually hide us, so
// we need to check for paint opacities as well. // we need to check for paint opacities as well.
if (!this.visible || this.get_paint_opacity() == 0) if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
// Keep Notification from seeing this and taking // Keep Notification from seeing this and taking
@ -83,11 +83,11 @@ class URLHighlighter extends St.Label {
} }
vfunc_button_release_event(event) { vfunc_button_release_event(event) {
if (!this.visible || this.get_paint_opacity() == 0) if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
const urlId = this._findUrlAtPos(event); const urlId = this._findUrlAtPos(event);
if (urlId != -1) { if (urlId !== -1) {
let url = this._urls[urlId].url; let url = this._urls[urlId].url;
if (!url.includes(':')) if (!url.includes(':'))
url = `http://${url}`; url = `http://${url}`;
@ -100,14 +100,14 @@ class URLHighlighter extends St.Label {
} }
vfunc_motion_event(event) { vfunc_motion_event(event) {
if (!this.visible || this.get_paint_opacity() == 0) if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
const urlId = this._findUrlAtPos(event); const urlId = this._findUrlAtPos(event);
if (urlId != -1 && !this._cursorChanged) { if (urlId !== -1 && !this._cursorChanged) {
global.display.set_cursor(Meta.Cursor.POINTING_HAND); global.display.set_cursor(Meta.Cursor.POINTING_HAND);
this._cursorChanged = true; this._cursorChanged = true;
} else if (urlId == -1) { } else if (urlId === -1) {
global.display.set_cursor(Meta.Cursor.DEFAULT); global.display.set_cursor(Meta.Cursor.DEFAULT);
this._cursorChanged = false; this._cursorChanged = false;
} }
@ -115,7 +115,7 @@ class URLHighlighter extends St.Label {
} }
vfunc_leave_event(event) { vfunc_leave_event(event) {
if (!this.visible || this.get_paint_opacity() == 0) if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (this._cursorChanged) { if (this._cursorChanged) {
@ -160,7 +160,7 @@ class URLHighlighter extends St.Label {
continue; continue;
findPos = i; findPos = i;
} }
if (findPos != -1) { if (findPos !== -1) {
for (let i = 0; i < this._urls.length; i++) { for (let i = 0; i < this._urls.length; i++) {
if (findPos >= this._urls[i].pos && if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > findPos) this._urls[i].pos + this._urls[i].url.length > findPos)
@ -179,7 +179,7 @@ class ScaleLayout extends Clutter.BinLayout {
} }
_connectContainer(container) { _connectContainer(container) {
if (this._container == container) if (this._container === container)
return; return;
this._container?.disconnectObject(this); this._container?.disconnectObject(this);
@ -234,20 +234,20 @@ const LabelExpanderLayout = GObject.registerClass({
} }
set expansion(v) { set expansion(v) {
if (v == this._expansion) if (v === this._expansion)
return; return;
this._expansion = v; this._expansion = v;
this.notify('expansion'); this.notify('expansion');
let visibleIndex = this._expansion > 0 ? 1 : 0; let visibleIndex = this._expansion > 0 ? 1 : 0;
for (let i = 0; this._container && i < this._container.get_n_children(); i++) for (let i = 0; this._container && i < this._container.get_n_children(); i++)
this._container.get_child_at_index(i).visible = i == visibleIndex; this._container.get_child_at_index(i).visible = i === visibleIndex;
this.layout_changed(); this.layout_changed();
} }
set expandLines(v) { set expandLines(v) {
if (v == this._expandLines) if (v === this._expandLines)
return; return;
this._expandLines = v; this._expandLines = v;
if (this._expansion > 0) if (this._expansion > 0)
@ -542,8 +542,8 @@ export const Message = GObject.registerClass({
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let keysym = event.get_key_symbol(); let keysym = event.get_key_symbol();
if (keysym == Clutter.KEY_Delete || if (keysym === Clutter.KEY_Delete ||
keysym == Clutter.KEY_KP_Delete) { keysym === Clutter.KEY_KP_Delete) {
if (this.canClose()) { if (this.canClose()) {
this.close(); this.close();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
@ -750,15 +750,15 @@ export const MessageListSection = GObject.registerClass({
_sync() { _sync() {
let messages = this._messages; let messages = this._messages;
let empty = messages.length == 0; let empty = messages.length === 0;
if (this._empty != empty) { if (this._empty !== empty) {
this._empty = empty; this._empty = empty;
this.notify('empty'); this.notify('empty');
} }
let canClear = messages.some(m => m.canClose()); let canClear = messages.some(m => m.canClose());
if (this._canClear != canClear) { if (this._canClear !== canClear) {
this._canClear = canClear; this._canClear = canClear;
this.notify('can-clear'); this.notify('can-clear');
} }

View File

@ -386,7 +386,7 @@ export const Notification = GObject.registerClass({
// will call .update() later on. This is the case of // will call .update() later on. This is the case of
// NotificationDaemon, which wants to use the same code // NotificationDaemon, which wants to use the same code
// for new and updated notifications // for new and updated notifications
if (arguments.length != 1) if (arguments.length !== 1)
this.update(title, banner, params); this.update(title, banner, params);
} }
@ -427,8 +427,8 @@ export const Notification = GObject.registerClass({
if (params.clear) if (params.clear)
this.actions = []; this.actions = [];
if (this._soundName != params.soundName || if (this._soundName !== params.soundName ||
this._soundFile != params.soundFile) { this._soundFile !== params.soundFile) {
this._soundName = params.soundName; this._soundName = params.soundName;
this._soundFile = params.soundFile; this._soundFile = params.soundFile;
this._soundPlayed = false; this._soundPlayed = false;
@ -707,13 +707,13 @@ export const Source = GObject.registerClass({
} }
get narrowestPrivacyScope() { get narrowestPrivacyScope() {
return this.notifications.every(n => n.privacyScope == PrivacyScope.SYSTEM) return this.notifications.every(n => n.privacyScope === PrivacyScope.SYSTEM)
? PrivacyScope.SYSTEM ? PrivacyScope.SYSTEM
: PrivacyScope.USER; : PrivacyScope.USER;
} }
setTitle(newTitle) { setTitle(newTitle) {
if (this.title == newTitle) if (this.title === newTitle)
return; return;
this.title = newTitle; this.title = newTitle;
@ -746,7 +746,7 @@ export const Source = GObject.registerClass({
this.notifications.splice(index, 1); this.notifications.splice(index, 1);
this.countUpdated(); this.countUpdated();
if (this.notifications.length == 0) if (this.notifications.length === 0)
this.destroy(); this.destroy();
} }
@ -772,7 +772,7 @@ export const Source = GObject.registerClass({
if (notification.urgency === Urgency.LOW) if (notification.urgency === Urgency.LOW)
return; return;
if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL) if (this.policy.showBanners || notification.urgency === Urgency.CRITICAL)
this.emit('notification-show', notification); this.emit('notification-show', notification);
} }
@ -935,7 +935,7 @@ export const MessageTray = GObject.registerClass({
} }
_onNotificationKeyRelease(actor, event) { _onNotificationKeyRelease(actor, event) {
if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) { if (event.get_key_symbol() === Clutter.KEY_Escape && event.get_state() === 0) {
this._expireNotification(); this._expireNotification();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -953,7 +953,7 @@ export const MessageTray = GObject.registerClass({
} }
set bannerBlocked(v) { set bannerBlocked(v) {
if (this._bannerBlocked == v) if (this._bannerBlocked === v)
return; return;
this._bannerBlocked = v; this._bannerBlocked = v;
this._updateState(); this._updateState();
@ -1003,7 +1003,7 @@ export const MessageTray = GObject.registerClass({
let wasEnabled = this.contains(source); let wasEnabled = this.contains(source);
let shouldBeEnabled = policy.enable; let shouldBeEnabled = policy.enable;
if (wasEnabled != shouldBeEnabled) { if (wasEnabled !== shouldBeEnabled) {
if (shouldBeEnabled) if (shouldBeEnabled)
this._addSource(source); this._addSource(source);
else else
@ -1029,7 +1029,7 @@ export const MessageTray = GObject.registerClass({
} }
_onNotificationShow(_source, notification) { _onNotificationShow(_source, notification) {
if (this._notification == notification) { if (this._notification === notification) {
// If a notification that is being shown is updated, we update // If a notification that is being shown is updated, we update
// how it is shown and extend the time until it auto-hides. // how it is shown and extend the time until it auto-hides.
// If a new notification is updated while it is being hidden, // If a new notification is updated while it is being hidden,
@ -1041,7 +1041,7 @@ export const MessageTray = GObject.registerClass({
// notifications, as only banner mode allows expansion. // notifications, as only banner mode allows expansion.
let bannerCount = this._notification ? 1 : 0; let bannerCount = this._notification ? 1 : 0;
let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE; let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
if (!full || notification.urgency == Urgency.CRITICAL) { if (!full || notification.urgency === Urgency.CRITICAL) {
notification.connect('destroy', notification.connect('destroy',
this._onNotificationDestroy.bind(this)); this._onNotificationDestroy.bind(this));
this._notificationQueue.push(notification); this._notificationQueue.push(notification);
@ -1064,7 +1064,7 @@ export const MessageTray = GObject.registerClass({
} }
_onNotificationHoverChanged() { _onNotificationHoverChanged() {
if (this._bannerBin.hover == this._notificationHovered) if (this._bannerBin.hover === this._notificationHovered)
return; return;
this._notificationHovered = this._bannerBin.hover; this._notificationHovered = this._bannerBin.hover;
@ -1108,11 +1108,11 @@ export const MessageTray = GObject.registerClass({
} }
_onStatusChanged(status) { _onStatusChanged(status) {
if (status == GnomeSession.PresenceStatus.BUSY) { if (status === GnomeSession.PresenceStatus.BUSY) {
// remove notification and allow the summary to be closed now // remove notification and allow the summary to be closed now
this._updateNotificationTimeout(0); this._updateNotificationTimeout(0);
this._busy = true; this._busy = true;
} else if (status != GnomeSession.PresenceStatus.IDLE) { } else if (status !== GnomeSession.PresenceStatus.IDLE) {
// We preserve the previous value of this._busy if the status turns to IDLE // We preserve the previous value of this._busy if the status turns to IDLE
// so that we don't start showing notifications queued during the BUSY state // so that we don't start showing notifications queued during the BUSY state
// as the screensaver gets activated. // as the screensaver gets activated.
@ -1182,19 +1182,19 @@ export const MessageTray = GObject.registerClass({
let hasNotifications = Main.sessionMode.hasNotifications; let hasNotifications = Main.sessionMode.hasNotifications;
if (this._notificationState == State.HIDDEN) { if (this._notificationState === State.HIDDEN) {
let nextNotification = this._notificationQueue[0] || null; let nextNotification = this._notificationQueue[0] || null;
if (hasNotifications && nextNotification) { if (hasNotifications && nextNotification) {
let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen; let limited = this._busy || Main.layoutManager.primaryMonitor.inFullscreen;
let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency == Urgency.CRITICAL; let showNextNotification = !limited || nextNotification.forFeedback || nextNotification.urgency === Urgency.CRITICAL;
if (showNextNotification) if (showNextNotification)
this._showNotification(); this._showNotification();
} }
} else if (this._notificationState === State.SHOWING || } else if (this._notificationState === State.SHOWING ||
this._notificationState === State.SHOWN) { this._notificationState === State.SHOWN) {
let expired = (this._userActiveWhileNotificationShown && let expired = (this._userActiveWhileNotificationShown &&
this._notificationTimeoutId == 0 && this._notificationTimeoutId === 0 &&
this._notification.urgency != Urgency.CRITICAL && this._notification.urgency !== Urgency.CRITICAL &&
!this._banner.focused && !this._banner.focused &&
!this._pointerInNotification) || this._notificationExpired; !this._pointerInNotification) || this._notificationExpired;
let mustClose = this._notificationRemoved || !hasNotifications || expired; let mustClose = this._notificationRemoved || !hasNotifications || expired;
@ -1272,7 +1272,7 @@ export const MessageTray = GObject.registerClass({
// We auto-expand notifications with CRITICAL urgency, or for which the relevant setting // We auto-expand notifications with CRITICAL urgency, or for which the relevant setting
// is on in the control center. // is on in the control center.
if (this._notification.urgency == Urgency.CRITICAL || if (this._notification.urgency === Urgency.CRITICAL ||
this._notification.source.policy.forceExpanded) this._notification.source.policy.forceExpanded)
this._expandBanner(true); this._expandBanner(true);
@ -1307,7 +1307,7 @@ export const MessageTray = GObject.registerClass({
} }
_showNotificationCompleted() { _showNotificationCompleted() {
if (this._notification.urgency != Urgency.CRITICAL) if (this._notification.urgency !== Urgency.CRITICAL)
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT); this._updateNotificationTimeout(NOTIFICATION_TIMEOUT);
} }
@ -1333,7 +1333,7 @@ export const MessageTray = GObject.registerClass({
// simpler.) // simpler.)
this._updateNotificationTimeout(1000); this._updateNotificationTimeout(1000);
} else if (this._useLongerNotificationLeftTimeout && !this._notificationLeftTimeoutId && } else if (this._useLongerNotificationLeftTimeout && !this._notificationLeftTimeoutId &&
(x != this._lastSeenMouseX || y != this._lastSeenMouseY)) { (x !== this._lastSeenMouseX || y !== this._lastSeenMouseY)) {
// Refresh the timeout if the notification originally // Refresh the timeout if the notification originally
// popped up under the pointer, and the pointer is hovering // popped up under the pointer, and the pointer is hovering
// inside it. // inside it.

View File

@ -105,7 +105,7 @@ export const ModalDialog = GObject.registerClass({
} }
_setState(state) { _setState(state) {
if (this._state == state) if (this._state === state)
return; return;
this._state = state; this._state = state;
@ -175,7 +175,7 @@ export const ModalDialog = GObject.registerClass({
} }
open(timestamp, onPrimary) { open(timestamp, onPrimary) {
if (this.state == State.OPENED || this.state == State.OPENING) if (this.state === State.OPENED || this.state === State.OPENING)
return true; return true;
if (!this.pushModal(timestamp)) if (!this.pushModal(timestamp))
@ -195,7 +195,7 @@ export const ModalDialog = GObject.registerClass({
} }
close(timestamp) { close(timestamp) {
if (this.state == State.CLOSED || this.state == State.CLOSING) if (this.state === State.CLOSED || this.state === State.CLOSING)
return; return;
this._setState(State.CLOSING); this._setState(State.CLOSING);
@ -276,10 +276,10 @@ export const ModalDialog = GObject.registerClass({
// immediately, but the lightbox should remain until the logout is // immediately, but the lightbox should remain until the logout is
// complete. // complete.
_fadeOutDialog(timestamp) { _fadeOutDialog(timestamp) {
if (this.state == State.CLOSED || this.state == State.CLOSING) if (this.state === State.CLOSED || this.state === State.CLOSING)
return; return;
if (this.state == State.FADED_OUT) if (this.state === State.FADED_OUT)
return; return;
this.popModal(timestamp); this.popModal(timestamp);

View File

@ -80,7 +80,7 @@ class MediaMessage extends MessageList.Message {
this._icon.add_style_class_name('fallback'); this._icon.add_style_class_name('fallback');
} }
let isPlaying = this._player.status == 'Playing'; let isPlaying = this._player.status === 'Playing';
let iconName = isPlaying let iconName = isPlaying
? 'media-playback-pause-symbolic' ? 'media-playback-pause-symbolic'
: 'media-playback-start-symbolic'; : 'media-playback-start-symbolic';
@ -236,7 +236,7 @@ export class MprisPlayer extends Signals.EventEmitter {
let visible = this._playerProxy.CanPlay; let visible = this._playerProxy.CanPlay;
if (this._visible != visible) { if (this._visible !== visible) {
this._visible = visible; this._visible = visible;
if (visible) if (visible)
this.emit('show'); this.emit('show');

View File

@ -77,9 +77,9 @@ class FdoNotificationDaemon {
_iconForNotificationData(icon) { _iconForNotificationData(icon) {
if (icon) { if (icon) {
if (icon.substr(0, 7) == 'file://') if (icon.substr(0, 7) === 'file://')
return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)}); return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)});
else if (icon[0] == '/') else if (icon[0] === '/')
return new Gio.FileIcon({file: Gio.File.new_for_path(icon)}); return new Gio.FileIcon({file: Gio.File.new_for_path(icon)});
else else
return new Gio.ThemedIcon({name: icon}); return new Gio.ThemedIcon({name: icon});
@ -90,7 +90,7 @@ class FdoNotificationDaemon {
_lookupSource(title, pid) { _lookupSource(title, pid) {
for (let i = 0; i < this._sources.length; i++) { for (let i = 0; i < this._sources.length; i++) {
let source = this._sources[i]; let source = this._sources[i];
if (source.pid == pid && source.initialTitle == title) if (source.pid === pid && source.initialTitle === title)
return source; return source;
} }
return null; return null;
@ -151,7 +151,7 @@ class FdoNotificationDaemon {
// //
// Note that empathy uses im.received for one to one chats and // Note that empathy uses im.received for one to one chats and
// x-empathy.im.mentioned for multi-user, so we're good here // x-empathy.im.mentioned for multi-user, so we're good here
if (appName == 'Empathy' && hints['category'] == 'im.received') { if (appName === 'Empathy' && hints['category'] === 'im.received') {
// Ignore replacesId since we already sent back a // Ignore replacesId since we already sent back a
// NotificationClosed for that id. // NotificationClosed for that id.
id = this._nextNotificationId++; id = this._nextNotificationId++;
@ -186,7 +186,7 @@ class FdoNotificationDaemon {
hints, hints,
timeout, timeout,
}; };
if (replacesId != 0 && this._notifications[replacesId]) { if (replacesId !== 0 && this._notifications[replacesId]) {
ndata.id = id = replacesId; ndata.id = id = replacesId;
ndata.notification = this._notifications[replacesId].notification; ndata.notification = this._notifications[replacesId].notification;
} else { } else {
@ -254,7 +254,7 @@ class FdoNotificationDaemon {
if (actions.length) { if (actions.length) {
for (let i = 0; i < actions.length - 1; i += 2) { for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i + 1]]; let [actionId, label] = [actions[i], actions[i + 1]];
if (actionId == 'default') { if (actionId === 'default') {
hasDefaultAction = true; hasDefaultAction = true;
} else { } else {
notification.addAction(label, () => { notification.addAction(label, () => {
@ -291,7 +291,7 @@ class FdoNotificationDaemon {
notification.setTransient(!!hints['transient']); notification.setTransient(!!hints['transient']);
let privacyScope = hints['x-gnome-privacy-scope'] || 'user'; let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
notification.setPrivacyScope(privacyScope == 'system' notification.setPrivacyScope(privacyScope === 'system'
? MessageTray.PrivacyScope.SYSTEM ? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER); : MessageTray.PrivacyScope.USER);
@ -392,7 +392,7 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
this.iconUpdated(); this.iconUpdated();
let tracker = Shell.WindowTracker.get_default(); let tracker = Shell.WindowTracker.get_default();
if (notification.resident && this.app && tracker.focus_app == this.app) if (notification.resident && this.app && tracker.focus_app === this.app)
this.pushNotification(notification); this.pushNotification(notification);
else else
this.showNotification(notification); this.showNotification(notification);
@ -489,7 +489,7 @@ class GtkNotificationDaemonNotification extends MessageTray.Notification {
if (priority) { if (priority) {
let urgency = PRIORITY_URGENCY_MAP[priority.unpack()]; let urgency = PRIORITY_URGENCY_MAP[priority.unpack()];
this.setUrgency(urgency != undefined ? urgency : MessageTray.Urgency.NORMAL); this.setUrgency(urgency !== undefined ? urgency : MessageTray.Urgency.NORMAL);
} else if (urgent) { } else if (urgent) {
this.setUrgency(urgent.unpack() this.setUrgency(urgent.unpack()
? MessageTray.Urgency.CRITICAL ? MessageTray.Urgency.CRITICAL
@ -707,7 +707,7 @@ class GtkNotificationDaemon {
if (value) { if (value) {
let sources = value.deepUnpack(); let sources = value.deepUnpack();
sources.forEach(([appId, notifications]) => { sources.forEach(([appId, notifications]) => {
if (notifications.length == 0) if (notifications.length === 0)
return; return;
let source; let source;

View File

@ -40,7 +40,7 @@ class OsdMonitorLabel extends St.Widget {
_position() { _position() {
let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor); let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor);
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
this._box.x = workArea.x + (workArea.width - this._box.width); this._box.x = workArea.x + (workArea.width - this._box.width);
else else
this._box.x = workArea.x; this._box.x = workArea.x;
@ -73,7 +73,7 @@ export class OsdMonitorLabeler {
_trackClient(client) { _trackClient(client) {
if (this._client) if (this._client)
return this._client == client; return this._client === client;
this._client = client; this._client = client;
this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION, this._clientWatchId = Gio.bus_watch_name(Gio.BusType.SESSION,
@ -85,7 +85,7 @@ export class OsdMonitorLabeler {
} }
_untrackClient(client) { _untrackClient(client) {
if (!this._client || this._client != client) if (!this._client || this._client !== client)
return false; return false;
Gio.bus_unwatch_name(this._clientWatchId); Gio.bus_unwatch_name(this._clientWatchId);
@ -102,7 +102,7 @@ export class OsdMonitorLabeler {
for (let connector in params) { for (let connector in params) {
let monitor = this._monitorManager.get_monitor_for_connector(connector); let monitor = this._monitorManager.get_monitor_for_connector(connector);
if (monitor == -1) if (monitor === -1)
continue; continue;
this._monitorLabels.get(monitor).push(params[connector].deepUnpack()); this._monitorLabels.get(monitor).push(params[connector].deepUnpack());
} }

View File

@ -65,15 +65,15 @@ class OsdWindow extends Clutter.Actor {
} }
setLabel(label) { setLabel(label) {
this._label.visible = label != undefined; this._label.visible = label !== undefined;
if (label) if (label)
this._label.text = label; this._label.text = label;
this._updateBoxVisibility(); this._updateBoxVisibility();
} }
setLevel(value) { setLevel(value) {
this._level.visible = value != undefined; this._level.visible = value !== undefined;
if (value != undefined) { if (value !== undefined) {
if (this.visible) { if (this.visible) {
this._level.ease_property('value', value, { this._level.ease_property('value', value, {
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
@ -154,7 +154,7 @@ export class OsdWindowManager {
_monitorsChanged() { _monitorsChanged() {
for (let i = 0; i < Main.layoutManager.monitors.length; i++) { for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
if (this._osdWindows[i] == undefined) if (this._osdWindows[i] === undefined)
this._osdWindows[i] = new OsdWindow(i); this._osdWindows[i] = new OsdWindow(i);
} }
@ -175,9 +175,9 @@ export class OsdWindowManager {
} }
show(monitorIndex, icon, label, level, maxLevel) { show(monitorIndex, icon, label, level, maxLevel) {
if (monitorIndex != -1) { if (monitorIndex !== -1) {
for (let i = 0; i < this._osdWindows.length; i++) { for (let i = 0; i < this._osdWindows.length; i++) {
if (i == monitorIndex) if (i === monitorIndex)
this._showOsdWindow(i, icon, label, level, maxLevel); this._showOsdWindow(i, icon, label, level, maxLevel);
else else
this._osdWindows[i].cancel(); this._osdWindows[i].cancel();

View File

@ -50,7 +50,7 @@ class ShellInfo {
} }
let notification = null; let notification = null;
if (this._source.notifications.length == 0) { if (this._source.notifications.length === 0) {
notification = new MessageTray.Notification(this._source, text, null); notification = new MessageTray.Notification(this._source, text, null);
notification.setTransient(true); notification.setTransient(true);
notification.setForFeedback(forFeedback); notification.setForFeedback(forFeedback);
@ -337,7 +337,7 @@ export class Overview extends Signals.EventEmitter {
} }
_resetWindowSwitchTimeout() { _resetWindowSwitchTimeout() {
if (this._windowSwitchTimeoutId != 0) { if (this._windowSwitchTimeoutId !== 0) {
GLib.source_remove(this._windowSwitchTimeoutId); GLib.source_remove(this._windowSwitchTimeoutId);
this._windowSwitchTimeoutId = 0; this._windowSwitchTimeoutId = 0;
} }
@ -352,7 +352,7 @@ export class Overview extends Signals.EventEmitter {
this._windowSwitchTimestamp = global.get_current_time(); this._windowSwitchTimestamp = global.get_current_time();
if (targetIsWindow && if (targetIsWindow &&
dragEvent.targetActor._delegate.metaWindow == this._lastHoveredWindow) dragEvent.targetActor._delegate.metaWindow === this._lastHoveredWindow)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
this._lastHoveredWindow = null; this._lastHoveredWindow = null;
@ -605,9 +605,10 @@ export class Overview extends Signals.EventEmitter {
let event = Clutter.get_current_event(); let event = Clutter.get_current_event();
if (event) { if (event) {
let type = event.type(); let type = event.type();
let button = type == Clutter.EventType.BUTTON_PRESS || const button =
type == Clutter.EventType.BUTTON_RELEASE; type === Clutter.EventType.BUTTON_PRESS ||
let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) != 0; type === Clutter.EventType.BUTTON_RELEASE;
let ctrl = (event.get_state() & Clutter.ModifierType.CONTROL_MASK) !== 0;
if (button && ctrl) if (button && ctrl)
return; return;
} }

View File

@ -72,7 +72,7 @@ const PadChooser = GObject.registerClass({
for (let i = 0; i < devices.length; i++) { for (let i = 0; i < devices.length; i++) {
let device = devices[i]; let device = devices[i];
if (device == this.currentDevice) if (device === this.currentDevice)
continue; continue;
this._padChooserMenu.addAction(device.get_device_name(), () => { this._padChooserMenu.addAction(device.get_device_name(), () => {
@ -101,7 +101,7 @@ const KeybindingEntry = GObject.registerClass({
} }
vfunc_captured_event(event) { vfunc_captured_event(event) {
if (event.type() != Clutter.EventType.KEY_PRESS) if (event.type() !== Clutter.EventType.KEY_PRESS)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
const str = Meta.accelerator_name( const str = Meta.accelerator_name(
@ -164,8 +164,8 @@ const ActionComboBox = GObject.registerClass({
}); });
/* These actions only apply to pad buttons */ /* These actions only apply to pad buttons */
if (selectedAction == GDesktopEnums.PadButtonAction.HELP || if (selectedAction === GDesktopEnums.PadButtonAction.HELP ||
selectedAction == GDesktopEnums.PadButtonAction.SWITCH_MONITOR) selectedAction === GDesktopEnums.PadButtonAction.SWITCH_MONITOR)
this._buttonItems.push(item); this._buttonItems.push(item);
} }
@ -231,7 +231,7 @@ const ActionEditor = GObject.registerClass({
} }
_updateKeybindingEntryState() { _updateKeybindingEntryState() {
if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING) { if (this._currentAction === GDesktopEnums.PadButtonAction.KEYBINDING) {
this._keybindingEdit.set_text(this._currentKeybinding); this._keybindingEdit.set_text(this._currentKeybinding);
this._keybindingEdit.show(); this._keybindingEdit.show();
this._keybindingEdit.grab_key_focus(); this._keybindingEdit.grab_key_focus();
@ -272,7 +272,7 @@ const ActionEditor = GObject.registerClass({
let keybinding = null; let keybinding = null;
if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING) if (this._currentAction === GDesktopEnums.PadButtonAction.KEYBINDING)
keybinding = this._currentKeybinding; keybinding = this._currentKeybinding;
this._buttonSettings.set_enum('action', this._currentAction); this._buttonSettings.set_enum('action', this._currentAction);
@ -423,7 +423,7 @@ const PadDiagram = GObject.registerClass({
x = x * this._scale + this._actorWidth / 2 - dimensions.width / 2 * this._scale; x = x * this._scale + this._actorWidth / 2 - dimensions.width / 2 * this._scale;
y = y * this._scale + this._actorHeight / 2 - dimensions.height / 2 * this._scale; y = y * this._scale + this._actorHeight / 2 - dimensions.height / 2 * this._scale;
if (direction == LTR) { if (direction === LTR) {
childBox.x1 = x; childBox.x1 = x;
childBox.x2 = x + natWidth; childBox.x2 = x + natWidth;
} else { } else {
@ -552,7 +552,7 @@ const PadDiagram = GObject.registerClass({
deactivateButton(button) { deactivateButton(button) {
for (let i = 0; i < this._activeButtons.length; i++) { for (let i = 0; i < this._activeButtons.length; i++) {
if (this._activeButtons[i] == button) if (this._activeButtons[i] === button)
this._activeButtons.splice(i, 1); this._activeButtons.splice(i, 1);
} }
this._invalidateSvg(); this._invalidateSvg();
@ -604,8 +604,8 @@ const PadDiagram = GObject.registerClass({
return; return;
for (let i = 0; i < this._labels.length; i++) { for (let i = 0; i < this._labels.length; i++) {
if (action == this._labels[i].action && if (action === this._labels[i].action &&
idx == this._labels[i].idx && dir == this._labels[i].dir) { idx === this._labels[i].idx && dir === this._labels[i].dir) {
this._curEdited = this._labels[i]; this._curEdited = this._labels[i];
editedLabel = this._curEdited.label; editedLabel = this._curEdited.label;
break; break;
@ -664,8 +664,8 @@ export const PadOsd = GObject.registerClass({
}, this); }, this);
seat.list_devices().forEach(device => { seat.list_devices().forEach(device => {
if (device != this.padDevice && if (device !== this.padDevice &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE && device.get_device_type() === Clutter.InputDeviceType.PAD_DEVICE &&
this.padDevice.is_grouped(device)) this.padDevice.is_grouped(device))
this._groupPads.push(device); this._groupPads.push(device);
}); });
@ -757,7 +757,7 @@ export const PadOsd = GObject.registerClass({
} }
_requestForOtherPad(pad) { _requestForOtherPad(pad) {
if (pad == this.padDevice || !this._groupPads.includes(pad)) if (pad === this.padDevice || !this._groupPads.includes(pad))
return; return;
let editionMode = this._editionMode; let editionMode = this._editionMode;
@ -781,20 +781,20 @@ export const PadOsd = GObject.registerClass({
vfunc_captured_event(event) { vfunc_captured_event(event) {
let isModeSwitch = let isModeSwitch =
(event.type() == Clutter.EventType.PAD_BUTTON_PRESS || (event.type() === Clutter.EventType.PAD_BUTTON_PRESS ||
event.type() == Clutter.EventType.PAD_BUTTON_RELEASE) && event.type() === Clutter.EventType.PAD_BUTTON_RELEASE) &&
this.padDevice.get_mode_switch_button_group(event.get_button()) >= 0; this.padDevice.get_mode_switch_button_group(event.get_button()) >= 0;
if (event.type() == Clutter.EventType.PAD_BUTTON_PRESS && if (event.type() === Clutter.EventType.PAD_BUTTON_PRESS &&
event.get_source_device() == this.padDevice) { event.get_source_device() === this.padDevice) {
this._padDiagram.activateButton(event.get_button()); this._padDiagram.activateButton(event.get_button());
/* Buttons that switch between modes cannot be edited */ /* Buttons that switch between modes cannot be edited */
if (this._editionMode && !isModeSwitch) if (this._editionMode && !isModeSwitch)
this._startButtonActionEdition(event.get_button()); this._startButtonActionEdition(event.get_button());
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (event.type() == Clutter.EventType.PAD_BUTTON_RELEASE && } else if (event.type() === Clutter.EventType.PAD_BUTTON_RELEASE &&
event.get_source_device() == this.padDevice) { event.get_source_device() === this.padDevice) {
this._padDiagram.deactivateButton(event.get_button()); this._padDiagram.deactivateButton(event.get_button());
if (isModeSwitch) { if (isModeSwitch) {
@ -802,21 +802,21 @@ export const PadOsd = GObject.registerClass({
this._updateActionLabels(); this._updateActionLabels();
} }
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (event.type() == Clutter.EventType.KEY_PRESS && } else if (event.type() === Clutter.EventType.KEY_PRESS &&
(!this._editionMode || event.get_key_symbol() === Clutter.KEY_Escape)) { (!this._editionMode || event.get_key_symbol() === Clutter.KEY_Escape)) {
if (this._editedAction != null) if (this._editedAction != null)
this._endActionEdition(); this._endActionEdition();
else else
this.destroy(); this.destroy();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (event.get_source_device() == this.padDevice && } else if (event.get_source_device() === this.padDevice &&
event.type() == Clutter.EventType.PAD_STRIP) { event.type() === Clutter.EventType.PAD_STRIP) {
if (this._editionMode) { if (this._editionMode) {
let [retval_, number, mode] = event.get_pad_event_details(); let [retval_, number, mode] = event.get_pad_event_details();
this._startStripActionEdition(number, Meta.PadDirection.UP, mode); this._startStripActionEdition(number, Meta.PadDirection.UP, mode);
} }
} else if (event.get_source_device() == this.padDevice && } else if (event.get_source_device() === this.padDevice &&
event.type() == Clutter.EventType.PAD_RING) { event.type() === Clutter.EventType.PAD_RING) {
if (this._editionMode) { if (this._editionMode) {
let [retval_, number, mode] = event.get_pad_event_details(); let [retval_, number, mode] = event.get_pad_event_details();
this._startRingActionEdition(number, Meta.PadDirection.CCW, mode); this._startRingActionEdition(number, Meta.PadDirection.CCW, mode);
@ -857,9 +857,9 @@ export const PadOsd = GObject.registerClass({
if (!this._editedAction) if (!this._editedAction)
return false; return false;
return this._editedAction.type == type && return this._editedAction.type === type &&
this._editedAction.number == number && this._editedAction.number === number &&
this._editedAction.dir == dir; this._editedAction.dir === dir;
} }
_endActionEdition() { _endActionEdition() {
@ -922,7 +922,7 @@ export const PadOsd = GObject.registerClass({
} }
setEditionMode(editionMode) { setEditionMode(editionMode) {
if (this._editionMode == editionMode) if (this._editionMode === editionMode)
return; return;
this._editionMode = editionMode; this._editionMode = editionMode;
@ -956,8 +956,8 @@ export class PadOsdService extends Signals.EventEmitter {
let padDevice = null; let padDevice = null;
devices.forEach(device => { devices.forEach(device => {
if (deviceNode == device.get_device_node() && if (deviceNode === device.get_device_node() &&
device.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE) device.get_device_type() === Clutter.InputDeviceType.PAD_DEVICE)
padDevice = device; padDevice = device;
}); });

View File

@ -14,7 +14,7 @@ export const PageIndicators = GObject.registerClass({
Signals: {'page-activated': {param_types: [GObject.TYPE_INT]}}, Signals: {'page-activated': {param_types: [GObject.TYPE_INT]}},
}, class PageIndicators extends St.BoxLayout { }, class PageIndicators extends St.BoxLayout {
_init(orientation = Clutter.Orientation.VERTICAL) { _init(orientation = Clutter.Orientation.VERTICAL) {
let vertical = orientation == Clutter.Orientation.VERTICAL; let vertical = orientation === Clutter.Orientation.VERTICAL;
super._init({ super._init({
style_class: 'page-indicators', style_class: 'page-indicators',
vertical, vertical,
@ -49,7 +49,7 @@ export const PageIndicators = GObject.registerClass({
} }
setNPages(nPages) { setNPages(nPages) {
if (this._nPages == nPages) if (this._nPages === nPages)
return; return;
let diff = nPages - this._nPages; let diff = nPages - this._nPages;

View File

@ -91,7 +91,7 @@ const AppMenuButton = GObject.registerClass({
this._iconBox.connect('style-changed', () => { this._iconBox.connect('style-changed', () => {
let themeNode = this._iconBox.get_theme_node(); let themeNode = this._iconBox.get_theme_node();
iconEffect.enabled = themeNode.get_icon_style() == St.IconStyle.SYMBOLIC; iconEffect.enabled = themeNode.get_icon_style() === St.IconStyle.SYMBOLIC;
}); });
this._label = new St.Label({ this._label = new St.Label({
@ -178,9 +178,9 @@ const AppMenuButton = GObject.registerClass({
_onAppStateChanged(appSys, app) { _onAppStateChanged(appSys, app) {
let state = app.state; let state = app.state;
if (state != Shell.AppState.STARTING) if (state !== Shell.AppState.STARTING)
this._startingApps = this._startingApps.filter(a => a != app); this._startingApps = this._startingApps.filter(a => a !== app);
else if (state == Shell.AppState.STARTING) else if (state === Shell.AppState.STARTING)
this._startingApps.push(app); this._startingApps.push(app);
// For now just resync on all running state changes; this is mainly to handle // For now just resync on all running state changes; this is mainly to handle
// cases where the focused window's application changes without the focus // cases where the focused window's application changes without the focus
@ -221,7 +221,7 @@ const AppMenuButton = GObject.registerClass({
_sync() { _sync() {
let targetApp = this._findTargetApp(); let targetApp = this._findTargetApp();
if (this._targetApp != targetApp) { if (this._targetApp !== targetApp) {
this._targetApp?.disconnectObject(this); this._targetApp?.disconnectObject(this);
this._targetApp = targetApp; this._targetApp = targetApp;
@ -242,7 +242,7 @@ const AppMenuButton = GObject.registerClass({
this.fadeOut(); this.fadeOut();
let isBusy = this._targetApp != null && let isBusy = this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING || (this._targetApp.get_state() === Shell.AppState.STARTING ||
this._targetApp.get_busy()); this._targetApp.get_busy());
if (isBusy) if (isBusy)
this.startAnimation(); this.startAnimation();
@ -287,10 +287,10 @@ class ActivitiesButton extends PanelMenu.Button {
} }
handleDragOver(source, _actor, _x, _y, _time) { handleDragOver(source, _actor, _x, _y, _time) {
if (source != Main.xdndHandler) if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
if (this._xdndTimeOut != 0) if (this._xdndTimeOut !== 0)
GLib.source_remove(this._xdndTimeOut); GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => { this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview(); this._xdndToggleOverview();
@ -301,8 +301,8 @@ class ActivitiesButton extends PanelMenu.Button {
} }
vfunc_event(event) { vfunc_event(event) {
if (event.type() == Clutter.EventType.TOUCH_END || if (event.type() === Clutter.EventType.TOUCH_END ||
event.type() == Clutter.EventType.BUTTON_RELEASE) { event.type() === Clutter.EventType.BUTTON_RELEASE) {
if (Main.overview.shouldToggleByCornerOrButton()) if (Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle(); Main.overview.toggle();
} }
@ -312,7 +312,7 @@ class ActivitiesButton extends PanelMenu.Button {
vfunc_key_release_event(event) { vfunc_key_release_event(event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) { if (symbol === Clutter.KEY_Return || symbol === Clutter.KEY_space) {
if (Main.overview.shouldToggleByCornerOrButton()) { if (Main.overview.shouldToggleByCornerOrButton()) {
Main.overview.toggle(); Main.overview.toggle();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
@ -326,7 +326,7 @@ class ActivitiesButton extends PanelMenu.Button {
let [x, y] = global.get_pointer(); let [x, y] = global.get_pointer();
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y); let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton()) if (pickedActor === this && Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle(); Main.overview.toggle();
GLib.source_remove(this._xdndTimeOut); GLib.source_remove(this._xdndTimeOut);
@ -542,7 +542,7 @@ class Panel extends St.Widget {
childBox.y1 = 0; childBox.y1 = 0;
childBox.y2 = allocHeight; childBox.y2 = allocHeight;
if (this.get_text_direction() == Clutter.TextDirection.RTL) { if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = Math.max( childBox.x1 = Math.max(
allocWidth - Math.min(Math.floor(sideWidth), leftNaturalWidth), allocWidth - Math.min(Math.floor(sideWidth), leftNaturalWidth),
0); 0);
@ -561,7 +561,7 @@ class Panel extends St.Widget {
childBox.y1 = 0; childBox.y1 = 0;
childBox.y2 = allocHeight; childBox.y2 = allocHeight;
if (this.get_text_direction() == Clutter.TextDirection.RTL) { if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = 0; childBox.x1 = 0;
childBox.x2 = Math.min(Math.floor(sideWidth), rightNaturalWidth); childBox.x2 = Math.min(Math.floor(sideWidth), rightNaturalWidth);
} else { } else {
@ -610,7 +610,7 @@ class Panel extends St.Widget {
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Escape) { if (symbol === Clutter.KEY_Escape) {
global.display.focus_default_window(event.get_time()); global.display.focus_default_window(event.get_time());
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -785,7 +785,7 @@ class Panel extends St.Widget {
else if (this._rightBox.contains(indicator.container)) else if (this._rightBox.contains(indicator.container))
boxAlignment = Clutter.ActorAlign.END; boxAlignment = Clutter.ActorAlign.END;
if (boxAlignment == Main.messageTray.bannerAlignment) if (boxAlignment === Main.messageTray.bannerAlignment)
Main.messageTray.bannerBlocked = isOpen; Main.messageTray.bannerBlocked = isOpen;
}); });
} }
@ -800,7 +800,7 @@ class Panel extends St.Widget {
let rect = metaWindow.get_frame_rect(); let rect = metaWindow.get_frame_rect();
return metaWindow.is_on_primary_monitor() && return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() && metaWindow.showing_on_its_workspace() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP && metaWindow.get_window_type() !== Meta.WindowType.DESKTOP &&
metaWindow.maximized_vertically && metaWindow.maximized_vertically &&
stageX > rect.x && stageX < rect.x + rect.width; stageX > rect.x && stageX < rect.x + rect.width;
}); });

View File

@ -139,8 +139,8 @@ export const Button = GObject.registerClass({
vfunc_event(event) { vfunc_event(event) {
if (this.menu && if (this.menu &&
(event.type() == Clutter.EventType.TOUCH_BEGIN || (event.type() === Clutter.EventType.TOUCH_BEGIN ||
event.type() == Clutter.EventType.BUTTON_PRESS)) event.type() === Clutter.EventType.BUTTON_PRESS))
this.menu.toggle(); this.menu.toggle();
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -158,10 +158,10 @@ export const Button = GObject.registerClass({
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) { if (symbol === Clutter.KEY_Left || symbol === Clutter.KEY_Right) {
let group = global.focus_manager.get_group(this); let group = global.focus_manager.get_group(this);
if (group) { if (group) {
let direction = symbol == Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT; let direction = symbol === Clutter.KEY_Left ? St.DirectionType.LEFT : St.DirectionType.RIGHT;
group.navigate_focus(this, direction, false); group.navigate_focus(this, direction, false);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }

View File

@ -33,7 +33,7 @@ const PieTimer = GObject.registerClass({
} }
set angle(angle) { set angle(angle) {
if (this._angle == angle) if (this._angle === angle)
return; return;
this._angle = angle; this._angle = angle;
@ -121,7 +121,7 @@ export class PointerA11yTimeout {
this._pieTimer.start(x, y, timeout); this._pieTimer.start(x, y, timeout);
if (type == Clutter.PointerA11yTimeoutType.GESTURE) if (type === Clutter.PointerA11yTimeoutType.GESTURE)
global.display.set_cursor(Meta.Cursor.CROSSHAIR); global.display.set_cursor(Meta.Cursor.CROSSHAIR);
}); });
@ -129,7 +129,7 @@ export class PointerA11yTimeout {
if (!clicked) if (!clicked)
this._pieTimer.destroy(); this._pieTimer.destroy();
if (type == Clutter.PointerA11yTimeoutType.GESTURE) if (type === Clutter.PointerA11yTimeoutType.GESTURE)
global.display.set_cursor(Meta.Cursor.DEFAULT); global.display.set_cursor(Meta.Cursor.DEFAULT);
}); });
} }

View File

@ -67,7 +67,7 @@ class PointerWatcher {
_removeWatch(watch) { _removeWatch(watch) {
for (let i = 0; i < this._watches.length; i++) { for (let i = 0; i < this._watches.length; i++) {
if (this._watches[i] == watch) { if (this._watches[i] === watch) {
this._watches.splice(i, 1); this._watches.splice(i, 1);
this._updateTimeout(); this._updateTimeout();
return; return;
@ -93,7 +93,7 @@ class PointerWatcher {
this._timeoutId = 0; this._timeoutId = 0;
} }
if (this._idle || this._watches.length == 0) if (this._idle || this._watches.length === 0)
return; return;
let minInterval = this._watches[0].interval; let minInterval = this._watches[0].interval;
@ -112,7 +112,7 @@ class PointerWatcher {
_updatePointer() { _updatePointer() {
let [x, y] = global.get_pointer(); let [x, y] = global.get_pointer();
if (this.pointerX == x && this.pointerY == y) if (this.pointerX === x && this.pointerY === y)
return; return;
this.pointerX = x; this.pointerX = x;
@ -121,7 +121,7 @@ class PointerWatcher {
for (let i = 0; i < this._watches.length;) { for (let i = 0; i < this._watches.length;) {
let watch = this._watches[i]; let watch = this._watches[i];
watch.callback(x, y); watch.callback(x, y);
if (watch == this._watches[i]) // guard against self-removal if (watch === this._watches[i]) // guard against self-removal
i++; i++;
} }
} }

View File

@ -163,7 +163,7 @@ export const PopupBaseMenuItem = GObject.registerClass({
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) { if (symbol === Clutter.KEY_space || symbol === Clutter.KEY_Return) {
this.activate(event); this.activate(event);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -189,7 +189,7 @@ export const PopupBaseMenuItem = GObject.registerClass({
} }
set active(active) { set active(active) {
let activeChanged = active != this.active; let activeChanged = active !== this.active;
if (activeChanged) { if (activeChanged) {
this._active = active; this._active = active;
if (active) { if (active) {
@ -224,7 +224,7 @@ export const PopupBaseMenuItem = GObject.registerClass({
} }
setSensitive(sensitive) { setSensitive(sensitive) {
if (this._sensitive == sensitive) if (this._sensitive === sensitive)
return; return;
this._sensitive = sensitive; this._sensitive = sensitive;
@ -245,13 +245,13 @@ export const PopupBaseMenuItem = GObject.registerClass({
this._ornament = ornament; this._ornament = ornament;
if (ornament == Ornament.DOT) { if (ornament === Ornament.DOT) {
this._ornamentIcon.icon_name = 'ornament-dot-symbolic'; this._ornamentIcon.icon_name = 'ornament-dot-symbolic';
this.add_accessible_state(Atk.StateType.CHECKED); this.add_accessible_state(Atk.StateType.CHECKED);
} else if (ornament == Ornament.CHECK) { } else if (ornament === Ornament.CHECK) {
this._ornamentIcon.icon_name = 'ornament-check-symbolic'; this._ornamentIcon.icon_name = 'ornament-check-symbolic';
this.add_accessible_state(Atk.StateType.CHECKED); this.add_accessible_state(Atk.StateType.CHECKED);
} else if (ornament == Ornament.NONE || ornament == Ornament.HIDDEN) { } else if (ornament === Ornament.NONE || ornament === Ornament.HIDDEN) {
this._ornamentIcon.icon_name = ''; this._ornamentIcon.icon_name = '';
this.remove_accessible_state(Atk.StateType.CHECKED); this.remove_accessible_state(Atk.StateType.CHECKED);
} }
@ -311,7 +311,7 @@ class PopupSeparatorMenuItem extends PopupBaseMenuItem {
} }
_syncVisibility() { _syncVisibility() {
this.label.visible = this.label.text != ''; this.label.visible = this.label.text !== '';
} }
}); });
@ -409,8 +409,8 @@ export const PopupSwitchMenuItem = GObject.registerClass({
// we allow pressing space to toggle the switch // we allow pressing space to toggle the switch
// without closing the menu // without closing the menu
if (event.type() == Clutter.EventType.KEY_PRESS && if (event.type() === Clutter.EventType.KEY_PRESS &&
event.get_key_symbol() == Clutter.KEY_space) event.get_key_symbol() === Clutter.KEY_space)
return; return;
super.activate(event); super.activate(event);
@ -549,7 +549,7 @@ export class PopupMenuBase extends Signals.EventEmitter {
addAction(title, callback, icon) { addAction(title, callback, icon) {
let menuItem; let menuItem;
if (icon != undefined) if (icon !== undefined)
menuItem = new PopupImageMenuItem(title, icon); menuItem = new PopupImageMenuItem(title, icon);
else else
menuItem = new PopupMenuItem(title); menuItem = new PopupMenuItem(title);
@ -600,14 +600,14 @@ export class PopupMenuBase extends Signals.EventEmitter {
} }
itemActivated(animate) { itemActivated(animate) {
if (animate == undefined) if (animate === undefined)
animate = BoxPointer.PopupAnimation.FULL; animate = BoxPointer.PopupAnimation.FULL;
this._getTopMenu().close(animate); this._getTopMenu().close(animate);
} }
_subMenuActiveChanged(submenu, submenuItem) { _subMenuActiveChanged(submenu, submenuItem) {
if (this._activeMenuItem && this._activeMenuItem != submenuItem) if (this._activeMenuItem && this._activeMenuItem !== submenuItem)
this._activeMenuItem.active = false; this._activeMenuItem.active = false;
this._activeMenuItem = submenuItem; this._activeMenuItem = submenuItem;
this.emit('active-changed', submenuItem); this.emit('active-changed', submenuItem);
@ -692,13 +692,13 @@ export class PopupMenuBase extends Signals.EventEmitter {
let i = 0; let i = 0;
while (i < items.length && position > 0) { while (i < items.length && position > 0) {
if (items[i] != menuItem) if (items[i] !== menuItem)
position--; position--;
i++; i++;
} }
if (i < items.length) { if (i < items.length) {
if (items[i] != menuItem) if (items[i] !== menuItem)
this.box.set_child_below_sibling(menuItem.actor, items[i].actor); this.box.set_child_below_sibling(menuItem.actor, items[i].actor);
} else { } else {
this.box.set_child_above_sibling(menuItem.actor, null); this.box.set_child_above_sibling(menuItem.actor, null);
@ -707,7 +707,7 @@ export class PopupMenuBase extends Signals.EventEmitter {
addMenuItem(menuItem, position) { addMenuItem(menuItem, position) {
let beforeItem = null; let beforeItem = null;
if (position == undefined) { if (position === undefined) {
this.box.add(menuItem.actor); this.box.add(menuItem.actor);
} else { } else {
let items = this._getMenuItems(); let items = this._getMenuItems();
@ -884,10 +884,10 @@ export class PopupMenu extends PopupMenuBase {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) { if (symbol === Clutter.KEY_space || symbol === Clutter.KEY_Return) {
this.toggle(); this.toggle();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (symbol == navKey) { } else if (symbol === navKey) {
if (!this.isOpen) if (!this.isOpen)
this.toggle(); this.toggle();
this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false); this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
@ -1064,7 +1064,7 @@ export class PopupSubMenu extends PopupMenuBase {
if (animate && needsScrollbar) if (animate && needsScrollbar)
animate = false; animate = false;
let targetAngle = this.actor.text_direction == Clutter.TextDirection.RTL ? -90 : 90; let targetAngle = this.actor.text_direction === Clutter.TextDirection.RTL ? -90 : 90;
if (animate) { if (animate) {
let [, naturalHeight] = this.actor.get_preferred_height(-1); let [, naturalHeight] = this.actor.get_preferred_height(-1);
@ -1122,7 +1122,7 @@ export class PopupSubMenu extends PopupMenuBase {
_onKeyPressEvent(actor, event) { _onKeyPressEvent(actor, event) {
// Move focus back to parent menu if the user types Left. // Move focus back to parent menu if the user types Left.
if (this.isOpen && event.get_key_symbol() == Clutter.KEY_Left) { if (this.isOpen && event.get_key_symbol() === Clutter.KEY_Left) {
this.close(BoxPointer.PopupAnimation.FULL); this.close(BoxPointer.PopupAnimation.FULL);
this.sourceActor._delegate.active = true; this.sourceActor._delegate.active = true;
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
@ -1249,11 +1249,11 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem {
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Right) { if (symbol === Clutter.KEY_Right) {
this._setOpenState(true); this._setOpenState(true);
this.menu.actor.navigate_focus(null, St.DirectionType.DOWN, false); this.menu.actor.navigate_focus(null, St.DirectionType.DOWN, false);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (symbol == Clutter.KEY_Left && this._getOpenState()) { } else if (symbol === Clutter.KEY_Left && this._getOpenState()) {
this._setOpenState(false); this._setOpenState(false);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -1296,7 +1296,7 @@ export class PopupMenuManager {
menu.actor.connectObject('captured-event', menu.actor.connectObject('captured-event',
this._onCapturedEvent.bind(this), this); this._onCapturedEvent.bind(this), this);
if (position == undefined) if (position === undefined)
this._menus.push(menu); this._menus.push(menu);
else else
this._menus.splice(position, 0, menu); this._menus.splice(position, 0, menu);
@ -1309,7 +1309,7 @@ export class PopupMenuManager {
} }
const position = this._menus.indexOf(menu); const position = this._menus.indexOf(menu);
if (position == -1) // not a menu we manage if (position === -1) // not a menu we manage
return; return;
menu.disconnectObject(this); menu.disconnectObject(this);

View File

@ -170,7 +170,7 @@ export function loadRemoteSearchProviders(searchSettings) {
idxB = sortOrder.indexOf(appIdB); idxB = sortOrder.indexOf(appIdB);
// if no provider is found in the order, use alphabetical order // if no provider is found in the order, use alphabetical order
if ((idxA == -1) && (idxB == -1)) { if ((idxA === -1) && (idxB === -1)) {
let nameA = providerA.appInfo.get_name(); let nameA = providerA.appInfo.get_name();
let nameB = providerB.appInfo.get_name(); let nameB = providerB.appInfo.get_name();
@ -178,11 +178,11 @@ export function loadRemoteSearchProviders(searchSettings) {
} }
// if providerA isn't found, it's sorted after providerB // if providerA isn't found, it's sorted after providerB
if (idxA == -1) if (idxA === -1)
return 1; return 1;
// if providerB isn't found, it's sorted after providerA // if providerB isn't found, it's sorted after providerA
if (idxB == -1) if (idxB === -1)
return -1; return -1;
// finally, if both providers are found, return their order in the list // finally, if both providers are found, return their order in the list

View File

@ -104,7 +104,7 @@ class RunDialog extends ModalDialog.ModalDialog {
if (symbol === Clutter.KEY_Tab) { if (symbol === Clutter.KEY_Tab) {
let text = o.get_text(); let text = o.get_text();
let prefix; let prefix;
if (text.lastIndexOf(' ') == -1) if (text.lastIndexOf(' ') === -1)
prefix = text; prefix = text;
else else
prefix = text.substr(text.lastIndexOf(' ') + 1); prefix = text.substr(text.lastIndexOf(' ') + 1);
@ -138,10 +138,10 @@ class RunDialog extends ModalDialog.ModalDialog {
let k = 0; let k = 0;
for (; k < s1.length && k < s2.length; k++) { for (; k < s1.length && k < s2.length; k++) {
if (s1[k] != s2[k]) if (s1[k] !== s2[k])
break; break;
} }
if (k == 0) if (k === 0)
return ''; return '';
return s1.substr(0, k); return s1.substr(0, k);
} }
@ -156,7 +156,7 @@ class RunDialog extends ModalDialog.ModalDialog {
let info; let info;
while ((info = fileEnum.next_file(null))) { while ((info = fileEnum.next_file(null))) {
let name = info.get_name(); let name = info.get_name();
if (name.slice(0, text.length) == text) if (name.slice(0, text.length) === text)
results.push(name); results.push(name);
} }
} catch (e) { } catch (e) {
@ -205,10 +205,10 @@ class RunDialog extends ModalDialog.ModalDialog {
} catch (e) { } catch (e) {
// Mmmh, that failed - see if @input matches an existing file // Mmmh, that failed - see if @input matches an existing file
let path = null; let path = null;
if (input.charAt(0) == '/') { if (input.charAt(0) === '/') {
path = input; path = input;
} else if (input) { } else if (input) {
if (input.charAt(0) == '~') if (input.charAt(0) === '~')
input = input.slice(1); input = input.slice(1);
path = `${GLib.get_home_dir()}/${input}`; path = `${GLib.get_home_dir()}/${input}`;
} }

View File

@ -159,7 +159,7 @@ export class ScreenShield extends Signals.EventEmitter {
let prevIsActive = this._isActive; let prevIsActive = this._isActive;
this._isActive = active; this._isActive = active;
if (prevIsActive != this._isActive) if (prevIsActive !== this._isActive)
this.emit('active-changed'); this.emit('active-changed');
this._syncInhibitor(); this._syncInhibitor();
@ -254,7 +254,7 @@ export class ScreenShield extends Signals.EventEmitter {
} }
_onStatusChanged(status) { _onStatusChanged(status) {
if (status != GnomeSession.PresenceStatus.IDLE) if (status !== GnomeSession.PresenceStatus.IDLE)
return; return;
this._maybeCancelDialog(); this._maybeCancelDialog();
@ -278,7 +278,7 @@ export class ScreenShield extends Signals.EventEmitter {
return; return;
} }
if (this._activationTime == 0) if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time(); this._activationTime = GLib.get_monotonic_time();
let shouldLock = this._settings.get_boolean(LOCK_ENABLED_KEY) && !this._isLocked; let shouldLock = this._settings.get_boolean(LOCK_ENABLED_KEY) && !this._isLocked;
@ -305,7 +305,7 @@ export class ScreenShield extends Signals.EventEmitter {
Main.uiGroup.set_child_above_sibling(lightbox, null); Main.uiGroup.set_child_above_sibling(lightbox, null);
lightbox.lightOn(time); lightbox.lightOn(time);
if (this._becameActiveId == 0) if (this._becameActiveId === 0)
this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this)); this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this));
} }
@ -390,7 +390,7 @@ export class ScreenShield extends Signals.EventEmitter {
} }
_hideLockScreen(animate) { _hideLockScreen(animate) {
if (this._lockScreenState == MessageTray.State.HIDDEN) if (this._lockScreenState === MessageTray.State.HIDDEN)
return; return;
this._lockScreenState = MessageTray.State.HIDING; this._lockScreenState = MessageTray.State.HIDING;
@ -462,7 +462,7 @@ export class ScreenShield extends Signals.EventEmitter {
// This prevents the shield going down if the lock-delay timeout // This prevents the shield going down if the lock-delay timeout
// fires while the user is dragging (which has the potential // fires while the user is dragging (which has the potential
// to confuse our state) // to confuse our state)
if (this._lockScreenState != MessageTray.State.HIDDEN) if (this._lockScreenState !== MessageTray.State.HIDDEN)
return; return;
this._lockScreenGroup.show(); this._lockScreenGroup.show();
@ -544,7 +544,7 @@ export class ScreenShield extends Signals.EventEmitter {
_continueDeactivate(animate) { _continueDeactivate(animate) {
this._hideLockScreen(animate); this._hideLockScreen(animate);
if (Main.sessionMode.currentMode == 'unlock-dialog') if (Main.sessionMode.currentMode === 'unlock-dialog')
Main.sessionMode.popMode('unlock-dialog'); Main.sessionMode.popMode('unlock-dialog');
this.emit('wake-up-screen'); this.emit('wake-up-screen');
@ -590,12 +590,12 @@ export class ScreenShield extends Signals.EventEmitter {
this.actor.hide(); this.actor.hide();
if (this._becameActiveId != 0) { if (this._becameActiveId !== 0) {
this.idleMonitor.remove_watch(this._becameActiveId); this.idleMonitor.remove_watch(this._becameActiveId);
this._becameActiveId = 0; this._becameActiveId = 0;
} }
if (this._lockTimeoutId != 0) { if (this._lockTimeoutId !== 0) {
GLib.source_remove(this._lockTimeoutId); GLib.source_remove(this._lockTimeoutId);
this._lockTimeoutId = 0; this._lockTimeoutId = 0;
} }
@ -607,7 +607,7 @@ export class ScreenShield extends Signals.EventEmitter {
} }
activate(animate) { activate(animate) {
if (this._activationTime == 0) if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time(); this._activationTime = GLib.get_monotonic_time();
if (!this._ensureUnlockDialog(true)) if (!this._ensureUnlockDialog(true))

View File

@ -2377,7 +2377,7 @@ export class ScreenshotService {
} }
_createStream(filename, invocation) { _createStream(filename, invocation) {
if (filename == '') if (filename === '')
return [Gio.MemoryOutputStream.new_resizable(), null]; return [Gio.MemoryOutputStream.new_resizable(), null];
if (GLib.path_is_absolute(filename)) { if (GLib.path_is_absolute(filename)) {
@ -2664,7 +2664,7 @@ class SelectArea extends St.Widget {
} }
vfunc_motion_event(event) { vfunc_motion_event(event) {
if (this._startX == -1 || this._startY == -1 || this._result) if (this._startX === -1 || this._startY === -1 || this._result)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
[this._lastX, this._lastY] = event.get_coords(); [this._lastX, this._lastY] = event.get_coords();

View File

@ -232,7 +232,7 @@ function _collect(scriptModule, outputFile) {
Shell.write_string_to_stream(out, ',\n"monitors":\n['); Shell.write_string_to_stream(out, ',\n"monitors":\n[');
for (let i = 0; i < monitors.length; i++) { for (let i = 0; i < monitors.length; i++) {
let monitor = monitors[i]; let monitor = monitors[i];
if (i != 0) if (i !== 0)
Shell.write_string_to_stream(out, ', '); Shell.write_string_to_stream(out, ', ');
const prefix = i === primary ? '*' : ''; const prefix = i === primary ? '*' : '';
Shell.write_string_to_stream(out, Shell.write_string_to_stream(out,

View File

@ -205,7 +205,7 @@ const SearchResultsBase = GObject.registerClass({
} }
_keyFocusIn(actor) { _keyFocusIn(actor) {
if (this._focusChild == actor) if (this._focusChild === actor)
return; return;
this._focusChild = actor; this._focusChild = actor;
this.notify('focus-child'); this.notify('focus-child');
@ -249,7 +249,7 @@ const SearchResultsBase = GObject.registerClass({
async updateSearch(providerResults, terms, callback) { async updateSearch(providerResults, terms, callback) {
this._terms = terms; this._terms = terms;
if (providerResults.length == 0) { if (providerResults.length === 0) {
this._clearResultDisplay(); this._clearResultDisplay();
this.hide(); this.hide();
callback(); callback();
@ -511,7 +511,7 @@ class GridSearchResults extends SearchResultsBase {
_getMaxDisplayedResults() { _getMaxDisplayedResults() {
let width = this.allocation.get_width(); let width = this.allocation.get_width();
if (width == 0) if (width === 0)
return -1; return -1;
return this._grid.layout_manager.columnsForWidth(width); return this._grid.layout_manager.columnsForWidth(width);
@ -709,7 +709,7 @@ export const SearchResultsView = GObject.registerClass({
// search while the previous search is still active. // search while the previous search is still active.
let searchString = terms.join(' '); let searchString = terms.join(' ');
let previousSearchString = this._terms.join(' '); let previousSearchString = this._terms.join(' ');
if (searchString == previousSearchString) if (searchString === previousSearchString)
return; return;
this._startingSearch = true; this._startingSearch = true;
@ -717,20 +717,20 @@ export const SearchResultsView = GObject.registerClass({
this._cancellable.cancel(); this._cancellable.cancel();
this._cancellable.reset(); this._cancellable.reset();
if (terms.length == 0) { if (terms.length === 0) {
this._reset(); this._reset();
return; return;
} }
let isSubSearch = false; let isSubSearch = false;
if (this._terms.length > 0) if (this._terms.length > 0)
isSubSearch = searchString.indexOf(previousSearchString) == 0; isSubSearch = searchString.indexOf(previousSearchString) === 0;
this._terms = terms; this._terms = terms;
this._isSubSearch = isSubSearch; this._isSubSearch = isSubSearch;
this._updateSearchProgress(); this._updateSearchProgress();
if (this._searchTimeoutId == 0) if (this._searchTimeoutId === 0)
this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this)); this._searchTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 150, this._onSearchTimeout.bind(this));
this._highlighter = new Highlighter(this._terms); this._highlighter = new Highlighter(this._terms);
@ -789,7 +789,7 @@ export const SearchResultsView = GObject.registerClass({
} }
} }
if (newDefaultResult != this._defaultResult) { if (newDefaultResult !== this._defaultResult) {
this._setSelected(this._defaultResult, false); this._setSelected(this._defaultResult, false);
this._setSelected(newDefaultResult, this._highlightDefault); this._setSelected(newDefaultResult, this._highlightDefault);
@ -857,12 +857,12 @@ export const SearchResultsView = GObject.registerClass({
} }
navigateFocus(direction) { navigateFocus(direction) {
let rtl = this.get_text_direction() == Clutter.TextDirection.RTL; let rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
if (direction == St.DirectionType.TAB_BACKWARD || if (direction === St.DirectionType.TAB_BACKWARD ||
direction == (rtl direction === (rtl
? St.DirectionType.RIGHT ? St.DirectionType.RIGHT
: St.DirectionType.LEFT) || : St.DirectionType.LEFT) ||
direction == St.DirectionType.UP) { direction === St.DirectionType.UP) {
this.navigate_focus(null, direction, false); this.navigate_focus(null, direction, false);
return; return;
} }
@ -943,7 +943,7 @@ class ProviderInfo extends St.Button {
animateLaunch() { animateLaunch() {
let appSys = Shell.AppSystem.get_default(); let appSys = Shell.AppSystem.get_default();
let app = appSys.lookup_app(this.provider.appInfo.get_id()); let app = appSys.lookup_app(this.provider.appInfo.get_id());
if (app.state == Shell.AppState.STOPPED) if (app.state === Shell.AppState.STOPPED)
IconGrid.zoomOutActor(this._content); IconGrid.zoomOutActor(this._content);
} }

View File

@ -105,7 +105,7 @@ const _modes = {
function _loadMode(file, info) { function _loadMode(file, info) {
let name = info.get_name(); let name = info.get_name();
let suffix = name.indexOf('.json'); let suffix = name.indexOf('.json');
let modeName = suffix == -1 ? name : name.slice(name, suffix); let modeName = suffix === -1 ? name : name.slice(name, suffix);
if (Object.prototype.hasOwnProperty.call(_modes, modeName)) if (Object.prototype.hasOwnProperty.call(_modes, modeName))
return; return;
@ -171,7 +171,7 @@ export class SessionMode extends Signals.EventEmitter {
} }
popMode(mode) { popMode(mode) {
if (this.currentMode != mode || this._modeStack.length === 1) if (this.currentMode !== mode || this._modeStack.length === 1)
throw new Error('Invalid SessionMode.popMode'); throw new Error('Invalid SessionMode.popMode');
console.debug(`sessionMode: Popping mode ${mode}`); console.debug(`sessionMode: Popping mode ${mode}`);
@ -180,7 +180,7 @@ export class SessionMode extends Signals.EventEmitter {
} }
switchMode(to) { switchMode(to) {
if (this.currentMode == to) if (this.currentMode === to)
return; return;
this._modeStack[this._modeStack.length - 1] = to; this._modeStack[this._modeStack.length - 1] = to;
this._sync(); this._sync();

View File

@ -70,7 +70,7 @@ export class GnomeShell {
try { try {
returnValue = JSON.stringify(eval(code)); returnValue = JSON.stringify(eval(code));
// A hack; DBus doesn't have null/undefined // A hack; DBus doesn't have null/undefined
if (returnValue == undefined) if (returnValue === undefined)
returnValue = ''; returnValue = '';
success = true; success = true;
} catch (e) { } catch (e) {
@ -294,7 +294,7 @@ export class GnomeShell {
_grabAcceleratorForSender(accelerator, modeFlags, grabFlags, sender) { _grabAcceleratorForSender(accelerator, modeFlags, grabFlags, sender) {
let bindingAction = global.display.grab_accelerator(accelerator, grabFlags); let bindingAction = global.display.grab_accelerator(accelerator, grabFlags);
if (bindingAction == Meta.KeyBindingAction.NONE) if (bindingAction === Meta.KeyBindingAction.NONE)
return Meta.KeyBindingAction.NONE; return Meta.KeyBindingAction.NONE;
let bindingName = Meta.external_binding_name_for_action(bindingAction); let bindingName = Meta.external_binding_name_for_action(bindingAction);
@ -321,7 +321,7 @@ export class GnomeShell {
_ungrabAcceleratorForSender(action, sender) { _ungrabAcceleratorForSender(action, sender) {
let grabbedBy = this._grabbedAccelerators.get(action); let grabbedBy = this._grabbedAccelerators.get(action);
if (sender != grabbedBy) if (sender !== grabbedBy)
return false; return false;
return this._ungrabAccelerator(action); return this._ungrabAccelerator(action);
@ -330,7 +330,7 @@ export class GnomeShell {
_onGrabberBusNameVanished(connection, name) { _onGrabberBusNameVanished(connection, name) {
let grabs = this._grabbedAccelerators.entries(); let grabs = this._grabbedAccelerators.entries();
for (let [action, sender] of grabs) { for (let [action, sender] of grabs) {
if (sender == name) if (sender === name)
this._ungrabAccelerator(action); this._ungrabAccelerator(action);
} }
Gio.bus_unwatch_name(this._grabbers.get(name)); Gio.bus_unwatch_name(this._grabbers.get(name));

View File

@ -65,13 +65,13 @@ export class EntryMenu extends PopupMenu.PopupMenu {
_updateCopyItem() { _updateCopyItem() {
let selection = this._entry.clutter_text.get_selection(); let selection = this._entry.clutter_text.get_selection();
this._copyItem.setSensitive(!this._entry.clutter_text.password_char && this._copyItem.setSensitive(!this._entry.clutter_text.password_char &&
selection && selection != ''); selection && selection !== '');
} }
_updatePasteItem() { _updatePasteItem() {
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, this._clipboard.get_text(St.ClipboardType.CLIPBOARD,
(clipboard, text) => { (clipboard, text) => {
this._pasteItem.setSensitive(text && text != ''); this._pasteItem.setSensitive(text && text !== '');
}); });
} }
@ -113,7 +113,7 @@ function _onButtonPressEvent(actor, event, entry) {
if (entry.menu.isOpen) { if (entry.menu.isOpen) {
entry.menu.close(BoxPointer.PopupAnimation.FULL); entry.menu.close(BoxPointer.PopupAnimation.FULL);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (event.get_button() == 3) { } else if (event.get_button() === 3) {
let [stageX] = event.get_coords(); let [stageX] = event.get_coords();
_setMenuAlignment(entry, stageX); _setMenuAlignment(entry, stageX);
entry.menu.open(BoxPointer.PopupAnimation.FULL); entry.menu.open(BoxPointer.PopupAnimation.FULL);

View File

@ -110,7 +110,7 @@ export class ShellMountOperation {
this._dialog.connectObject('response', this._dialog.connectObject('response',
(object, choice, password, remember, hiddenVolume, systemVolume, pim) => { (object, choice, password, remember, hiddenVolume, systemVolume, pim) => {
if (choice == -1) { if (choice === -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED); this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else { } else {
if (remember) if (remember)
@ -156,7 +156,7 @@ export class ShellMountOperation {
this._processesDialog.connectObject('response', this._processesDialog.connectObject('response',
(object, choice) => { (object, choice) => {
if (choice == -1) { if (choice === -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED); this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else { } else {
this.mountOp.set_choice(choice); this.mountOp.set_choice(choice);
@ -175,7 +175,7 @@ export class ShellMountOperation {
if (!this._notifier) if (!this._notifier)
this._notifier = new ShellUnmountNotifier(); this._notifier = new ShellUnmountNotifier();
if (bytesLeft == 0) if (bytesLeft === 0)
this._notifier.done(message); this._notifier.done(message);
else else
this._notifier.show(message); this._notifier.show(message);
@ -578,7 +578,7 @@ export class GnomeShellMountOpHandler {
this._currentId = requestId; this._currentId = requestId;
this._currentType = type; this._currentType = type;
if (this._dialog && (oldId == requestId) && (oldType == type)) if (this._dialog && (oldId === requestId) && (oldType === type))
return true; return true;
return false; return false;
@ -632,7 +632,7 @@ export class GnomeShellMountOpHandler {
let details = {}; let details = {};
let response; let response;
if (choice == -1) { if (choice === -1) {
response = Gio.MountOperationResult.ABORTED; response = Gio.MountOperationResult.ABORTED;
} else { } else {
response = Gio.MountOperationResult.HANDLED; response = Gio.MountOperationResult.HANDLED;
@ -681,7 +681,7 @@ export class GnomeShellMountOpHandler {
let response; let response;
let details = {}; let details = {};
if (choice == -1) { if (choice === -1) {
response = Gio.MountOperationResult.ABORTED; response = Gio.MountOperationResult.ABORTED;
} else { } else {
response = Gio.MountOperationResult.HANDLED; response = Gio.MountOperationResult.HANDLED;
@ -728,7 +728,7 @@ export class GnomeShellMountOpHandler {
let response; let response;
let details = {}; let details = {};
if (choice == -1) { if (choice === -1) {
response = Gio.MountOperationResult.ABORTED; response = Gio.MountOperationResult.ABORTED;
} else { } else {
response = Gio.MountOperationResult.HANDLED; response = Gio.MountOperationResult.HANDLED;

View File

@ -121,14 +121,14 @@ export const Slider = GObject.registerClass({
let sequence = event.get_event_sequence(); let sequence = event.get_event_sequence();
if (!this._dragging && if (!this._dragging &&
event.type() == Clutter.EventType.TOUCH_BEGIN) { event.type() === Clutter.EventType.TOUCH_BEGIN) {
this.startDragging(event); this.startDragging(event);
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (this._grabbedSequence && } else if (this._grabbedSequence &&
sequence.get_slot() === this._grabbedSequence.get_slot()) { sequence.get_slot() === this._grabbedSequence.get_slot()) {
if (event.type() == Clutter.EventType.TOUCH_UPDATE) if (event.type() === Clutter.EventType.TOUCH_UPDATE)
return this._motionEvent(this, event); return this._motionEvent(this, event);
else if (event.type() == Clutter.EventType.TOUCH_END) else if (event.type() === Clutter.EventType.TOUCH_END)
return this._endDragging(); return this._endDragging();
} }
@ -142,11 +142,11 @@ export const Slider = GObject.registerClass({
if (event.get_flags() & Clutter.EventFlags.POINTER_EMULATED) if (event.get_flags() & Clutter.EventFlags.POINTER_EMULATED)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (direction == Clutter.ScrollDirection.DOWN) { if (direction === Clutter.ScrollDirection.DOWN) {
delta = -SLIDER_SCROLL_STEP; delta = -SLIDER_SCROLL_STEP;
} else if (direction == Clutter.ScrollDirection.UP) { } else if (direction === Clutter.ScrollDirection.UP) {
delta = SLIDER_SCROLL_STEP; delta = SLIDER_SCROLL_STEP;
} else if (direction == Clutter.ScrollDirection.SMOOTH) { } else if (direction === Clutter.ScrollDirection.SMOOTH) {
let [, dy] = event.get_scroll_delta(); let [, dy] = event.get_scroll_delta();
// Even though the slider is horizontal, use dy to match // Even though the slider is horizontal, use dy to match
// the UP/DOWN above. // the UP/DOWN above.
@ -178,8 +178,8 @@ export const Slider = GObject.registerClass({
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let key = event.get_key_symbol(); let key = event.get_key_symbol();
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) { if (key === Clutter.KEY_Right || key === Clutter.KEY_Left) {
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1; let delta = key === Clutter.KEY_Right ? 0.1 : -0.1;
this.value = Math.max(0, Math.min(this._value + delta, this._maxValue)); this.value = Math.max(0, Math.min(this._value + delta, this._maxValue));
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }

View File

@ -63,7 +63,7 @@ class DwellClickIndicator extends PanelMenu.Button {
_syncMenuVisibility() { _syncMenuVisibility() {
this.visible = this.visible =
this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) && this._a11ySettings.get_boolean(KEY_DWELL_CLICK_ENABLED) &&
this._a11ySettings.get_string(KEY_DWELL_MODE) == DWELL_MODE_WINDOW; this._a11ySettings.get_string(KEY_DWELL_MODE) === DWELL_MODE_WINDOW;
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
} }
@ -74,7 +74,7 @@ class DwellClickIndicator extends PanelMenu.Button {
_updateClickType(manager, clickType) { _updateClickType(manager, clickType) {
for (let mode in DWELL_CLICK_MODES) { for (let mode in DWELL_CLICK_MODES) {
if (DWELL_CLICK_MODES[mode].type == clickType) if (DWELL_CLICK_MODES[mode].type === clickType)
this._icon.icon_name = DWELL_CLICK_MODES[mode].icon; this._icon.icon_name = DWELL_CLICK_MODES[mode].icon;
} }
} }

View File

@ -92,13 +92,13 @@ class InputSourcePopup extends SwitcherPopup.SwitcherPopup {
} }
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
if (action == this._action) if (action === this._action)
this._select(this._next()); this._select(this._next());
else if (action == this._actionBackward) else if (action === this._actionBackward)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Left) else if (keysym === Clutter.KEY_Left)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Right) else if (keysym === Clutter.KEY_Right)
this._select(this._next()); this._select(this._next());
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
@ -375,7 +375,7 @@ export class InputSourceManager extends Signals.EventEmitter {
} }
_ibusReadyCallback(im, ready) { _ibusReadyCallback(im, ready) {
if (this._ibusReady == ready) if (this._ibusReady === ready)
return; return;
this._ibusReady = ready; this._ibusReady = ready;
@ -385,7 +385,7 @@ export class InputSourceManager extends Signals.EventEmitter {
_modifiersSwitcher() { _modifiersSwitcher() {
let sourceIndexes = Object.keys(this._inputSources); let sourceIndexes = Object.keys(this._inputSources);
if (sourceIndexes.length == 0) { if (sourceIndexes.length === 0) {
KeyboardManager.releaseKeyboard(); KeyboardManager.releaseKeyboard();
return true; return true;
} }
@ -460,7 +460,7 @@ export class InputSourceManager extends Signals.EventEmitter {
this.emit('current-source-changed', oldSource); this.emit('current-source-changed', oldSource);
for (let i = 1; i < this._mruSources.length; ++i) { for (let i = 1; i < this._mruSources.length; ++i) {
if (this._mruSources[i] == newSource) { if (this._mruSources[i] === newSource) {
let currentSource = this._mruSources.splice(i, 1); let currentSource = this._mruSources.splice(i, 1);
this._mruSources = currentSource.concat(this._mruSources); this._mruSources = currentSource.concat(this._mruSources);
break; break;
@ -488,7 +488,7 @@ export class InputSourceManager extends Signals.EventEmitter {
// work without restarting when/if the user adds an IBus input // work without restarting when/if the user adds an IBus input
// source. // source.
let engine; let engine;
if (is.type == INPUT_SOURCE_TYPE_IBUS) if (is.type === INPUT_SOURCE_TYPE_IBUS)
engine = is.id; engine = is.id;
else else
engine = 'xkb:us::eng'; engine = 'xkb:us::eng';
@ -516,7 +516,7 @@ export class InputSourceManager extends Signals.EventEmitter {
} }
// Initialize from settings when we have no MRU sources list // Initialize from settings when we have no MRU sources list
if (this._mruSources.length == 0) { if (this._mruSources.length === 0) {
let mruSettings = this._settings.mruSources; let mruSettings = this._settings.mruSources;
for (let i = 0; i < mruSettings.length; i++) { for (let i = 0; i < mruSettings.length; i++) {
let mruSettingSource = mruSettings[i]; let mruSettingSource = mruSettings[i];
@ -524,8 +524,8 @@ export class InputSourceManager extends Signals.EventEmitter {
for (let j = 0; j < sourcesList.length; j++) { for (let j = 0; j < sourcesList.length; j++) {
let source = sourcesList[j]; let source = sourcesList[j];
if (source.type == mruSettingSource.type && if (source.type === mruSettingSource.type &&
source.id == mruSettingSource.id) { source.id === mruSettingSource.id) {
mruSource = source; mruSource = source;
break; break;
} }
@ -568,10 +568,10 @@ export class InputSourceManager extends Signals.EventEmitter {
let id = sources[i].id; let id = sources[i].id;
let exists = false; let exists = false;
if (type == INPUT_SOURCE_TYPE_XKB) { if (type === INPUT_SOURCE_TYPE_XKB) {
[exists, displayName, shortName] = [exists, displayName, shortName] =
this._xkbInfo.get_layout_info(id); this._xkbInfo.get_layout_info(id);
} else if (type == INPUT_SOURCE_TYPE_IBUS) { } else if (type === INPUT_SOURCE_TYPE_IBUS) {
if (this._disableIBus) if (this._disableIBus)
continue; continue;
let engineDesc = this._ibusManager.getEngineDesc(id); let engineDesc = this._ibusManager.getEngineDesc(id);
@ -579,7 +579,7 @@ export class InputSourceManager extends Signals.EventEmitter {
let language = IBus.get_language_name(engineDesc.get_language()); let language = IBus.get_language_name(engineDesc.get_language());
let longName = engineDesc.get_longname(); let longName = engineDesc.get_longname();
let textdomain = engineDesc.get_textdomain(); let textdomain = engineDesc.get_textdomain();
if (textdomain != '') if (textdomain !== '')
longName = Gettext.dgettext(textdomain, longName); longName = Gettext.dgettext(textdomain, longName);
exists = true; exists = true;
displayName = `${language} (${longName})`; displayName = `${language} (${longName})`;
@ -591,7 +591,7 @@ export class InputSourceManager extends Signals.EventEmitter {
infosList.push({type, id, displayName, shortName}); infosList.push({type, id, displayName, shortName});
} }
if (infosList.length == 0) { if (infosList.length === 0) {
let type = INPUT_SOURCE_TYPE_XKB; let type = INPUT_SOURCE_TYPE_XKB;
let id = KeyboardManager.DEFAULT_LAYOUT; let id = KeyboardManager.DEFAULT_LAYOUT;
let [, displayName, shortName] = this._xkbInfo.get_layout_info(id); let [, displayName, shortName] = this._xkbInfo.get_layout_info(id);
@ -613,7 +613,7 @@ export class InputSourceManager extends Signals.EventEmitter {
this._inputSources[is.index] = is; this._inputSources[is.index] = is;
if (is.type == INPUT_SOURCE_TYPE_IBUS) if (is.type === INPUT_SOURCE_TYPE_IBUS)
this._ibusSources[is.id] = is; this._ibusSources[is.id] = is;
} }
@ -643,7 +643,7 @@ export class InputSourceManager extends Signals.EventEmitter {
return symbol; return symbol;
let langCode = engineDesc.get_language().split('_', 1)[0]; let langCode = engineDesc.get_language().split('_', 1)[0];
if (langCode.length == 2 || langCode.length == 3) if (langCode.length === 2 || langCode.length === 3)
return langCode.toLowerCase(); return langCode.toLowerCase();
return String.fromCharCode(0x2328); // keyboard glyph return String.fromCharCode(0x2328); // keyboard glyph
@ -656,7 +656,7 @@ export class InputSourceManager extends Signals.EventEmitter {
source.properties = props; source.properties = props;
if (source == this._currentSource) if (source === this._currentSource)
this.emit('current-source-changed', null); this.emit('current-source-changed', null);
} }
@ -666,7 +666,7 @@ export class InputSourceManager extends Signals.EventEmitter {
return; return;
if (this._updateSubProperty(source.properties, prop) && if (this._updateSubProperty(source.properties, prop) &&
source == this._currentSource) source === this._currentSource)
this.emit('current-source-changed', null); this.emit('current-source-changed', null);
} }
@ -676,10 +676,10 @@ export class InputSourceManager extends Signals.EventEmitter {
let p; let p;
for (let i = 0; (p = props.get(i)) != null; ++i) { for (let i = 0; (p = props.get(i)) != null; ++i) {
if (p.get_key() == prop.get_key() && p.get_prop_type() == prop.get_prop_type()) { if (p.get_key() === prop.get_key() && p.get_prop_type() === prop.get_prop_type()) {
p.update(prop); p.update(prop);
return true; return true;
} else if (p.get_prop_type() == IBus.PropType.MENU) { } else if (p.get_prop_type() === IBus.PropType.MENU) {
if (this._updateSubProperty(p.get_sub_props(), prop)) if (this._updateSubProperty(p.get_sub_props(), prop))
return true; return true;
} }
@ -692,8 +692,8 @@ export class InputSourceManager extends Signals.EventEmitter {
// the focus change caused by the switcher popup causing this purpose change. // the focus change caused by the switcher popup causing this purpose change.
if (this._switcherPopup) if (this._switcherPopup)
return; return;
if (purpose == IBus.InputPurpose.PASSWORD) { if (purpose === IBus.InputPurpose.PASSWORD) {
if (Object.keys(this._inputSources).length == Object.keys(this._ibusSources).length) if (Object.keys(this._inputSources).length === Object.keys(this._ibusSources).length)
return; return;
if (this._disableIBus) if (this._disableIBus)
@ -710,14 +710,14 @@ export class InputSourceManager extends Signals.EventEmitter {
_getNewInputSource(current) { _getNewInputSource(current) {
let sourceIndexes = Object.keys(this._inputSources); let sourceIndexes = Object.keys(this._inputSources);
if (sourceIndexes.length == 0) if (sourceIndexes.length === 0)
return null; return null;
if (current) { if (current) {
for (let i in this._inputSources) { for (let i in this._inputSources) {
let is = this._inputSources[i]; let is = this._inputSources[i];
if (is.type == current.type && if (is.type === current.type &&
is.id == current.id) is.id === current.id)
return is; return is;
} }
} }
@ -750,13 +750,13 @@ export class InputSourceManager extends Signals.EventEmitter {
_sourcesPerWindowChanged() { _sourcesPerWindowChanged() {
this._sourcesPerWindow = this._settings.perWindow; this._sourcesPerWindow = this._settings.perWindow;
if (this._sourcesPerWindow && this._focusWindowNotifyId == 0) { if (this._sourcesPerWindow && this._focusWindowNotifyId === 0) {
this._focusWindowNotifyId = global.display.connect('notify::focus-window', this._focusWindowNotifyId = global.display.connect('notify::focus-window',
this._setPerWindowInputSource.bind(this)); this._setPerWindowInputSource.bind(this));
Main.overview.connectObject( Main.overview.connectObject(
'showing', this._setPerWindowInputSource.bind(this), 'showing', this._setPerWindowInputSource.bind(this),
'hidden', this._setPerWindowInputSource.bind(this), this); 'hidden', this._setPerWindowInputSource.bind(this), this);
} else if (!this._sourcesPerWindow && this._focusWindowNotifyId != 0) { } else if (!this._sourcesPerWindow && this._focusWindowNotifyId !== 0) {
global.display.disconnect(this._focusWindowNotifyId); global.display.disconnect(this._focusWindowNotifyId);
this._focusWindowNotifyId = 0; this._focusWindowNotifyId = 0;
Main.overview.disconnectObject(this); Main.overview.disconnectObject(this);
@ -981,7 +981,7 @@ class InputSourceIndicator extends PanelMenu.Button {
if (!prop.get_visible()) if (!prop.get_visible())
continue; continue;
if (prop.get_key() == 'InputMode') { if (prop.get_key() === 'InputMode') {
let text; let text;
if (prop.get_symbol) if (prop.get_symbol)
text = prop.get_symbol().get_text(); text = prop.get_symbol().get_text();
@ -1009,15 +1009,15 @@ class InputSourceIndicator extends PanelMenu.Button {
item.prop = prop; item.prop = prop;
radioGroup.push(item); radioGroup.push(item);
item.radioGroup = radioGroup; item.radioGroup = radioGroup;
item.setOrnament(prop.get_state() == IBus.PropState.CHECKED item.setOrnament(prop.get_state() === IBus.PropState.CHECKED
? PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE); ? PopupMenu.Ornament.DOT : PopupMenu.Ornament.NONE);
item.connect('activate', () => { item.connect('activate', () => {
if (item.prop.get_state() == IBus.PropState.CHECKED) if (item.prop.get_state() === IBus.PropState.CHECKED)
return; return;
let group = item.radioGroup; let group = item.radioGroup;
for (let j = 0; j < group.length; ++j) { for (let j = 0; j < group.length; ++j) {
if (group[j] == item) { if (group[j] === item) {
item.setOrnament(PopupMenu.Ornament.DOT); item.setOrnament(PopupMenu.Ornament.DOT);
item.prop.set_state(IBus.PropState.CHECKED); item.prop.set_state(IBus.PropState.CHECKED);
ibusManager.activateProperty( ibusManager.activateProperty(
@ -1033,7 +1033,7 @@ class InputSourceIndicator extends PanelMenu.Button {
break; break;
case IBus.PropType.TOGGLE: case IBus.PropType.TOGGLE:
item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() == IBus.PropState.CHECKED); item = new PopupMenu.PopupSwitchMenuItem(prop.get_label().get_text(), prop.get_state() === IBus.PropState.CHECKED);
item.prop = prop; item.prop = prop;
item.connect('toggled', () => { item.connect('toggled', () => {
if (item.state) { if (item.state) {
@ -1078,9 +1078,9 @@ class InputSourceIndicator extends PanelMenu.Button {
let xkbLayout = ''; let xkbLayout = '';
let xkbVariant = ''; let xkbVariant = '';
if (source.type == INPUT_SOURCE_TYPE_XKB) { if (source.type === INPUT_SOURCE_TYPE_XKB) {
[, , , xkbLayout, xkbVariant] = KeyboardManager.getXkbInfo().get_layout_info(source.id); [, , , xkbLayout, xkbVariant] = KeyboardManager.getXkbInfo().get_layout_info(source.id);
} else if (source.type == INPUT_SOURCE_TYPE_IBUS) { } else if (source.type === INPUT_SOURCE_TYPE_IBUS) {
let engineDesc = IBusManager.getIBusManager().getEngineDesc(source.id); let engineDesc = IBusManager.getIBusManager().getEngineDesc(source.id);
if (engineDesc) { if (engineDesc) {
xkbLayout = engineDesc.get_layout(); xkbLayout = engineDesc.get_layout();
@ -1096,7 +1096,7 @@ class InputSourceIndicator extends PanelMenu.Button {
} }
} }
if (!xkbLayout || xkbLayout.length == 0) if (!xkbLayout || xkbLayout.length === 0)
return; return;
let description = xkbLayout; let description = xkbLayout;

View File

@ -33,7 +33,7 @@ const GeoclueAccuracyLevel = {
function accuracyLevelToString(accuracyLevel) { function accuracyLevelToString(accuracyLevel) {
for (let key in GeoclueAccuracyLevel) { for (let key in GeoclueAccuracyLevel) {
if (GeoclueAccuracyLevel[key] == accuracyLevel) if (GeoclueAccuracyLevel[key] === accuracyLevel)
return key; return key;
} }
@ -296,7 +296,7 @@ class AppAuthorizer {
} }
_completeAuth() { _completeAuth() {
if (this._accuracyLevel != GeoclueAccuracyLevel.NONE) { if (this._accuracyLevel !== GeoclueAccuracyLevel.NONE) {
this._accuracyLevel = Math.clamp(this._accuracyLevel, this._accuracyLevel = Math.clamp(this._accuracyLevel,
0, this._maxAccuracyLevel); 0, this._maxAccuracyLevel);
} }

View File

@ -658,7 +658,7 @@ class NMModemDeviceItem extends NMDeviceItem {
this._mobileDevice = null; this._mobileDevice = null;
let capabilities = device.current_capabilities; let capabilities = device.current_capabilities;
if (device.udi.indexOf('/org/freedesktop/ModemManager1/Modem') == 0) if (device.udi.indexOf('/org/freedesktop/ModemManager1/Modem') === 0)
this._mobileDevice = new ModemManager.BroadbandModem(device.udi, capabilities); this._mobileDevice = new ModemManager.BroadbandModem(device.udi, capabilities);
else if (capabilities & NM.DeviceModemCapabilities.GSM_UMTS) else if (capabilities & NM.DeviceModemCapabilities.GSM_UMTS)
this._mobileDevice = new ModemManager.ModemGsm(device.udi); this._mobileDevice = new ModemManager.ModemGsm(device.udi);
@ -2073,14 +2073,14 @@ class Indicator extends SystemIndicator {
async _portalHelperDone(parameters) { async _portalHelperDone(parameters) {
let [path, result] = parameters; let [path, result] = parameters;
if (result == PortalHelperResult.CANCELLED) { if (result === PortalHelperResult.CANCELLED) {
// Keep the connection in the queue, so the user is not // Keep the connection in the queue, so the user is not
// spammed with more logins until we next flush the queue, // spammed with more logins until we next flush the queue,
// which will happen once they choose a better connection // which will happen once they choose a better connection
// or we get to full connectivity through other means // or we get to full connectivity through other means
} else if (result == PortalHelperResult.COMPLETED) { } else if (result === PortalHelperResult.COMPLETED) {
this._closeConnectivityCheck(path); this._closeConnectivityCheck(path);
} else if (result == PortalHelperResult.RECHECK) { } else if (result === PortalHelperResult.RECHECK) {
try { try {
const state = await this._client.check_connectivity_async(null); const state = await this._client.check_connectivity_async(null);
if (state >= NM.ConnectivityState.FULL) if (state >= NM.ConnectivityState.FULL)
@ -2093,12 +2093,12 @@ class Indicator extends SystemIndicator {
async _syncConnectivity() { async _syncConnectivity() {
if (this._mainConnection == null || if (this._mainConnection == null ||
this._mainConnection.state != NM.ActiveConnectionState.ACTIVATED) { this._mainConnection.state !== NM.ActiveConnectionState.ACTIVATED) {
this._flushConnectivityQueue(); this._flushConnectivityQueue();
return; return;
} }
let isPortal = this._client.connectivity == NM.ConnectivityState.PORTAL; let isPortal = this._client.connectivity === NM.ConnectivityState.PORTAL;
// For testing, allow interpreting any value != FULL as PORTAL, because // For testing, allow interpreting any value != FULL as PORTAL, because
// LIMITED (no upstream route after the default gateway) is easy to obtain // LIMITED (no upstream route after the default gateway) is easy to obtain
// with a tethered phone // with a tethered phone

View File

@ -315,8 +315,8 @@ class OutputStreamSlider extends StreamSlider {
_findHeadphones(sink) { _findHeadphones(sink) {
// This only works for external headphones (e.g. bluetooth) // This only works for external headphones (e.g. bluetooth)
if (sink.get_form_factor() == 'headset' || if (sink.get_form_factor() === 'headset' ||
sink.get_form_factor() == 'headphone') sink.get_form_factor() === 'headphone')
return true; return true;
// a bit hackish, but ALSA/PulseAudio have a number // a bit hackish, but ALSA/PulseAudio have a number

View File

@ -70,11 +70,11 @@ class SwitchMonitorPopup extends SwitcherPopup.SwitcherPopup {
} }
_keyPressHandler(keysym, action) { _keyPressHandler(keysym, action) {
if (action == Meta.KeyBindingAction.SWITCH_MONITOR) if (action === Meta.KeyBindingAction.SWITCH_MONITOR)
this._select(this._next()); this._select(this._next());
else if (keysym == Clutter.KEY_Left) else if (keysym === Clutter.KEY_Left)
this._select(this._previous()); this._select(this._previous());
else if (keysym == Clutter.KEY_Right) else if (keysym === Clutter.KEY_Right)
this._select(this._next()); this._select(this._next());
else else
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;

View File

@ -25,7 +25,7 @@ export function mod(a, b) {
} }
function primaryModifier(mask) { function primaryModifier(mask) {
if (mask == 0) if (mask === 0)
return 0; return 0;
let primary = 1; let primary = 1;
@ -99,14 +99,14 @@ export const SwitcherPopup = GObject.registerClass({
_initialSelection(backward, _binding) { _initialSelection(backward, _binding) {
if (backward) if (backward)
this._select(this._items.length - 1); this._select(this._items.length - 1);
else if (this._items.length == 1) else if (this._items.length === 1)
this._select(0); this._select(0);
else else
this._select(1); this._select(1);
} }
show(backward, binding, mask) { show(backward, binding, mask) {
if (this._items.length == 0) if (this._items.length === 0)
return false; return false;
let grab = Main.pushModal(this); let grab = Main.pushModal(this);
@ -190,7 +190,7 @@ export const SwitcherPopup = GObject.registerClass({
this._disableHover(); this._disableHover();
if (this._keyPressHandler(keysym, action) != Clutter.EVENT_PROPAGATE) { if (this._keyPressHandler(keysym, action) !== Clutter.EVENT_PROPAGATE) {
this._showImmediately(); this._showImmediately();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
@ -216,7 +216,7 @@ export const SwitcherPopup = GObject.registerClass({
let [x_, y_, mods] = global.get_pointer(); let [x_, y_, mods] = global.get_pointer();
let state = mods & this._modifierMask; let state = mods & this._modifierMask;
if (state == 0) if (state === 0)
this._finish(event.get_time()); this._finish(event.get_time());
} else { } else {
this._resetNoModsTimeout(); this._resetNoModsTimeout();
@ -232,9 +232,9 @@ export const SwitcherPopup = GObject.registerClass({
} }
_scrollHandler(direction) { _scrollHandler(direction) {
if (direction == Clutter.ScrollDirection.UP) if (direction === Clutter.ScrollDirection.UP)
this._select(this._previous()); this._select(this._previous());
else if (direction == Clutter.ScrollDirection.DOWN) else if (direction === Clutter.ScrollDirection.DOWN)
this._select(this._next()); this._select(this._next());
} }
@ -288,7 +288,7 @@ export const SwitcherPopup = GObject.registerClass({
_disableHover() { _disableHover() {
this.mouseActive = false; this.mouseActive = false;
if (this._motionTimeoutId != 0) if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId); GLib.source_remove(this._motionTimeoutId);
this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this)); this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
@ -302,7 +302,7 @@ export const SwitcherPopup = GObject.registerClass({
} }
_resetNoModsTimeout() { _resetNoModsTimeout() {
if (this._noModsTimeoutId != 0) if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId); GLib.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = GLib.timeout_add( this._noModsTimeoutId = GLib.timeout_add(
@ -344,11 +344,11 @@ export const SwitcherPopup = GObject.registerClass({
_onDestroy() { _onDestroy() {
this._popModal(); this._popModal();
if (this._motionTimeoutId != 0) if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId); GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0) if (this._initialDelayTimeoutId !== 0)
GLib.source_remove(this._initialDelayTimeoutId); GLib.source_remove(this._initialDelayTimeoutId);
if (this._noModsTimeoutId != 0) if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId); GLib.source_remove(this._noModsTimeoutId);
// Make sure the SwitcherList is always destroyed, it may not be // Make sure the SwitcherList is always destroyed, it may not be

View File

@ -778,7 +778,7 @@ export const UnlockDialog = GObject.registerClass({
_onReset(authPrompt, beginRequest) { _onReset(authPrompt, beginRequest) {
let userName; let userName;
if (beginRequest == AuthPrompt.BeginRequestType.PROVIDE_USERNAME) { if (beginRequest === AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
this._authPrompt.setUser(this._user); this._authPrompt.setUser(this._user);
userName = this._userName; userName = this._userName;
} else { } else {

View File

@ -170,7 +170,7 @@ class UserWidget extends St.BoxLayout {
// If user is null, that implies a username-based login authorization. // If user is null, that implies a username-based login authorization.
this._user = user; this._user = user;
let vertical = orientation == Clutter.Orientation.VERTICAL; let vertical = orientation === Clutter.Orientation.VERTICAL;
let xAlign = vertical ? Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START; let xAlign = vertical ? Clutter.ActorAlign.CENTER : Clutter.ActorAlign.START;
let styleClass = vertical ? 'user-widget vertical' : 'user-widget horizontal'; let styleClass = vertical ? 'user-widget vertical' : 'user-widget horizontal';

View File

@ -110,7 +110,7 @@ class DisplayChangeDialog extends ModalDialog.ModalDialog {
_tick() { _tick() {
this._countDown--; this._countDown--;
if (this._countDown == 0) { if (this._countDown === 0) {
/* mutter already takes care of failing at timeout */ /* mutter already takes care of failing at timeout */
this._timeoutId = 0; this._timeoutId = 0;
this.close(); this.close();
@ -239,9 +239,9 @@ class WorkspaceTracker {
for (i = 0; i < this._workspaces.length; i++) { for (i = 0; i < this._workspaces.length; i++) {
let lastRemoved = this._workspaces[i]._lastRemovedWindow; let lastRemoved = this._workspaces[i]._lastRemovedWindow;
if ((lastRemoved && if ((lastRemoved &&
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN || (lastRemoved.get_window_type() === Meta.WindowType.SPLASHSCREEN ||
lastRemoved.get_window_type() == Meta.WindowType.DIALOG || lastRemoved.get_window_type() === Meta.WindowType.DIALOG ||
lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG)) || lastRemoved.get_window_type() === Meta.WindowType.MODAL_DIALOG)) ||
this._workspaces[i]._keepAliveId) this._workspaces[i]._keepAliveId)
emptyWorkspaces[i] = false; emptyWorkspaces[i] = false;
else else
@ -289,7 +289,7 @@ class WorkspaceTracker {
for (i = lastIndex; i >= 0; i--) { for (i = lastIndex; i >= 0; i--) {
if (workspaceManager.n_workspaces === MIN_NUM_WORKSPACES) if (workspaceManager.n_workspaces === MIN_NUM_WORKSPACES)
break; break;
if (emptyWorkspaces[i] && i != lastEmptyIndex) if (emptyWorkspaces[i] && i !== lastEmptyIndex)
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time()); workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
} }
@ -313,7 +313,7 @@ class WorkspaceTracker {
workspace._lastRemovedWindow = window; workspace._lastRemovedWindow = window;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => { let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => {
if (workspace._lastRemovedWindow == window) { if (workspace._lastRemovedWindow === window) {
workspace._lastRemovedWindow = null; workspace._lastRemovedWindow = null;
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
} }
@ -325,7 +325,7 @@ class WorkspaceTracker {
_windowLeftMonitor(metaDisplay, monitorIndex, _metaWin) { _windowLeftMonitor(metaDisplay, monitorIndex, _metaWin) {
// If the window left the primary monitor, that // If the window left the primary monitor, that
// might make that workspace empty // might make that workspace empty
if (monitorIndex == Main.layoutManager.primaryIndex) if (monitorIndex === Main.layoutManager.primaryIndex)
this._queueCheckWorkspaces(); this._queueCheckWorkspaces();
} }
@ -349,7 +349,7 @@ class WorkspaceTracker {
let oldNumWorkspaces = this._workspaces.length; let oldNumWorkspaces = this._workspaces.length;
let newNumWorkspaces = workspaceManager.n_workspaces; let newNumWorkspaces = workspaceManager.n_workspaces;
if (oldNumWorkspaces == newNumWorkspaces) if (oldNumWorkspaces === newNumWorkspaces)
return false; return false;
if (newNumWorkspaces > oldNumWorkspaces) { if (newNumWorkspaces > oldNumWorkspaces) {
@ -371,7 +371,7 @@ class WorkspaceTracker {
let removedNum = oldNumWorkspaces - newNumWorkspaces; let removedNum = oldNumWorkspaces - newNumWorkspaces;
for (let w = 0; w < oldNumWorkspaces; w++) { for (let w = 0; w < oldNumWorkspaces; w++) {
let workspace = workspaceManager.get_workspace_by_index(w); let workspace = workspaceManager.get_workspace_by_index(w);
if (this._workspaces[w] != workspace) { if (this._workspaces[w] !== workspace) {
removedIndex = w; removedIndex = w;
break; break;
} }
@ -407,8 +407,8 @@ class TilePreview extends St.Widget {
if (this._rect && this._rect.equal(tileRect)) if (this._rect && this._rect.equal(tileRect))
return; return;
let changeMonitor = this._monitorIndex == -1 || let changeMonitor = this._monitorIndex === -1 ||
this._monitorIndex != monitorIndex; this._monitorIndex !== monitorIndex;
this._monitorIndex = monitorIndex; this._monitorIndex = monitorIndex;
this._rect = tileRect; this._rect = tileRect;
@ -464,11 +464,11 @@ class TilePreview extends St.Widget {
_updateStyle(monitor) { _updateStyle(monitor) {
let styles = ['tile-preview']; let styles = ['tile-preview'];
if (this._monitorIndex == Main.layoutManager.primaryIndex) if (this._monitorIndex === Main.layoutManager.primaryIndex)
styles.push('on-primary'); styles.push('on-primary');
if (this._rect.x == monitor.x) if (this._rect.x === monitor.x)
styles.push('tile-preview-left'); styles.push('tile-preview-left');
if (this._rect.x + this._rect.width == monitor.x + monitor.width) if (this._rect.x + this._rect.width === monitor.x + monitor.width)
styles.push('tile-preview-right'); styles.push('tile-preview-right');
this.style_class = styles.join(' '); this.style_class = styles.join(' ');
@ -484,7 +484,7 @@ const AppSwitchAction = GObject.registerClass({
} }
vfunc_gesture_prepare(_actor) { vfunc_gesture_prepare(_actor) {
if (Main.actionMode != Shell.ActionMode.NORMAL) { if (Main.actionMode !== Shell.ActionMode.NORMAL) {
this.cancel(); this.cancel();
return false; return false;
} }
@ -499,9 +499,9 @@ const AppSwitchAction = GObject.registerClass({
let nPoints = this.get_n_current_points(); let nPoints = this.get_n_current_points();
let event = this.get_last_event(nPoints - 1); let event = this.get_last_event(nPoints - 1);
if (nPoints == 3) { if (nPoints === 3) {
this._longPressStartTime = event.get_time(); this._longPressStartTime = event.get_time();
} else if (nPoints == 4) { } else if (nPoints === 4) {
// Check whether the 4th finger press happens after a 3-finger long press, // Check whether the 4th finger press happens after a 3-finger long press,
// this only needs to be checked on the first 4th finger press // this only needs to be checked on the first 4th finger press
if (this._longPressStartTime != null && if (this._longPressStartTime != null &&
@ -517,7 +517,7 @@ const AppSwitchAction = GObject.registerClass({
} }
vfunc_gesture_progress(_actor) { vfunc_gesture_progress(_actor) {
if (this.get_n_current_points() == 3) { if (this.get_n_current_points() === 3) {
for (let i = 0; i < this.get_n_current_points(); i++) { for (let i = 0; i < this.get_n_current_points(); i++) {
let [startX, startY] = this.get_press_coords(i); let [startX, startY] = this.get_press_coords(i);
let [x, y] = this.get_motion_coords(i); let [x, y] = this.get_motion_coords(i);
@ -1021,7 +1021,7 @@ export class WindowManager {
_lookupIndex(windows, metaWindow) { _lookupIndex(windows, metaWindow) {
for (let i = 0; i < windows.length; i++) { for (let i = 0; i < windows.length; i++) {
if (windows[i].metaWindow == metaWindow) if (windows[i].metaWindow === metaWindow)
return i; return i;
} }
return -1; return -1;
@ -1036,7 +1036,7 @@ export class WindowManager {
win.located_on_workspace(activeWorkspace); win.located_on_workspace(activeWorkspace);
}); });
if (windows.length == 0) if (windows.length === 0)
return; return;
let focusWindow = global.display.focus_window; let focusWindow = global.display.focus_window;
@ -1117,7 +1117,7 @@ export class WindowManager {
addKeybinding(name, settings, flags, modes, handler) { addKeybinding(name, settings, flags, modes, handler) {
let action = global.display.add_keybinding(name, settings, flags, handler); let action = global.display.add_keybinding(name, settings, flags, handler);
if (action != Meta.KeyBindingAction.NONE) if (action !== Meta.KeyBindingAction.NONE)
this.allowKeybinding(name, modes); this.allowKeybinding(name, modes);
return action; return action;
} }
@ -1188,7 +1188,7 @@ export class WindowManager {
} }
xDest = monitor.x; xDest = monitor.x;
yDest = monitor.y; yDest = monitor.y;
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
xDest += monitor.width; xDest += monitor.width;
xScale = 0; xScale = 0;
yScale = 0; yScale = 0;
@ -1254,7 +1254,7 @@ export class WindowManager {
return; return;
} }
actor.set_position(monitor.x, monitor.y); actor.set_position(monitor.x, monitor.y);
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
actor.x += monitor.width; actor.x += monitor.width;
actor.set_scale(0, 0); actor.set_scale(0, 0);
} }
@ -1423,7 +1423,7 @@ export class WindowManager {
} else if (!shouldDim && window._dimmed) { } else if (!shouldDim && window._dimmed) {
window._dimmed = false; window._dimmed = false;
this._dimmedWindows = this._dimmedWindows =
this._dimmedWindows.filter(win => win != window); this._dimmedWindows.filter(win => win !== window);
this._undimWindow(window); this._undimWindow(window);
} }
} }
@ -1554,7 +1554,7 @@ export class WindowManager {
window.disconnectObject(actor); window.disconnectObject(actor);
if (window._dimmed) { if (window._dimmed) {
this._dimmedWindows = this._dimmedWindows =
this._dimmedWindows.filter(win => win != window); this._dimmedWindows.filter(win => win !== window);
} }
if (window.is_attached_dialog()) if (window.is_attached_dialog())
@ -1618,14 +1618,14 @@ export class WindowManager {
} }
_filterKeybinding(shellwm, binding) { _filterKeybinding(shellwm, binding) {
if (Main.actionMode == Shell.ActionMode.NONE) if (Main.actionMode === Shell.ActionMode.NONE)
return true; return true;
// There's little sense in implementing a keybinding in mutter and // There's little sense in implementing a keybinding in mutter and
// not having it work in NORMAL mode; handle this case generically // not having it work in NORMAL mode; handle this case generically
// so we don't have to explicitly allow all builtin keybindings in // so we don't have to explicitly allow all builtin keybindings in
// NORMAL mode. // NORMAL mode.
if (Main.actionMode == Shell.ActionMode.NORMAL && if (Main.actionMode === Shell.ActionMode.NORMAL &&
binding.is_builtin()) binding.is_builtin())
return false; return false;
@ -1744,26 +1744,26 @@ export class WindowManager {
if (!Main.sessionMode.hasWorkspaces) if (!Main.sessionMode.hasWorkspaces)
return; return;
if (workspaceManager.n_workspaces == 1) if (workspaceManager.n_workspaces === 1)
return; return;
let [action,,, target] = binding.get_name().split('-'); let [action,,, target] = binding.get_name().split('-');
let newWs; let newWs;
let direction; let direction;
let vertical = workspaceManager.layout_rows == -1; let vertical = workspaceManager.layout_rows === -1;
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; let rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
if (action == 'move') { if (action === 'move') {
// "Moving" a window to another workspace doesn't make sense when // "Moving" a window to another workspace doesn't make sense when
// it cannot be unstuck, and is potentially confusing if a new // it cannot be unstuck, and is potentially confusing if a new
// workspaces is added at the start/end // workspaces is added at the start/end
if (window.is_always_on_all_workspaces() || if (window.is_always_on_all_workspaces() ||
(Meta.prefs_get_workspaces_only_on_primary() && (Meta.prefs_get_workspaces_only_on_primary() &&
window.get_monitor() != Main.layoutManager.primaryIndex)) window.get_monitor() !== Main.layoutManager.primaryIndex))
return; return;
} }
if (target == 'last') { if (target === 'last') {
if (vertical) if (vertical)
direction = Meta.MotionDirection.DOWN; direction = Meta.MotionDirection.DOWN;
else if (rtl) else if (rtl)
@ -1810,17 +1810,17 @@ export class WindowManager {
} }
} }
if (workspaceManager.layout_rows == -1 && if (workspaceManager.layout_rows === -1 &&
direction != Meta.MotionDirection.UP && direction !== Meta.MotionDirection.UP &&
direction != Meta.MotionDirection.DOWN) direction !== Meta.MotionDirection.DOWN)
return; return;
if (workspaceManager.layout_columns == -1 && if (workspaceManager.layout_columns === -1 &&
direction != Meta.MotionDirection.LEFT && direction !== Meta.MotionDirection.LEFT &&
direction != Meta.MotionDirection.RIGHT) direction !== Meta.MotionDirection.RIGHT)
return; return;
if (action == 'switch') if (action === 'switch')
this.actionMoveWorkspace(newWs); this.actionMoveWorkspace(newWs);
else else
this.actionMoveWindow(window, newWs); this.actionMoveWindow(window, newWs);

View File

@ -95,7 +95,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
if (!window.allows_resize()) if (!window.allows_resize())
item.setSensitive(false); item.setSensitive(false);
if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) { if (!window.titlebar_is_onscreen() && type !== Meta.WindowType.DOCK && type !== Meta.WindowType.DESKTOP) {
this.addAction(_('Move Titlebar Onscreen'), () => { this.addAction(_('Move Titlebar Onscreen'), () => {
window.shove_titlebar_onscreen(); window.shove_titlebar_onscreen();
}); });
@ -109,10 +109,10 @@ export class WindowMenu extends PopupMenu.PopupMenu {
}); });
if (window.is_above()) if (window.is_above())
item.setOrnament(PopupMenu.Ornament.CHECK); item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.get_maximized() == Meta.MaximizeFlags.BOTH || if (window.get_maximized() === Meta.MaximizeFlags.BOTH ||
type == Meta.WindowType.DOCK || type === Meta.WindowType.DOCK ||
type == Meta.WindowType.DESKTOP || type === Meta.WindowType.DESKTOP ||
type == Meta.WindowType.SPLASHSCREEN) type === Meta.WindowType.SPLASHSCREEN)
item.setSensitive(false); item.setSensitive(false);
if (Main.sessionMode.hasWorkspaces && if (Main.sessionMode.hasWorkspaces &&
@ -133,25 +133,25 @@ export class WindowMenu extends PopupMenu.PopupMenu {
if (!isSticky) { if (!isSticky) {
let workspace = window.get_workspace(); let workspace = window.get_workspace();
if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) { if (workspace !== workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
this.addAction(_('Move to Workspace Left'), () => { this.addAction(_('Move to Workspace Left'), () => {
let dir = Meta.MotionDirection.LEFT; let dir = Meta.MotionDirection.LEFT;
window.change_workspace(workspace.get_neighbor(dir)); window.change_workspace(workspace.get_neighbor(dir));
}); });
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) { if (workspace !== workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
this.addAction(_('Move to Workspace Right'), () => { this.addAction(_('Move to Workspace Right'), () => {
let dir = Meta.MotionDirection.RIGHT; let dir = Meta.MotionDirection.RIGHT;
window.change_workspace(workspace.get_neighbor(dir)); window.change_workspace(workspace.get_neighbor(dir));
}); });
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) { if (workspace !== workspace.get_neighbor(Meta.MotionDirection.UP)) {
this.addAction(_('Move to Workspace Up'), () => { this.addAction(_('Move to Workspace Up'), () => {
let dir = Meta.MotionDirection.UP; let dir = Meta.MotionDirection.UP;
window.change_workspace(workspace.get_neighbor(dir)); window.change_workspace(workspace.get_neighbor(dir));
}); });
} }
if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) { if (workspace !== workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
this.addAction(_('Move to Workspace Down'), () => { this.addAction(_('Move to Workspace Down'), () => {
let dir = Meta.MotionDirection.DOWN; let dir = Meta.MotionDirection.DOWN;
window.change_workspace(workspace.get_neighbor(dir)); window.change_workspace(workspace.get_neighbor(dir));
@ -169,7 +169,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
let dir = Meta.DisplayDirection.UP; let dir = Meta.DisplayDirection.UP;
let upMonitorIndex = let upMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir); display.get_monitor_neighbor_index(monitorIndex, dir);
if (upMonitorIndex != -1) { if (upMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Up'), () => { this.addAction(_('Move to Monitor Up'), () => {
window.move_to_monitor(upMonitorIndex); window.move_to_monitor(upMonitorIndex);
}); });
@ -178,7 +178,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.DOWN; dir = Meta.DisplayDirection.DOWN;
let downMonitorIndex = let downMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir); display.get_monitor_neighbor_index(monitorIndex, dir);
if (downMonitorIndex != -1) { if (downMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Down'), () => { this.addAction(_('Move to Monitor Down'), () => {
window.move_to_monitor(downMonitorIndex); window.move_to_monitor(downMonitorIndex);
}); });
@ -187,7 +187,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.LEFT; dir = Meta.DisplayDirection.LEFT;
let leftMonitorIndex = let leftMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir); display.get_monitor_neighbor_index(monitorIndex, dir);
if (leftMonitorIndex != -1) { if (leftMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Left'), () => { this.addAction(_('Move to Monitor Left'), () => {
window.move_to_monitor(leftMonitorIndex); window.move_to_monitor(leftMonitorIndex);
}); });
@ -196,7 +196,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.RIGHT; dir = Meta.DisplayDirection.RIGHT;
let rightMonitorIndex = let rightMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir); display.get_monitor_neighbor_index(monitorIndex, dir);
if (rightMonitorIndex != -1) { if (rightMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Right'), () => { this.addAction(_('Move to Monitor Right'), () => {
window.move_to_monitor(rightMonitorIndex); window.move_to_monitor(rightMonitorIndex);
}); });
@ -228,7 +228,7 @@ export class WindowMenuManager {
if (!Main.sessionMode.hasWmMenus) if (!Main.sessionMode.hasWmMenus)
return; return;
if (type != Meta.WindowMenuType.WM) if (type !== Meta.WindowMenuType.WM)
throw new Error('Unsupported window menu type'); throw new Error('Unsupported window menu type');
let menu = new WindowMenu(window, this._sourceActor); let menu = new WindowMenu(window, this._sourceActor);

View File

@ -445,7 +445,7 @@ export const WindowPreview = GObject.registerClass({
parent = parent.get_transient_for(); parent = parent.get_transient_for();
// Display dialog if it is attached to our metaWindow // Display dialog if it is attached to our metaWindow
if (win.is_attached_dialog() && parent == this.metaWindow) if (win.is_attached_dialog() && parent === this.metaWindow)
this._addWindow(win); this._addWindow(win);
// The dialog popped up after the user tried to close the window, // The dialog popped up after the user tried to close the window,
@ -606,7 +606,7 @@ export const WindowPreview = GObject.registerClass({
vfunc_key_press_event(event) { vfunc_key_press_event(event) {
let symbol = event.get_key_symbol(); let symbol = event.get_key_symbol();
let isEnter = symbol == Clutter.KEY_Return || symbol == Clutter.KEY_KP_Enter; let isEnter = symbol === Clutter.KEY_Return || symbol === Clutter.KEY_KP_Enter;
if (isEnter) { if (isEnter) {
this._activate(); this._activate();
return true; return true;

View File

@ -1069,7 +1069,7 @@ class Workspace extends St.Widget {
this.monitorIndex = monitorIndex; this.monitorIndex = monitorIndex;
this._monitor = Main.layoutManager.monitors[this.monitorIndex]; this._monitor = Main.layoutManager.monitors[this.monitorIndex];
if (monitorIndex != Main.layoutManager.primaryIndex) if (monitorIndex !== Main.layoutManager.primaryIndex)
this.add_style_class_name('external-monitor'); this.add_style_class_name('external-monitor');
const clickAction = new Clutter.ClickAction(); const clickAction = new Clutter.ClickAction();
@ -1130,7 +1130,7 @@ class Workspace extends St.Widget {
} }
_lookupIndex(metaWindow) { _lookupIndex(metaWindow) {
return this._windows.findIndex(w => w.metaWindow == metaWindow); return this._windows.findIndex(w => w.metaWindow === metaWindow);
} }
containsMetaWindow(metaWindow) { containsMetaWindow(metaWindow) {
@ -1138,7 +1138,7 @@ class Workspace extends St.Widget {
} }
isEmpty() { isEmpty() {
return this._windows.length == 0; return this._windows.length === 0;
} }
syncStacking(stackIndices) { syncStacking(stackIndices) {
@ -1199,7 +1199,7 @@ class Workspace extends St.Widget {
// the compositor finds out about them... // the compositor finds out about them...
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (metaWin.get_compositor_private() && if (metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() === this.metaWorkspace)
this._doAddWindow(metaWin); this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
@ -1209,7 +1209,7 @@ class Workspace extends St.Widget {
// We might have the window in our list already if it was on all workspaces and // We might have the window in our list already if it was on all workspaces and
// now was moved to this workspace // now was moved to this workspace
if (this._lookupIndex(metaWin) != -1) if (this._lookupIndex(metaWin) !== -1)
return; return;
if (!this._isMyWindow(metaWin)) if (!this._isMyWindow(metaWin))
@ -1229,7 +1229,7 @@ class Workspace extends St.Widget {
// Let the top-most ancestor handle all transients // Let the top-most ancestor handle all transients
let parent = metaWin.find_root_ancestor(); let parent = metaWin.find_root_ancestor();
let clone = this._windows.find(c => c.metaWindow == parent); let clone = this._windows.find(c => c.metaWindow === parent);
// If no clone was found, the parent hasn't been created yet // If no clone was found, the parent hasn't been created yet
// and will take care of the dialog when added // and will take care of the dialog when added
@ -1276,7 +1276,7 @@ class Workspace extends St.Widget {
} }
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) { _windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex) if (monitorIndex === this.monitorIndex)
this._doRemoveWindow(metaWin); this._doRemoveWindow(metaWin);
} }
@ -1376,7 +1376,7 @@ class Workspace extends St.Widget {
this._container.layout_manager.addWindow(clone, metaWindow); this._container.layout_manager.addWindow(clone, metaWindow);
if (this._windows.length == 0) if (this._windows.length === 0)
clone.setStackAbove(null); clone.setStackAbove(null);
else else
clone.setStackAbove(this._windows[this._windows.length - 1]); clone.setStackAbove(this._windows[this._windows.length - 1]);
@ -1390,7 +1390,7 @@ class Workspace extends St.Widget {
// find the position of the window in our list // find the position of the window in our list
let index = this._lookupIndex(metaWin); let index = this._lookupIndex(metaWin);
if (index == -1) if (index === -1)
return null; return null;
this._container.layout_manager.removeWindow(this._windows[index]); this._container.layout_manager.removeWindow(this._windows[index]);

View File

@ -68,7 +68,7 @@ class WorkspaceSwitcherPopup extends Clutter.Actor {
this._activeWorkspaceIndex = activeWorkspaceIndex; this._activeWorkspaceIndex = activeWorkspaceIndex;
this._redisplay(); this._redisplay();
if (this._timeoutId != 0) if (this._timeoutId !== 0)
GLib.source_remove(this._timeoutId); GLib.source_remove(this._timeoutId);
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISPLAY_TIMEOUT, this._onTimeout.bind(this)); this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISPLAY_TIMEOUT, this._onTimeout.bind(this));
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout'); GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');

View File

@ -298,7 +298,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
} }
_lookupIndex(metaWindow) { _lookupIndex(metaWindow) {
return this._windows.findIndex(w => w.metaWindow == metaWindow); return this._windows.findIndex(w => w.metaWindow === metaWindow);
} }
syncStacking(stackIndices) { syncStacking(stackIndices) {
@ -316,7 +316,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
} }
set slidePosition(slidePosition) { set slidePosition(slidePosition) {
if (this._slidePosition == slidePosition) if (this._slidePosition === slidePosition)
return; return;
const scale = Util.lerp(1, 0.75, slidePosition); const scale = Util.lerp(1, 0.75, slidePosition);
@ -333,7 +333,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
} }
set collapseFraction(collapseFraction) { set collapseFraction(collapseFraction) {
if (this._collapseFraction == collapseFraction) if (this._collapseFraction === collapseFraction)
return; return;
this._collapseFraction = collapseFraction; this._collapseFraction = collapseFraction;
this.notify('collapse-fraction'); this.notify('collapse-fraction');
@ -362,7 +362,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (!this._removed && if (!this._removed &&
metaWin.get_compositor_private() && metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace) metaWin.get_workspace() === this.metaWorkspace)
this._doAddWindow(metaWin); this._doAddWindow(metaWin);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
@ -378,7 +378,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
// We might have the window in our list already if it was on all workspaces and // We might have the window in our list already if it was on all workspaces and
// now was moved to this workspace // now was moved to this workspace
if (this._lookupIndex(metaWin) != -1) if (this._lookupIndex(metaWin) !== -1)
return; return;
if (!this._isMyWindow(win)) if (!this._isMyWindow(win))
@ -409,7 +409,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
_windowRemoved(metaWorkspace, metaWin) { _windowRemoved(metaWorkspace, metaWin) {
let index = this._allWindows.indexOf(metaWin); let index = this._allWindows.indexOf(metaWin);
if (index != -1) { if (index !== -1) {
metaWin.disconnectObject(this); metaWin.disconnectObject(this);
this._allWindows.splice(index, 1); this._allWindows.splice(index, 1);
} }
@ -418,12 +418,12 @@ export const WorkspaceThumbnail = GObject.registerClass({
} }
_windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) { _windowEnteredMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex) if (monitorIndex === this.monitorIndex)
this._doAddWindow(metaWin); this._doAddWindow(metaWin);
} }
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) { _windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex) if (monitorIndex === this.monitorIndex)
this._doRemoveWindow(metaWin); this._doRemoveWindow(metaWin);
} }
@ -454,7 +454,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
_isMyWindow(actor) { _isMyWindow(actor) {
let win = actor.meta_window; let win = actor.meta_window;
return win.located_on_workspace(this.metaWorkspace) && return win.located_on_workspace(this.metaWorkspace) &&
(win.get_monitor() == this.monitorIndex); (win.get_monitor() === this.monitorIndex);
} }
// Tests if @win should be shown in the Overview // Tests if @win should be shown in the Overview
@ -496,7 +496,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
// find the position of the window in our list // find the position of the window in our list
let index = this._lookupIndex(metaWin); let index = this._lookupIndex(metaWin);
if (index == -1) if (index === -1)
return null; return null;
return this._windows.splice(index, 1).pop(); return this._windows.splice(index, 1).pop();
@ -515,7 +515,7 @@ export const WorkspaceThumbnail = GObject.registerClass({
// Draggable target interface used only by ThumbnailsBox // Draggable target interface used only by ThumbnailsBox
handleDragOverInternal(source, actor, time) { handleDragOverInternal(source, actor, time) {
if (source == Main.xdndHandler) { if (source === Main.xdndHandler) {
this.metaWorkspace.activate(time); this.metaWorkspace.activate(time);
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
} }
@ -757,7 +757,7 @@ export const ThumbnailsBox = GObject.registerClass({
} }
_clearDragPlaceholder() { _clearDragPlaceholder() {
if (this._dropPlaceholderPos == -1) if (this._dropPlaceholderPos === -1)
return; return;
this._dropPlaceholderPos = -1; this._dropPlaceholderPos = -1;
@ -819,7 +819,7 @@ export const ThumbnailsBox = GObject.registerClass({
if (!source.metaWindow && if (!source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) && (!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch) && (source.app || !source.shellWorkspaceLaunch) &&
source != Main.xdndHandler) source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL; const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
@ -848,23 +848,23 @@ export const ThumbnailsBox = GObject.registerClass({
} }
} }
if (this._dropPlaceholderPos != placeholderPos) { if (this._dropPlaceholderPos !== placeholderPos) {
this._dropPlaceholderPos = placeholderPos; this._dropPlaceholderPos = placeholderPos;
this.queue_relayout(); this.queue_relayout();
} }
if (this._dropWorkspace != -1) if (this._dropWorkspace !== -1)
return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, actor, time); return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, actor, time);
else if (this._dropPlaceholderPos != -1) else if (this._dropPlaceholderPos !== -1)
return source.metaWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP; return source.metaWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP;
else else
return DND.DragMotionResult.CONTINUE; return DND.DragMotionResult.CONTINUE;
} }
acceptDrop(source, actor, x, y, time) { acceptDrop(source, actor, x, y, time) {
if (this._dropWorkspace != -1) { if (this._dropWorkspace !== -1) {
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time); return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time);
} else if (this._dropPlaceholderPos != -1) { } else if (this._dropPlaceholderPos !== -1) {
if (!source.metaWindow && if (!source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) && (!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch)) (source.app || !source.shellWorkspaceLaunch))
@ -955,7 +955,7 @@ export const ThumbnailsBox = GObject.registerClass({
} }
_destroyThumbnails() { _destroyThumbnails() {
if (this._thumbnails.length == 0) if (this._thumbnails.length === 0)
return; return;
this._transientSignalHolder.destroy(); this._transientSignalHolder.destroy();
@ -980,7 +980,7 @@ export const ThumbnailsBox = GObject.registerClass({
let removedNum = oldNumWorkspaces - newNumWorkspaces; let removedNum = oldNumWorkspaces - newNumWorkspaces;
for (let w = 0; w < oldNumWorkspaces; w++) { for (let w = 0; w < oldNumWorkspaces; w++) {
let metaWorkspace = workspaceManager.get_workspace_by_index(w); let metaWorkspace = workspaceManager.get_workspace_by_index(w);
if (this._thumbnails[w].metaWorkspace != metaWorkspace) { if (this._thumbnails[w].metaWorkspace !== metaWorkspace) {
removedIndex = w; removedIndex = w;
break; break;
} }
@ -1051,7 +1051,7 @@ export const ThumbnailsBox = GObject.registerClass({
} }
set scale(scale) { set scale(scale) {
if (this._scale == scale) if (this._scale === scale)
return; return;
this._scale = scale; this._scale = scale;
@ -1070,11 +1070,11 @@ export const ThumbnailsBox = GObject.registerClass({
} }
_iterateStateThumbnails(state, callback) { _iterateStateThumbnails(state, callback) {
if (this._stateCounts[state] == 0) if (this._stateCounts[state] === 0)
return; return;
for (let i = 0; i < this._thumbnails.length; i++) { for (let i = 0; i < this._thumbnails.length; i++) {
if (this._thumbnails[i].state == state) if (this._thumbnails[i].state === state)
callback.call(this, this._thumbnails[i]); callback.call(this, this._thumbnails[i]);
} }
} }
@ -1244,9 +1244,9 @@ export const ThumbnailsBox = GObject.registerClass({
vfunc_allocate(box) { vfunc_allocate(box) {
this.set_allocation(box); this.set_allocation(box);
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL; let rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
if (this._thumbnails.length == 0) // not visible if (this._thumbnails.length === 0) // not visible
return; return;
let themeNode = this.get_theme_node(); let themeNode = this.get_theme_node();
@ -1313,7 +1313,7 @@ export const ThumbnailsBox = GObject.registerClass({
let x = box.x1; let x = box.x1;
if (this._dropPlaceholderPos == -1) { if (this._dropPlaceholderPos === -1) {
this._dropPlaceholder.allocate_preferred_size( this._dropPlaceholder.allocate_preferred_size(
...this._dropPlaceholder.get_position()); ...this._dropPlaceholder.get_position());

View File

@ -457,7 +457,7 @@ class WorkspacesView extends WorkspacesViewBase {
} else { } else {
workspace = this._workspaces[j]; workspace = this._workspaces[j];
if (workspace.metaWorkspace != metaWorkspace) { /* removed */ if (workspace.metaWorkspace !== metaWorkspace) { /* removed */
workspace.destroy(); workspace.destroy();
this._workspaces.splice(j, 1); this._workspaces.splice(j, 1);
} /* else kept */ } /* else kept */
@ -1082,7 +1082,7 @@ class WorkspacesDisplay extends St.Widget {
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
if (this._workspacesOnlyOnPrimary && if (this._workspacesOnlyOnPrimary &&
this._getMonitorIndexForEvent(event) != this._primaryIndex) this._getMonitorIndexForEvent(event) !== this._primaryIndex)
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
return Main.wm.handleWorkspaceScroll(event); return Main.wm.handleWorkspaceScroll(event);

View File

@ -93,7 +93,7 @@ export class XdndHandler extends Signals.EventEmitter {
let motionFunc = DND.dragMonitors[i].dragMotion; let motionFunc = DND.dragMonitors[i].dragMotion;
if (motionFunc) { if (motionFunc) {
let result = motionFunc(dragEvent); let result = motionFunc(dragEvent);
if (result != DND.DragMotionResult.CONTINUE) if (result !== DND.DragMotionResult.CONTINUE)
return; return;
} }
} }
@ -106,7 +106,7 @@ export class XdndHandler extends Signals.EventEmitter {
targX, targX,
targY, targY,
global.get_current_time()); global.get_current_time());
if (result != DND.DragMotionResult.CONTINUE) if (result !== DND.DragMotionResult.CONTINUE)
return; return;
} }
pickedActor = pickedActor.get_parent(); pickedActor = pickedActor.get_parent();

View File

@ -1,5 +1,4 @@
rules: rules:
eqeqeq: off
jsdoc/check-alignment: off jsdoc/check-alignment: off
jsdoc/check-param-names: off jsdoc/check-param-names: off
jsdoc/check-tag-names: off jsdoc/check-tag-names: off