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;
let reauthenticationOnly;
if (this._mode == AuthPromptMode.UNLOCK_ONLY)
if (this._mode === AuthPromptMode.UNLOCK_ONLY)
reauthenticationOnly = true;
else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN)
else if (this._mode === AuthPromptMode.UNLOCK_OR_LOG_IN)
reauthenticationOnly = false;
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, {reauthenticationOnly});
@ -337,7 +337,7 @@ export const AuthPrompt = GObject.registerClass({
}
_onCredentialManagerAuthenticated() {
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset();
}
@ -352,11 +352,11 @@ export const AuthPrompt = GObject.registerClass({
// 2) Don't reset if we've already succeeded at verification and
// the user is getting logged in.
if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
this.verificationStatus == AuthPromptStatus.VERIFYING &&
this.verificationStatus === AuthPromptStatus.VERIFYING &&
this.smartcardDetected)
return;
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
this.reset();
}
@ -419,18 +419,18 @@ export const AuthPrompt = GObject.registerClass({
oldActor.remove_all_transitions();
let wasSpinner;
if (oldActor == this._spinner)
if (oldActor === this._spinner)
wasSpinner = true;
else
wasSpinner = false;
let isSpinner;
if (actor == this._spinner)
if (actor === this._spinner)
isSpinner = true;
else
isSpinner = false;
if (this._defaultButtonWellActor != actor && oldActor) {
if (this._defaultButtonWellActor !== actor && oldActor) {
if (!animate) {
oldActor.opacity = 0;
@ -538,7 +538,7 @@ export const AuthPrompt = GObject.registerClass({
}
_fadeOutMessage() {
if (this._message.opacity == 0)
if (this._message.opacity === 0)
return;
this._message.remove_all_transitions();
this._message.ease({
@ -549,12 +549,12 @@ export const AuthPrompt = GObject.registerClass({
}
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');
else
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');
else
this._message.remove_style_class_name('login-dialog-message-hint');
@ -627,14 +627,14 @@ export const AuthPrompt = GObject.registerClass({
this._updateEntry(true);
this.stopSpinning();
if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
if (oldStatus === AuthPromptStatus.VERIFICATION_FAILED)
this.emit('failed');
else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
this.emit('cancelled');
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
// respond to the request with the username
if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
@ -694,7 +694,7 @@ export const AuthPrompt = GObject.registerClass({
}
cancel() {
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_SUCCEEDED)
return;
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_IN_PROGRESS) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -172,7 +172,7 @@ export const InputMethod = GObject.registerClass({
}
_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;
let curEvent = Clutter.get_current_event();
@ -278,23 +278,23 @@ export const InputMethod = GObject.registerClass({
vfunc_update_content_purpose(purpose) {
let ibusPurpose = 0;
if (purpose == Clutter.InputContentPurpose.NORMAL)
if (purpose === Clutter.InputContentPurpose.NORMAL)
ibusPurpose = IBus.InputPurpose.FREE_FORM;
else if (purpose == Clutter.InputContentPurpose.ALPHA)
else if (purpose === Clutter.InputContentPurpose.ALPHA)
ibusPurpose = IBus.InputPurpose.ALPHA;
else if (purpose == Clutter.InputContentPurpose.DIGITS)
else if (purpose === Clutter.InputContentPurpose.DIGITS)
ibusPurpose = IBus.InputPurpose.DIGITS;
else if (purpose == Clutter.InputContentPurpose.NUMBER)
else if (purpose === Clutter.InputContentPurpose.NUMBER)
ibusPurpose = IBus.InputPurpose.NUMBER;
else if (purpose == Clutter.InputContentPurpose.PHONE)
else if (purpose === Clutter.InputContentPurpose.PHONE)
ibusPurpose = IBus.InputPurpose.PHONE;
else if (purpose == Clutter.InputContentPurpose.URL)
else if (purpose === Clutter.InputContentPurpose.URL)
ibusPurpose = IBus.InputPurpose.URL;
else if (purpose == Clutter.InputContentPurpose.EMAIL)
else if (purpose === Clutter.InputContentPurpose.EMAIL)
ibusPurpose = IBus.InputPurpose.EMAIL;
else if (purpose == Clutter.InputContentPurpose.NAME)
else if (purpose === Clutter.InputContentPurpose.NAME)
ibusPurpose = IBus.InputPurpose.NAME;
else if (purpose == Clutter.InputContentPurpose.PASSWORD)
else if (purpose === Clutter.InputContentPurpose.PASSWORD)
ibusPurpose = IBus.InputPurpose.PASSWORD;
else if (purpose === Clutter.InputContentPurpose.TERMINAL &&
IBus.InputPurpose.TERMINAL)
@ -325,7 +325,7 @@ export const InputMethod = GObject.registerClass({
if (state & IBus.ModifierType.IGNORED_MASK)
return false;
if (event.type() == Clutter.EventType.KEY_RELEASE)
if (event.type() === Clutter.EventType.KEY_RELEASE)
state |= IBus.ModifierType.RELEASE_MASK;
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
state, -1, this._cancellable,
(context, res) => {
if (context != this._context)
if (context !== this._context)
return;
try {

View File

@ -81,7 +81,7 @@ export class IntrospectService {
for (let app of apps) {
let appInfo = {};
let isAppActive = focusedApp == app;
let isAppActive = focusedApp === app;
if (!this._isStandaloneApp(app))
continue;
@ -100,7 +100,7 @@ export class IntrospectService {
if (this._runningApplicationsDirty ||
(this._activeApplicationDirty &&
this._activeApplication != newActiveApplication)) {
this._activeApplication !== newActiveApplication)) {
this._runningApplications = newRunningApplications;
this._activeApplication = newActiveApplication;
@ -115,10 +115,10 @@ export class IntrospectService {
return false;
let type = window.get_window_type();
return type == Meta.WindowType.NORMAL ||
type == Meta.WindowType.DIALOG ||
type == Meta.WindowType.MODAL_DIALOG ||
type == Meta.WindowType.UTILITY;
return type === Meta.WindowType.NORMAL ||
type === Meta.WindowType.DIALOG ||
type === Meta.WindowType.MODAL_DIALOG ||
type === Meta.WindowType.UTILITY;
}
async GetRunningApplicationsAsync(params, invocation) {
@ -160,7 +160,7 @@ export class IntrospectService {
'app-id': GLib.Variant.new('s', app.get_id()),
'client-type': GLib.Variant.new('u', window.get_client_type()),
'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),
'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
// not proceeded by a dot and match them against global constants
matches = text.match(/^(\w*)$/);
if (text == '' || matches) {
if (text === '' || matches) {
[expr_, attrHead] = matches;
methods = globalCompletionList.filter(
attr => attr.slice(0, attrHead.length) === attrHead);
@ -72,7 +72,7 @@ function isStopChar(c) {
export function findMatchingQuote(expr, offset) {
let quoteChar = expr.charAt(offset);
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 -1;
@ -86,7 +86,7 @@ export function findMatchingQuote(expr, offset) {
*/
export function findMatchingSlash(expr, offset) {
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 -1;
@ -120,16 +120,16 @@ export function findTheBrace(expr, offset, ...braces) {
if (offset < 0)
return -1;
if (expr.charAt(offset) == openBrace)
if (expr.charAt(offset) === openBrace)
return offset;
if (expr.charAt(offset).match(/['"]/))
return findTheBrace(expr, findMatchingQuote(expr, offset) - 1, ...braces);
if (expr.charAt(offset) == '/')
if (expr.charAt(offset) === '/')
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, offset - 1, ...braces);
@ -230,7 +230,7 @@ export function getCommonPrefix(words) {
let word = words[0];
for (let i = 0; i < word.length; i++) {
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);
}
}
@ -243,14 +243,14 @@ export function getCommonPrefix(words) {
* @param {string} str
*/
export function removeLiterals(str) {
if (str.length == 0)
if (str.length === 0)
return '';
let currChar = str.charAt(str.length - 1);
if (currChar == '"' || currChar == '\'') {
if (currChar === '"' || currChar === '\'') {
return removeLiterals(
str.slice(0, findMatchingQuote(str, str.length - 1)));
} else if (currChar == '/') {
} else if (currChar === '/') {
return removeLiterals(
str.slice(0, findMatchingSlash(str, str.length - 1)));
}

View File

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

View File

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

View File

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

View File

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

View File

@ -230,7 +230,7 @@ function lowerBound(array, val, cmp) {
let min, max, mid, v;
cmp ||= (a, b) => a - b;
if (array.length == 0)
if (array.length === 0)
return 0;
min = 0;
@ -245,7 +245,7 @@ function lowerBound(array, val, cmp) {
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) {
if (loc1 == loc2)
if (loc1 === loc2)
return true;
if (loc1 == null || loc2 == null)
@ -235,7 +235,7 @@ export class WeatherClient extends Signals.EventEmitter {
_updateLocationMonitoring() {
if (this._useAutoLocation) {
if (this._gclueLocationChangedId != 0 || this._gclueService == null)
if (this._gclueLocationChangedId !== 0 || this._gclueService == null)
return;
this._gclueLocationChangedId =
@ -280,7 +280,7 @@ export class WeatherClient extends Signals.EventEmitter {
_onAutomaticLocationChanged() {
let useAutoLocation = this._settings.get_boolean('automatic-location');
if (this._autoLocationRequested == useAutoLocation)
if (this._autoLocationRequested === useAutoLocation)
return;
this._autoLocationRequested = useAutoLocation;
@ -317,12 +317,12 @@ export class WeatherClient extends Signals.EventEmitter {
_onPermStoreChanged(proxy, sender, params) {
let [table, id, deleted_, data_, perms] = params;
if (table != 'gnome' || id != 'geolocation')
if (table !== 'gnome' || id !== 'geolocation')
return;
let permission = perms['org.gnome.Weather'] || ['NONE'];
let [accuracy] = permission;
this._weatherAuthorized = accuracy != 'NONE';
this._weatherAuthorized = accuracy !== 'NONE';
this._updateAutoLocation();
}

View File

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

View File

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

View File

@ -42,8 +42,8 @@ class Animation extends St.Bin {
}
play() {
if (this._isLoaded && this._timeoutId == 0) {
if (this._frame == 0)
if (this._isLoaded && this._timeoutId === 0) {
if (this._frame === 0)
this._showFrame(0);
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
// reach appInfos.length
if (category.length > 0 &&
categoryCounter[category] == appInfos.length)
categoryCounter[category] === appInfos.length)
categories.push(category);
}
return categories;
@ -1256,7 +1256,7 @@ var BaseAppView = GObject.registerClass({
duration: VIEWS_SWITCH_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
};
if (animationDirection == IconGrid.AnimationDirection.IN) {
if (animationDirection === IconGrid.AnimationDirection.IN) {
this.show();
params.opacity = 255;
params.delay = VIEWS_SWITCH_ANIMATION_DELAY;
@ -1604,7 +1604,7 @@ class AppDisplay extends BaseAppView {
super.animateSwitch(animationDirection);
if (this._currentDialog && this._displayingDialog &&
animationDirection == IconGrid.AnimationDirection.OUT) {
animationDirection === IconGrid.AnimationDirection.OUT) {
this._currentDialog.ease({
opacity: 0,
duration: VIEWS_SWITCH_TIME,
@ -2185,7 +2185,7 @@ class FolderView extends BaseAppView {
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
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++) {
const style = `width: ${subSize}px; height: ${subSize}px;`;
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,
// just remove the icon
if (folderApps.length == 0) {
if (folderApps.length === 0) {
this._deletingFolder = true;
// Resetting all keys deletes the relocatable schema
@ -2379,7 +2379,7 @@ export const FolderIcon = GObject.registerClass({
}
_setHoveringByDnd(hovering) {
if (this._otherIconIsHovering == hovering)
if (this._otherIconIsHovering === hovering)
return;
super._setHoveringByDnd(hovering);
@ -2441,7 +2441,7 @@ export const FolderIcon = GObject.registerClass({
_updateName() {
let name = _getFolderName(this._folder);
if (this.name == name)
if (this.name === name)
return;
this._name = name;
@ -2806,7 +2806,7 @@ export const AppFolderDialog = GObject.registerClass({
}
vfunc_key_press_event(event) {
if (global.stage.get_key_focus() != this)
if (global.stage.get_key_focus() !== this)
return Clutter.EVENT_PROPAGATE;
// 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
// languages
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()) {
case Clutter.KEY_Down:
direction = St.DirectionType.TAB_FORWARD;
@ -3062,7 +3062,7 @@ export const AppIcon = GObject.registerClass({
}
_updateRunningStyle() {
if (this.app.state != Shell.AppState.STOPPED)
if (this.app.state !== Shell.AppState.STOPPED)
this._dot.show();
else
this._dot.hide();
@ -3159,13 +3159,13 @@ export const AppIcon = GObject.registerClass({
activate(button) {
let event = Clutter.get_current_event();
let modifiers = event ? event.get_state() : 0;
let isMiddleButton = button && button == Clutter.BUTTON_MIDDLE;
let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) != 0;
let isMiddleButton = button && button === Clutter.BUTTON_MIDDLE;
let isCtrlPressed = (modifiers & Clutter.ModifierType.CONTROL_MASK) !== 0;
let openNewWindow = this.app.can_open_new_window() &&
this.app.state == Shell.AppState.RUNNING &&
this.app.state === Shell.AppState.RUNNING &&
(isCtrlPressed || isMiddleButton);
if (this.app.state == Shell.AppState.STOPPED || openNewWindow)
if (this.app.state === Shell.AppState.STOPPED || openNewWindow)
this.animateLaunch();
if (openNewWindow)
@ -3229,13 +3229,13 @@ export const AppIcon = GObject.registerClass({
_canAccept(source) {
let view = _getViewFromIcon(source);
return source != this &&
return source !== this &&
(source instanceof this.constructor) &&
(view instanceof AppDisplay);
}
_setHoveringByDnd(hovering) {
if (this._otherIconIsHovering == hovering)
if (this._otherIconIsHovering === hovering)
return;
super._setHoveringByDnd(hovering);

View File

@ -149,7 +149,7 @@ class AppFavorites extends Signals.EventEmitter {
return false;
let ids = this._getIds();
if (pos == -1)
if (pos === -1)
ids.push(appId);
else
ids.splice(pos, 0, appId);
@ -183,7 +183,7 @@ class AppFavorites extends Signals.EventEmitter {
if (!(appId in this._favorites))
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);
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -178,8 +178,8 @@ export const BoxPointer = GObject.registerClass({
let borderWidth = themeNode.get_length('-arrow-border-width');
minSize += borderWidth * 2;
natSize += borderWidth * 2;
if ((!isWidth && (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)) ||
(isWidth && (this._arrowSide == St.Side.LEFT || this._arrowSide == St.Side.RIGHT))) {
if ((!isWidth && (this._arrowSide === St.Side.TOP || this._arrowSide === St.Side.BOTTOM)) ||
(isWidth && (this._arrowSide === St.Side.LEFT || this._arrowSide === St.Side.RIGHT))) {
let rise = themeNode.get_length('-arrow-rise');
minSize += rise;
natSize += rise;
@ -258,8 +258,8 @@ export const BoxPointer = GObject.registerClass({
let [sourceWidth, sourceHeight] = this._arrowActor.get_transformed_size();
let [absX, absY] = this.get_transformed_position();
if (this._arrowSide == St.Side.TOP ||
this._arrowSide == St.Side.BOTTOM)
if (this._arrowSide === St.Side.TOP ||
this._arrowSide === St.Side.BOTTOM)
this._arrowOrigin = sourceX - absX + sourceWidth / 2;
else
this._arrowOrigin = sourceY - absY + sourceHeight / 2;
@ -275,7 +275,7 @@ export const BoxPointer = GObject.registerClass({
let [width, height] = area.get_surface_size();
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;
else
boxWidth -= rise;
@ -284,9 +284,9 @@ export const BoxPointer = GObject.registerClass({
// Translate so that box goes from 0,0 to boxWidth,boxHeight,
// with the arrow poking out of that
if (this._arrowSide == St.Side.TOP)
if (this._arrowSide === St.Side.TOP)
cr.translate(0, rise);
else if (this._arrowSide == St.Side.LEFT)
else if (this._arrowSide === St.Side.LEFT)
cr.translate(rise, 0);
let [x1, y1] = [halfBorder, halfBorder];
@ -300,37 +300,37 @@ export const BoxPointer = GObject.registerClass({
if (rise) {
switch (this._arrowSide) {
case St.Side.TOP:
if (this._arrowOrigin == x1)
if (this._arrowOrigin === x1)
skipTopLeft = true;
else if (this._arrowOrigin == x2)
else if (this._arrowOrigin === x2)
skipTopRight = true;
break;
case St.Side.RIGHT:
if (this._arrowOrigin == y1)
if (this._arrowOrigin === y1)
skipTopRight = true;
else if (this._arrowOrigin == y2)
else if (this._arrowOrigin === y2)
skipBottomRight = true;
break;
case St.Side.BOTTOM:
if (this._arrowOrigin == x1)
if (this._arrowOrigin === x1)
skipBottomLeft = true;
else if (this._arrowOrigin == x2)
else if (this._arrowOrigin === x2)
skipBottomRight = true;
break;
case St.Side.LEFT:
if (this._arrowOrigin == y1)
if (this._arrowOrigin === y1)
skipTopLeft = true;
else if (this._arrowOrigin == y2)
else if (this._arrowOrigin === y2)
skipBottomLeft = true;
break;
}
}
cr.moveTo(x1 + borderRadius, y1);
if (this._arrowSide == St.Side.TOP && rise) {
if (this._arrowSide === St.Side.TOP && rise) {
if (skipTopLeft) {
cr.moveTo(x1, y2 - borderRadius);
cr.lineTo(x1, y1 - rise);
@ -353,7 +353,7 @@ export const BoxPointer = GObject.registerClass({
3 * Math.PI / 2, Math.PI * 2);
}
if (this._arrowSide == St.Side.RIGHT && rise) {
if (this._arrowSide === St.Side.RIGHT && rise) {
if (skipTopRight) {
cr.lineTo(x2 + rise, y1);
cr.lineTo(x2 + rise, y1 + halfBase);
@ -375,7 +375,7 @@ export const BoxPointer = GObject.registerClass({
0, Math.PI / 2);
}
if (this._arrowSide == St.Side.BOTTOM && rise) {
if (this._arrowSide === St.Side.BOTTOM && rise) {
if (skipBottomLeft) {
cr.lineTo(x1 + halfBase, y2);
cr.lineTo(x1, y2 + rise);
@ -397,7 +397,7 @@ export const BoxPointer = GObject.registerClass({
Math.PI / 2, Math.PI);
}
if (this._arrowSide == St.Side.LEFT && rise) {
if (this._arrowSide === St.Side.LEFT && rise) {
if (skipTopLeft) {
cr.lineTo(x1, y1 + halfBase);
cr.lineTo(x1 - rise, y1);
@ -437,7 +437,7 @@ export const BoxPointer = GObject.registerClass({
}
setPosition(sourceActor, alignment) {
if (!this._sourceActor || sourceActor != this._sourceActor) {
if (!this._sourceActor || sourceActor !== this._sourceActor) {
this._sourceActor?.disconnectObject(this);
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 left for St.Side.TOP and St.Side.BOTTOM.
setArrowOrigin(origin) {
if (this._arrowOrigin != origin) {
if (this._arrowOrigin !== origin) {
this._arrowOrigin = origin;
this._border.queue_repaint();
}
@ -597,7 +597,7 @@ export const BoxPointer = GObject.registerClass({
// Differently from setPosition, this will not move the boxpointer itself,
// on the arrow
setArrowActor(actor) {
if (this._arrowActor != actor) {
if (this._arrowActor !== actor) {
this._arrowActor = actor;
this._border.queue_repaint();
}
@ -637,7 +637,7 @@ export const BoxPointer = GObject.registerClass({
_updateFlip(allocationBox) {
let arrowSide = this._calculateArrowSide(this._userArrowSide);
if (this._arrowSide != arrowSide) {
if (this._arrowSide !== arrowSide) {
this._arrowSide = arrowSide;
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}`;
function sameYear(dateA, dateB) {
return dateA.getYear() == dateB.getYear();
return dateA.getYear() === dateB.getYear();
}
function sameMonth(dateA, dateB) {
return sameYear(dateA, dateB) && (dateA.getMonth() == dateB.getMonth());
return sameYear(dateA, dateB) && (dateA.getMonth() === dateB.getMonth());
}
function sameDay(dateA, dateB) {
return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate());
return sameMonth(dateA, dateB) && (dateA.getDate() === dateB.getDate());
}
function _isWorkDay(date) {
@ -540,7 +540,7 @@ export const Calendar = GObject.registerClass({
});
label.accessible_name = formatDateWithCFormatString(iter, '%A');
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;
else
col = offsetCols + (7 + iter.getDay() - this._weekStart) % 7;
@ -569,16 +569,16 @@ export const Calendar = GObject.registerClass({
_onPrevMonthButtonClicked() {
let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth();
if (oldMonth == 0) {
if (oldMonth === 0) {
newDate.setMonth(11);
newDate.setFullYear(newDate.getFullYear() - 1);
if (newDate.getMonth() != 11) {
if (newDate.getMonth() !== 11) {
let day = 32 - new Date(newDate.getFullYear() - 1, 11, 32).getDate();
newDate = new Date(newDate.getFullYear() - 1, 11, day);
}
} else {
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();
newDate = new Date(newDate.getFullYear(), oldMonth - 1, day);
}
@ -592,16 +592,16 @@ export const Calendar = GObject.registerClass({
_onNextMonthButtonClicked() {
let newDate = new Date(this._selectedDate);
let oldMonth = newDate.getMonth();
if (oldMonth == 11) {
if (oldMonth === 11) {
newDate.setMonth(0);
newDate.setFullYear(newDate.getFullYear() + 1);
if (newDate.getMonth() != 0) {
if (newDate.getMonth() !== 0) {
let day = 32 - new Date(newDate.getFullYear() + 1, 0, 32).getDate();
newDate = new Date(newDate.getFullYear() + 1, 0, day);
}
} else {
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();
newDate = new Date(newDate.getFullYear(), oldMonth + 1, day);
}
@ -653,7 +653,7 @@ export const Calendar = GObject.registerClass({
this._markedAsToday = now;
let daysToWeekStart = (7 + beginDate.getDay() - this._weekStart) % 7;
let startsOnWeekStart = daysToWeekStart == 0;
let startsOnWeekStart = daysToWeekStart === 0;
let weekPadding = startsOnWeekStart ? 7 : 0;
beginDate.setDate(beginDate.getDate() - (weekPadding + daysToWeekStart));
@ -669,7 +669,7 @@ export const Calendar = GObject.registerClass({
label: formatDateWithCFormatString(iter, C_('date day number format', '%d')),
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)
button.reactive = false;
@ -690,18 +690,18 @@ export const Calendar = GObject.registerClass({
styleClass += ' calendar-weekend';
// Hack used in lieu of border-collapse - see gnome-shell.css
if (row == 2)
if (row === 2)
styleClass = `calendar-day-top ${styleClass}`;
let leftMost = rtl
? iter.getDay() == (this._weekStart + 6) % 7
: iter.getDay() == this._weekStart;
? iter.getDay() === (this._weekStart + 6) % 7
: iter.getDay() === this._weekStart;
if (leftMost)
styleClass = `calendar-day-left ${styleClass}`;
if (sameDay(now, iter))
styleClass += ' calendar-today';
else if (iter.getMonth() != this._selectedDate.getMonth())
else if (iter.getMonth() !== this._selectedDate.getMonth())
styleClass += ' calendar-other-month';
if (hasEvents)
@ -719,7 +719,7 @@ export const Calendar = GObject.registerClass({
this._buttons.push(button);
if (this._useWeekdate && iter.getDay() == 4) {
if (this._useWeekdate && iter.getDay() === 4) {
const label = new St.Label({
text: formatDateWithCFormatString(iter, '%V'),
style_class: 'calendar-week-number',
@ -733,7 +733,7 @@ export const Calendar = GObject.registerClass({
iter.setDate(iter.getDate() + 1);
if (iter.getDay() == this._weekStart)
if (iter.getDay() === this._weekStart)
row++;
}
@ -860,7 +860,7 @@ class NotificationSection extends MessageList.MessageListSection {
let message = new NotificationMessage(notification);
message.setSecondaryActor(new TimeLabel(notification.datetime));
let isUrgent = notification.urgency == MessageTray.Urgency.CRITICAL;
let isUrgent = notification.urgency === MessageTray.Urgency.CRITICAL;
notification.connectObject(
'destroy', () => {
@ -888,7 +888,7 @@ class NotificationSection extends MessageList.MessageListSection {
vfunc_map() {
this._messages.forEach(message => {
if (message.notification.urgency != MessageTray.Urgency.CRITICAL)
if (message.notification.urgency !== MessageTray.Urgency.CRITICAL)
message.notification.acknowledged = true;
});
super.vfunc_map();

View File

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

View File

@ -57,7 +57,7 @@ function isMountNonLocal(mount) {
if (volume == null)
return true;
return volume.get_identifier('class') == 'network';
return volume.get_identifier('class') === 'network';
}
function startAppForMount(app, mount) {
@ -186,12 +186,12 @@ class AutorunDispatcher {
}
_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
// mount in addMount(), so it's safe to assume filtered.length
// is always either 1 or 0.
if (filtered.length == 1)
if (filtered.length === 1)
return filtered[0];
return null;
@ -224,15 +224,15 @@ class AutorunDispatcher {
// check at the settings for the first content type
// to see whether we should ask
if (setting == AutorunSetting.IGNORE)
if (setting === AutorunSetting.IGNORE)
return; // return right away
let success = false;
let app = null;
if (setting == AutorunSetting.RUN)
if (setting === AutorunSetting.RUN)
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);
if (app)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -363,7 +363,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
}
_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)
return;
@ -732,7 +732,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
}
// 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)
this._type = DialogType.UPDATE_RESTART;
else if (this._updateInfo.UpgradeTriggered)

View File

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

View File

@ -402,7 +402,7 @@ export class ExtensionManager extends Signals.EventEmitter {
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}"`);
let extension = {

View File

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

View File

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

View File

@ -95,12 +95,12 @@ const CandidateArea = GObject.registerClass({
}
setOrientation(orientation) {
if (this._orientation == orientation)
if (this._orientation === orientation)
return;
this._orientation = orientation;
if (this._orientation == IBus.Orientation.HORIZONTAL) {
if (this._orientation === IBus.Orientation.HORIZONTAL) {
this.vertical = false;
this.remove_style_class_name('vertical');
this.add_style_class_name('horizontal');
@ -260,7 +260,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
let cursorPos = lookupTable.get_cursor_pos();
let pageSize = lookupTable.get_page_size();
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 endIndex = Math.min((page + 1) * pageSize, nCandidates);
@ -336,7 +336,7 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
_setTextAttributes(clutterText, ibusAttrList) {
let attr;
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());
}
}

View File

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

View File

@ -91,7 +91,7 @@ export const MonitorConstraint = GObject.registerClass({
}
set workArea(v) {
if (v == this._workArea)
if (v === this._workArea)
return;
this._workArea = v;
if (this.actor)
@ -200,7 +200,7 @@ export const LayoutManager = GObject.registerClass({
_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.primaryMonitor = null;
this.primaryIndex = -1;
@ -391,9 +391,9 @@ export const LayoutManager = GObject.registerClass({
display.get_monitor_scale(i)));
}
if (nMonitors == 0) {
if (nMonitors === 0) {
this.primaryIndex = this.bottomIndex = -1;
} else if (nMonitors == 1) {
} else if (nMonitors === 1) {
this.primaryIndex = this.bottomIndex = 0;
} else {
// 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.bottomMonitor = this.monitors[this.bottomIndex];
@ -445,7 +445,7 @@ export const LayoutManager = GObject.registerClass({
let haveTopLeftCorner = true;
if (i != this.primaryIndex) {
if (i !== this.primaryIndex) {
// 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)
let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
@ -454,7 +454,7 @@ export const LayoutManager = GObject.registerClass({
let aboveY = cornerY - 1;
for (let j = 0; j < this.monitors.length; j++) {
if (i == j)
if (i === j)
continue;
let otherMonitor = this.monitors[j];
if (besideX >= otherMonitor.x &&
@ -505,7 +505,7 @@ export const LayoutManager = GObject.registerClass({
_showSecondaryBackgrounds() {
for (let i = 0; i < this.monitors.length; i++) {
if (i != this.primaryIndex) {
if (i !== this.primaryIndex) {
let backgroundActor = this._bgManagers[i].backgroundActor;
backgroundActor.show();
backgroundActor.opacity = 0;
@ -540,7 +540,7 @@ export const LayoutManager = GObject.registerClass({
let bgManager = this._createBackgroundManager(i);
this._bgManagers.push(bgManager);
if (i != this.primaryIndex && this._startingUp)
if (i !== this.primaryIndex && this._startingUp)
bgManager.backgroundActor.hide();
}
@ -879,7 +879,7 @@ export const LayoutManager = GObject.registerClass({
trackChrome(actor, params = {}) {
let ancestor = actor.get_parent();
let index = this._findActor(ancestor);
while (ancestor && index == -1) {
while (ancestor && index === -1) {
ancestor = ancestor.get_parent();
index = this._findActor(ancestor);
}
@ -917,14 +917,14 @@ export const LayoutManager = GObject.registerClass({
_findActor(actor) {
for (let i = 0; i < this._trackedActors.length; i++) {
let actorData = this._trackedActors[i];
if (actorData.actor == actor)
if (actorData.actor === actor)
return i;
}
return -1;
}
_trackActor(actor, params) {
if (this._findActor(actor) != -1)
if (this._findActor(actor) !== -1)
throw new Error('trying to re-track existing chrome actor');
let actorData = Params.parse(params, defaultParams);
@ -944,7 +944,7 @@ export const LayoutManager = GObject.registerClass({
_untrackActor(actor) {
let i = this._findActor(actor);
if (i == -1)
if (i === -1)
return;
this._trackedActors.splice(i, 1);
@ -1012,7 +1012,7 @@ export const LayoutManager = GObject.registerClass({
_windowsRestacked() {
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;
if (changed) {
@ -1157,7 +1157,7 @@ class HotCorner extends Clutter.Actor {
let px = 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;
py = 0.0;
}
@ -1182,7 +1182,7 @@ class HotCorner extends Clutter.Actor {
}
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({
display: global.display,
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);
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.set_pivot_point(1.0, 0.0);
this.translation_x = -this.width;
@ -1269,7 +1269,7 @@ class HotCorner extends Clutter.Actor {
}
handleDragOver(source, _actor, _x, _y, _time) {
if (source != Main.xdndHandler)
if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
this._toggleOverview();
@ -1286,7 +1286,7 @@ class HotCorner extends Clutter.Actor {
}
_onCornerLeft(actor, event) {
if (event.get_related() != this)
if (event.get_related() !== this)
this._entered = false;
// Consume event, otherwise this will confuse onEnvironsLeft
return Clutter.EVENT_STOP;
@ -1346,7 +1346,7 @@ class PressureBarrier extends Signals.EventEmitter {
}
_isHorizontal(barrier) {
return barrier.y1 == barrier.y2;
return barrier.y1 === barrier.y2;
}
_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.
this._container.set_child_above_sibling(this, newChild);
this._children.push(newChild);
} else if (newChildIndex == 0) {
} else if (newChildIndex === 0) {
// Bottom of stack
this._children.unshift(newChild);
} else {
// Somewhere else; insert it into the correct spot
let prevChild = this._children.indexOf(children[newChildIndex - 1]);
if (prevChild != -1) // paranoia
if (prevChild !== -1) // paranoia
this._children.splice(prevChild + 1, 0, newChild);
}
}
@ -243,10 +243,10 @@ export const Lightbox = GObject.registerClass({
_actorRemoved(container, child) {
let index = this._children.indexOf(child);
if (index != -1) // paranoia
if (index !== -1) // paranoia
this._children.splice(index, 1);
if (child == this._highlighted)
if (child === this._highlighted)
this._highlighted = null;
}
@ -260,7 +260,7 @@ export const Lightbox = GObject.registerClass({
* @param {Clutter.Actor=} window actor to highlight
*/
highlight(window) {
if (this._highlighted == window)
if (this._highlighted === window)
return;
// Walk this._children raising and lowering actors as needed.
@ -271,9 +271,9 @@ export const Lightbox = GObject.registerClass({
let below = this;
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);
else if (this._children[i] == this._highlighted)
else if (this._children[i] === this._highlighted)
this._container.set_child_below_sibling(this._children[i], below);
else
below = this._children[i];

View File

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

View File

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

View File

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

View File

@ -304,14 +304,14 @@ async function _initializeUI() {
}
layoutManager.connect('startup-complete', () => {
if (actionMode == Shell.ActionMode.NONE)
if (actionMode === Shell.ActionMode.NONE)
actionMode = Shell.ActionMode.NORMAL;
if (screenShield)
screenShield.lockIfWasLocked();
if (sessionMode.currentMode != 'gdm' &&
sessionMode.currentMode != 'initial-setup') {
if (sessionMode.currentMode !== 'gdm' &&
sessionMode.currentMode !== 'initial-setup') {
GLib.log_structured(LOG_DOMAIN, GLib.LogLevelFlags.LEVEL_MESSAGE, {
'MESSAGE': `GNOME Shell started at ${_startDate}`,
'MESSAGE_ID': GNOMESHELL_STARTED_MESSAGE_ID,
@ -646,7 +646,7 @@ export function pushModal(actor, params) {
* global.get_current_time() is assumed.
*/
export function popModal(grab, timestamp) {
if (timestamp == undefined)
if (timestamp === undefined)
timestamp = global.get_current_time();
let focusIndex = _findModal(grab);
@ -664,7 +664,7 @@ export function popModal(grab, timestamp) {
record.grab.dismiss();
if (focusIndex == modalActorFocusStack.length - 1) {
if (focusIndex === modalActorFocusStack.length - 1) {
if (record.prevFocus)
record.prevFocus.disconnect(record.prevFocusDestroyId);
actionMode = record.actionMode;
@ -752,7 +752,7 @@ export function activateWindow(window, time, workspaceNum) {
if (!time)
time = global.get_current_time();
if (windowWorkspaceNum != activeWorkspaceNum) {
if (windowWorkspaceNum !== activeWorkspaceNum) {
let workspace = workspaceManager.get_workspace_by_index(windowWorkspaceNum);
workspace.activate_with_focus(window, time);
} else {
@ -811,7 +811,7 @@ function _runDeferredWork(workId) {
_deferredWorkQueue.splice(index, 1);
_deferredWorkData[workId].callback();
if (_deferredWorkQueue.length == 0 && _deferredTimeoutId > 0) {
if (_deferredWorkQueue.length === 0 && _deferredTimeoutId > 0) {
GLib.source_remove(_deferredTimeoutId);
_deferredTimeoutId = 0;
}
@ -832,7 +832,7 @@ function _runBeforeRedrawQueue() {
function _queueBeforeRedraw(workId) {
_beforeRedrawQueue.push(workId);
if (_beforeRedrawQueue.length == 1) {
if (_beforeRedrawQueue.length === 1) {
const laters = global.compositor.get_laters();
laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
_runBeforeRedrawQueue();
@ -902,7 +902,7 @@ export function queueDeferredWork(workId) {
_deferredWorkQueue.push(workId);
if (data.actor.mapped) {
_queueBeforeRedraw(workId);
} else if (_deferredTimeoutId == 0) {
} else if (_deferredTimeoutId === 0) {
_deferredTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, DEFERRED_TIMEOUT_SECONDS, () => {
_runAllDeferredWork();
_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);
if (hasColor) {
let linkColor = color.to_string().substr(0, 7);
if (linkColor != this._linkColor) {
if (linkColor !== this._linkColor) {
this._linkColor = linkColor;
this._highlightUrls();
}
@ -73,7 +73,7 @@ class URLHighlighter extends St.Label {
// Don't try to URL highlight when invisible.
// The MessageTray doesn't actually hide us, so
// 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;
// Keep Notification from seeing this and taking
@ -83,11 +83,11 @@ class URLHighlighter extends St.Label {
}
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;
const urlId = this._findUrlAtPos(event);
if (urlId != -1) {
if (urlId !== -1) {
let url = this._urls[urlId].url;
if (!url.includes(':'))
url = `http://${url}`;
@ -100,14 +100,14 @@ class URLHighlighter extends St.Label {
}
vfunc_motion_event(event) {
if (!this.visible || this.get_paint_opacity() == 0)
if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
const urlId = this._findUrlAtPos(event);
if (urlId != -1 && !this._cursorChanged) {
if (urlId !== -1 && !this._cursorChanged) {
global.display.set_cursor(Meta.Cursor.POINTING_HAND);
this._cursorChanged = true;
} else if (urlId == -1) {
} else if (urlId === -1) {
global.display.set_cursor(Meta.Cursor.DEFAULT);
this._cursorChanged = false;
}
@ -115,7 +115,7 @@ class URLHighlighter extends St.Label {
}
vfunc_leave_event(event) {
if (!this.visible || this.get_paint_opacity() == 0)
if (!this.visible || this.get_paint_opacity() === 0)
return Clutter.EVENT_PROPAGATE;
if (this._cursorChanged) {
@ -160,7 +160,7 @@ class URLHighlighter extends St.Label {
continue;
findPos = i;
}
if (findPos != -1) {
if (findPos !== -1) {
for (let i = 0; i < this._urls.length; i++) {
if (findPos >= this._urls[i].pos &&
this._urls[i].pos + this._urls[i].url.length > findPos)
@ -179,7 +179,7 @@ class ScaleLayout extends Clutter.BinLayout {
}
_connectContainer(container) {
if (this._container == container)
if (this._container === container)
return;
this._container?.disconnectObject(this);
@ -234,20 +234,20 @@ const LabelExpanderLayout = GObject.registerClass({
}
set expansion(v) {
if (v == this._expansion)
if (v === this._expansion)
return;
this._expansion = v;
this.notify('expansion');
let visibleIndex = this._expansion > 0 ? 1 : 0;
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();
}
set expandLines(v) {
if (v == this._expandLines)
if (v === this._expandLines)
return;
this._expandLines = v;
if (this._expansion > 0)
@ -542,8 +542,8 @@ export const Message = GObject.registerClass({
vfunc_key_press_event(event) {
let keysym = event.get_key_symbol();
if (keysym == Clutter.KEY_Delete ||
keysym == Clutter.KEY_KP_Delete) {
if (keysym === Clutter.KEY_Delete ||
keysym === Clutter.KEY_KP_Delete) {
if (this.canClose()) {
this.close();
return Clutter.EVENT_STOP;
@ -750,15 +750,15 @@ export const MessageListSection = GObject.registerClass({
_sync() {
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.notify('empty');
}
let canClear = messages.some(m => m.canClose());
if (this._canClear != canClear) {
if (this._canClear !== canClear) {
this._canClear = canClear;
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
// NotificationDaemon, which wants to use the same code
// for new and updated notifications
if (arguments.length != 1)
if (arguments.length !== 1)
this.update(title, banner, params);
}
@ -427,8 +427,8 @@ export const Notification = GObject.registerClass({
if (params.clear)
this.actions = [];
if (this._soundName != params.soundName ||
this._soundFile != params.soundFile) {
if (this._soundName !== params.soundName ||
this._soundFile !== params.soundFile) {
this._soundName = params.soundName;
this._soundFile = params.soundFile;
this._soundPlayed = false;
@ -707,13 +707,13 @@ export const Source = GObject.registerClass({
}
get narrowestPrivacyScope() {
return this.notifications.every(n => n.privacyScope == PrivacyScope.SYSTEM)
return this.notifications.every(n => n.privacyScope === PrivacyScope.SYSTEM)
? PrivacyScope.SYSTEM
: PrivacyScope.USER;
}
setTitle(newTitle) {
if (this.title == newTitle)
if (this.title === newTitle)
return;
this.title = newTitle;
@ -746,7 +746,7 @@ export const Source = GObject.registerClass({
this.notifications.splice(index, 1);
this.countUpdated();
if (this.notifications.length == 0)
if (this.notifications.length === 0)
this.destroy();
}
@ -772,7 +772,7 @@ export const Source = GObject.registerClass({
if (notification.urgency === Urgency.LOW)
return;
if (this.policy.showBanners || notification.urgency == Urgency.CRITICAL)
if (this.policy.showBanners || notification.urgency === Urgency.CRITICAL)
this.emit('notification-show', notification);
}
@ -935,7 +935,7 @@ export const MessageTray = GObject.registerClass({
}
_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();
return Clutter.EVENT_STOP;
}
@ -953,7 +953,7 @@ export const MessageTray = GObject.registerClass({
}
set bannerBlocked(v) {
if (this._bannerBlocked == v)
if (this._bannerBlocked === v)
return;
this._bannerBlocked = v;
this._updateState();
@ -1003,7 +1003,7 @@ export const MessageTray = GObject.registerClass({
let wasEnabled = this.contains(source);
let shouldBeEnabled = policy.enable;
if (wasEnabled != shouldBeEnabled) {
if (wasEnabled !== shouldBeEnabled) {
if (shouldBeEnabled)
this._addSource(source);
else
@ -1029,7 +1029,7 @@ export const MessageTray = GObject.registerClass({
}
_onNotificationShow(_source, notification) {
if (this._notification == notification) {
if (this._notification === notification) {
// If a notification that is being shown is updated, we update
// how it is shown and extend the time until it auto-hides.
// 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.
let bannerCount = this._notification ? 1 : 0;
let full = this.queueCount + bannerCount >= MAX_NOTIFICATIONS_IN_QUEUE;
if (!full || notification.urgency == Urgency.CRITICAL) {
if (!full || notification.urgency === Urgency.CRITICAL) {
notification.connect('destroy',
this._onNotificationDestroy.bind(this));
this._notificationQueue.push(notification);
@ -1064,7 +1064,7 @@ export const MessageTray = GObject.registerClass({
}
_onNotificationHoverChanged() {
if (this._bannerBin.hover == this._notificationHovered)
if (this._bannerBin.hover === this._notificationHovered)
return;
this._notificationHovered = this._bannerBin.hover;
@ -1108,11 +1108,11 @@ export const MessageTray = GObject.registerClass({
}
_onStatusChanged(status) {
if (status == GnomeSession.PresenceStatus.BUSY) {
if (status === GnomeSession.PresenceStatus.BUSY) {
// remove notification and allow the summary to be closed now
this._updateNotificationTimeout(0);
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
// so that we don't start showing notifications queued during the BUSY state
// as the screensaver gets activated.
@ -1182,19 +1182,19 @@ export const MessageTray = GObject.registerClass({
let hasNotifications = Main.sessionMode.hasNotifications;
if (this._notificationState == State.HIDDEN) {
if (this._notificationState === State.HIDDEN) {
let nextNotification = this._notificationQueue[0] || null;
if (hasNotifications && nextNotification) {
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)
this._showNotification();
}
} else if (this._notificationState === State.SHOWING ||
this._notificationState === State.SHOWN) {
let expired = (this._userActiveWhileNotificationShown &&
this._notificationTimeoutId == 0 &&
this._notification.urgency != Urgency.CRITICAL &&
this._notificationTimeoutId === 0 &&
this._notification.urgency !== Urgency.CRITICAL &&
!this._banner.focused &&
!this._pointerInNotification) || this._notificationExpired;
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
// is on in the control center.
if (this._notification.urgency == Urgency.CRITICAL ||
if (this._notification.urgency === Urgency.CRITICAL ||
this._notification.source.policy.forceExpanded)
this._expandBanner(true);
@ -1307,7 +1307,7 @@ export const MessageTray = GObject.registerClass({
}
_showNotificationCompleted() {
if (this._notification.urgency != Urgency.CRITICAL)
if (this._notification.urgency !== Urgency.CRITICAL)
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT);
}
@ -1333,7 +1333,7 @@ export const MessageTray = GObject.registerClass({
// simpler.)
this._updateNotificationTimeout(1000);
} 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
// popped up under the pointer, and the pointer is hovering
// inside it.

View File

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

View File

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

View File

@ -77,9 +77,9 @@ class FdoNotificationDaemon {
_iconForNotificationData(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)});
else if (icon[0] == '/')
else if (icon[0] === '/')
return new Gio.FileIcon({file: Gio.File.new_for_path(icon)});
else
return new Gio.ThemedIcon({name: icon});
@ -90,7 +90,7 @@ class FdoNotificationDaemon {
_lookupSource(title, pid) {
for (let i = 0; i < this._sources.length; i++) {
let source = this._sources[i];
if (source.pid == pid && source.initialTitle == title)
if (source.pid === pid && source.initialTitle === title)
return source;
}
return null;
@ -151,7 +151,7 @@ class FdoNotificationDaemon {
//
// Note that empathy uses im.received for one to one chats and
// 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
// NotificationClosed for that id.
id = this._nextNotificationId++;
@ -186,7 +186,7 @@ class FdoNotificationDaemon {
hints,
timeout,
};
if (replacesId != 0 && this._notifications[replacesId]) {
if (replacesId !== 0 && this._notifications[replacesId]) {
ndata.id = id = replacesId;
ndata.notification = this._notifications[replacesId].notification;
} else {
@ -254,7 +254,7 @@ class FdoNotificationDaemon {
if (actions.length) {
for (let i = 0; i < actions.length - 1; i += 2) {
let [actionId, label] = [actions[i], actions[i + 1]];
if (actionId == 'default') {
if (actionId === 'default') {
hasDefaultAction = true;
} else {
notification.addAction(label, () => {
@ -291,7 +291,7 @@ class FdoNotificationDaemon {
notification.setTransient(!!hints['transient']);
let privacyScope = hints['x-gnome-privacy-scope'] || 'user';
notification.setPrivacyScope(privacyScope == 'system'
notification.setPrivacyScope(privacyScope === 'system'
? MessageTray.PrivacyScope.SYSTEM
: MessageTray.PrivacyScope.USER);
@ -392,7 +392,7 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
this.iconUpdated();
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);
else
this.showNotification(notification);
@ -489,7 +489,7 @@ class GtkNotificationDaemonNotification extends MessageTray.Notification {
if (priority) {
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) {
this.setUrgency(urgent.unpack()
? MessageTray.Urgency.CRITICAL
@ -707,7 +707,7 @@ class GtkNotificationDaemon {
if (value) {
let sources = value.deepUnpack();
sources.forEach(([appId, notifications]) => {
if (notifications.length == 0)
if (notifications.length === 0)
return;
let source;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,7 +91,7 @@ const AppMenuButton = GObject.registerClass({
this._iconBox.connect('style-changed', () => {
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({
@ -178,9 +178,9 @@ const AppMenuButton = GObject.registerClass({
_onAppStateChanged(appSys, app) {
let state = app.state;
if (state != Shell.AppState.STARTING)
this._startingApps = this._startingApps.filter(a => a != app);
else if (state == Shell.AppState.STARTING)
if (state !== Shell.AppState.STARTING)
this._startingApps = this._startingApps.filter(a => a !== app);
else if (state === Shell.AppState.STARTING)
this._startingApps.push(app);
// 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
@ -221,7 +221,7 @@ const AppMenuButton = GObject.registerClass({
_sync() {
let targetApp = this._findTargetApp();
if (this._targetApp != targetApp) {
if (this._targetApp !== targetApp) {
this._targetApp?.disconnectObject(this);
this._targetApp = targetApp;
@ -242,7 +242,7 @@ const AppMenuButton = GObject.registerClass({
this.fadeOut();
let isBusy = this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING ||
(this._targetApp.get_state() === Shell.AppState.STARTING ||
this._targetApp.get_busy());
if (isBusy)
this.startAnimation();
@ -287,10 +287,10 @@ class ActivitiesButton extends PanelMenu.Button {
}
handleDragOver(source, _actor, _x, _y, _time) {
if (source != Main.xdndHandler)
if (source !== Main.xdndHandler)
return DND.DragMotionResult.CONTINUE;
if (this._xdndTimeOut != 0)
if (this._xdndTimeOut !== 0)
GLib.source_remove(this._xdndTimeOut);
this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
this._xdndToggleOverview();
@ -301,8 +301,8 @@ class ActivitiesButton extends PanelMenu.Button {
}
vfunc_event(event) {
if (event.type() == Clutter.EventType.TOUCH_END ||
event.type() == Clutter.EventType.BUTTON_RELEASE) {
if (event.type() === Clutter.EventType.TOUCH_END ||
event.type() === Clutter.EventType.BUTTON_RELEASE) {
if (Main.overview.shouldToggleByCornerOrButton())
Main.overview.toggle();
}
@ -312,7 +312,7 @@ class ActivitiesButton extends PanelMenu.Button {
vfunc_key_release_event(event) {
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()) {
Main.overview.toggle();
return Clutter.EVENT_STOP;
@ -326,7 +326,7 @@ class ActivitiesButton extends PanelMenu.Button {
let [x, y] = global.get_pointer();
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();
GLib.source_remove(this._xdndTimeOut);
@ -542,7 +542,7 @@ class Panel extends St.Widget {
childBox.y1 = 0;
childBox.y2 = allocHeight;
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = Math.max(
allocWidth - Math.min(Math.floor(sideWidth), leftNaturalWidth),
0);
@ -561,7 +561,7 @@ class Panel extends St.Widget {
childBox.y1 = 0;
childBox.y2 = allocHeight;
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
if (this.get_text_direction() === Clutter.TextDirection.RTL) {
childBox.x1 = 0;
childBox.x2 = Math.min(Math.floor(sideWidth), rightNaturalWidth);
} else {
@ -610,7 +610,7 @@ class Panel extends St.Widget {
vfunc_key_press_event(event) {
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_Escape) {
if (symbol === Clutter.KEY_Escape) {
global.display.focus_default_window(event.get_time());
return Clutter.EVENT_STOP;
}
@ -785,7 +785,7 @@ class Panel extends St.Widget {
else if (this._rightBox.contains(indicator.container))
boxAlignment = Clutter.ActorAlign.END;
if (boxAlignment == Main.messageTray.bannerAlignment)
if (boxAlignment === Main.messageTray.bannerAlignment)
Main.messageTray.bannerBlocked = isOpen;
});
}
@ -800,7 +800,7 @@ class Panel extends St.Widget {
let rect = metaWindow.get_frame_rect();
return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP &&
metaWindow.get_window_type() !== Meta.WindowType.DESKTOP &&
metaWindow.maximized_vertically &&
stageX > rect.x && stageX < rect.x + rect.width;
});

View File

@ -139,8 +139,8 @@ export const Button = GObject.registerClass({
vfunc_event(event) {
if (this.menu &&
(event.type() == Clutter.EventType.TOUCH_BEGIN ||
event.type() == Clutter.EventType.BUTTON_PRESS))
(event.type() === Clutter.EventType.TOUCH_BEGIN ||
event.type() === Clutter.EventType.BUTTON_PRESS))
this.menu.toggle();
return Clutter.EVENT_PROPAGATE;
@ -158,10 +158,10 @@ export const Button = GObject.registerClass({
return Clutter.EVENT_STOP;
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);
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);
return Clutter.EVENT_STOP;
}

View File

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

View File

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

View File

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

View File

@ -170,7 +170,7 @@ export function loadRemoteSearchProviders(searchSettings) {
idxB = sortOrder.indexOf(appIdB);
// 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 nameB = providerB.appInfo.get_name();
@ -178,11 +178,11 @@ export function loadRemoteSearchProviders(searchSettings) {
}
// if providerA isn't found, it's sorted after providerB
if (idxA == -1)
if (idxA === -1)
return 1;
// if providerB isn't found, it's sorted after providerA
if (idxB == -1)
if (idxB === -1)
return -1;
// 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) {
let text = o.get_text();
let prefix;
if (text.lastIndexOf(' ') == -1)
if (text.lastIndexOf(' ') === -1)
prefix = text;
else
prefix = text.substr(text.lastIndexOf(' ') + 1);
@ -138,10 +138,10 @@ class RunDialog extends ModalDialog.ModalDialog {
let k = 0;
for (; k < s1.length && k < s2.length; k++) {
if (s1[k] != s2[k])
if (s1[k] !== s2[k])
break;
}
if (k == 0)
if (k === 0)
return '';
return s1.substr(0, k);
}
@ -156,7 +156,7 @@ class RunDialog extends ModalDialog.ModalDialog {
let info;
while ((info = fileEnum.next_file(null))) {
let name = info.get_name();
if (name.slice(0, text.length) == text)
if (name.slice(0, text.length) === text)
results.push(name);
}
} catch (e) {
@ -205,10 +205,10 @@ class RunDialog extends ModalDialog.ModalDialog {
} catch (e) {
// Mmmh, that failed - see if @input matches an existing file
let path = null;
if (input.charAt(0) == '/') {
if (input.charAt(0) === '/') {
path = input;
} else if (input) {
if (input.charAt(0) == '~')
if (input.charAt(0) === '~')
input = input.slice(1);
path = `${GLib.get_home_dir()}/${input}`;
}

View File

@ -159,7 +159,7 @@ export class ScreenShield extends Signals.EventEmitter {
let prevIsActive = this._isActive;
this._isActive = active;
if (prevIsActive != this._isActive)
if (prevIsActive !== this._isActive)
this.emit('active-changed');
this._syncInhibitor();
@ -254,7 +254,7 @@ export class ScreenShield extends Signals.EventEmitter {
}
_onStatusChanged(status) {
if (status != GnomeSession.PresenceStatus.IDLE)
if (status !== GnomeSession.PresenceStatus.IDLE)
return;
this._maybeCancelDialog();
@ -278,7 +278,7 @@ export class ScreenShield extends Signals.EventEmitter {
return;
}
if (this._activationTime == 0)
if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time();
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);
lightbox.lightOn(time);
if (this._becameActiveId == 0)
if (this._becameActiveId === 0)
this._becameActiveId = this.idleMonitor.add_user_active_watch(this._onUserBecameActive.bind(this));
}
@ -390,7 +390,7 @@ export class ScreenShield extends Signals.EventEmitter {
}
_hideLockScreen(animate) {
if (this._lockScreenState == MessageTray.State.HIDDEN)
if (this._lockScreenState === MessageTray.State.HIDDEN)
return;
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
// fires while the user is dragging (which has the potential
// to confuse our state)
if (this._lockScreenState != MessageTray.State.HIDDEN)
if (this._lockScreenState !== MessageTray.State.HIDDEN)
return;
this._lockScreenGroup.show();
@ -544,7 +544,7 @@ export class ScreenShield extends Signals.EventEmitter {
_continueDeactivate(animate) {
this._hideLockScreen(animate);
if (Main.sessionMode.currentMode == 'unlock-dialog')
if (Main.sessionMode.currentMode === 'unlock-dialog')
Main.sessionMode.popMode('unlock-dialog');
this.emit('wake-up-screen');
@ -590,12 +590,12 @@ export class ScreenShield extends Signals.EventEmitter {
this.actor.hide();
if (this._becameActiveId != 0) {
if (this._becameActiveId !== 0) {
this.idleMonitor.remove_watch(this._becameActiveId);
this._becameActiveId = 0;
}
if (this._lockTimeoutId != 0) {
if (this._lockTimeoutId !== 0) {
GLib.source_remove(this._lockTimeoutId);
this._lockTimeoutId = 0;
}
@ -607,7 +607,7 @@ export class ScreenShield extends Signals.EventEmitter {
}
activate(animate) {
if (this._activationTime == 0)
if (this._activationTime === 0)
this._activationTime = GLib.get_monotonic_time();
if (!this._ensureUnlockDialog(true))

View File

@ -2377,7 +2377,7 @@ export class ScreenshotService {
}
_createStream(filename, invocation) {
if (filename == '')
if (filename === '')
return [Gio.MemoryOutputStream.new_resizable(), null];
if (GLib.path_is_absolute(filename)) {
@ -2664,7 +2664,7 @@ class SelectArea extends St.Widget {
}
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;
[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[');
for (let i = 0; i < monitors.length; i++) {
let monitor = monitors[i];
if (i != 0)
if (i !== 0)
Shell.write_string_to_stream(out, ', ');
const prefix = i === primary ? '*' : '';
Shell.write_string_to_stream(out,

View File

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

View File

@ -105,7 +105,7 @@ const _modes = {
function _loadMode(file, info) {
let name = info.get_name();
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))
return;
@ -171,7 +171,7 @@ export class SessionMode extends Signals.EventEmitter {
}
popMode(mode) {
if (this.currentMode != mode || this._modeStack.length === 1)
if (this.currentMode !== mode || this._modeStack.length === 1)
throw new Error('Invalid SessionMode.popMode');
console.debug(`sessionMode: Popping mode ${mode}`);
@ -180,7 +180,7 @@ export class SessionMode extends Signals.EventEmitter {
}
switchMode(to) {
if (this.currentMode == to)
if (this.currentMode === to)
return;
this._modeStack[this._modeStack.length - 1] = to;
this._sync();

View File

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

View File

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

View File

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

View File

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

View File

@ -63,7 +63,7 @@ class DwellClickIndicator extends PanelMenu.Button {
_syncMenuVisibility() {
this.visible =
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;
}
@ -74,7 +74,7 @@ class DwellClickIndicator extends PanelMenu.Button {
_updateClickType(manager, clickType) {
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;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ export function mod(a, b) {
}
function primaryModifier(mask) {
if (mask == 0)
if (mask === 0)
return 0;
let primary = 1;
@ -99,14 +99,14 @@ export const SwitcherPopup = GObject.registerClass({
_initialSelection(backward, _binding) {
if (backward)
this._select(this._items.length - 1);
else if (this._items.length == 1)
else if (this._items.length === 1)
this._select(0);
else
this._select(1);
}
show(backward, binding, mask) {
if (this._items.length == 0)
if (this._items.length === 0)
return false;
let grab = Main.pushModal(this);
@ -190,7 +190,7 @@ export const SwitcherPopup = GObject.registerClass({
this._disableHover();
if (this._keyPressHandler(keysym, action) != Clutter.EVENT_PROPAGATE) {
if (this._keyPressHandler(keysym, action) !== Clutter.EVENT_PROPAGATE) {
this._showImmediately();
return Clutter.EVENT_STOP;
}
@ -216,7 +216,7 @@ export const SwitcherPopup = GObject.registerClass({
let [x_, y_, mods] = global.get_pointer();
let state = mods & this._modifierMask;
if (state == 0)
if (state === 0)
this._finish(event.get_time());
} else {
this._resetNoModsTimeout();
@ -232,9 +232,9 @@ export const SwitcherPopup = GObject.registerClass({
}
_scrollHandler(direction) {
if (direction == Clutter.ScrollDirection.UP)
if (direction === Clutter.ScrollDirection.UP)
this._select(this._previous());
else if (direction == Clutter.ScrollDirection.DOWN)
else if (direction === Clutter.ScrollDirection.DOWN)
this._select(this._next());
}
@ -288,7 +288,7 @@ export const SwitcherPopup = GObject.registerClass({
_disableHover() {
this.mouseActive = false;
if (this._motionTimeoutId != 0)
if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId);
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() {
if (this._noModsTimeoutId != 0)
if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId);
this._noModsTimeoutId = GLib.timeout_add(
@ -344,11 +344,11 @@ export const SwitcherPopup = GObject.registerClass({
_onDestroy() {
this._popModal();
if (this._motionTimeoutId != 0)
if (this._motionTimeoutId !== 0)
GLib.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0)
if (this._initialDelayTimeoutId !== 0)
GLib.source_remove(this._initialDelayTimeoutId);
if (this._noModsTimeoutId != 0)
if (this._noModsTimeoutId !== 0)
GLib.source_remove(this._noModsTimeoutId);
// 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) {
let userName;
if (beginRequest == AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
if (beginRequest === AuthPrompt.BeginRequestType.PROVIDE_USERNAME) {
this._authPrompt.setUser(this._user);
userName = this._userName;
} else {

View File

@ -170,7 +170,7 @@ class UserWidget extends St.BoxLayout {
// If user is null, that implies a username-based login authorization.
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 styleClass = vertical ? 'user-widget vertical' : 'user-widget horizontal';

View File

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

View File

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

View File

@ -445,7 +445,7 @@ export const WindowPreview = GObject.registerClass({
parent = parent.get_transient_for();
// 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);
// 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) {
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) {
this._activate();
return true;

View File

@ -1069,7 +1069,7 @@ class Workspace extends St.Widget {
this.monitorIndex = 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');
const clickAction = new Clutter.ClickAction();
@ -1130,7 +1130,7 @@ class Workspace extends St.Widget {
}
_lookupIndex(metaWindow) {
return this._windows.findIndex(w => w.metaWindow == metaWindow);
return this._windows.findIndex(w => w.metaWindow === metaWindow);
}
containsMetaWindow(metaWindow) {
@ -1138,7 +1138,7 @@ class Workspace extends St.Widget {
}
isEmpty() {
return this._windows.length == 0;
return this._windows.length === 0;
}
syncStacking(stackIndices) {
@ -1199,7 +1199,7 @@ class Workspace extends St.Widget {
// the compositor finds out about them...
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
if (metaWin.get_compositor_private() &&
metaWin.get_workspace() == this.metaWorkspace)
metaWin.get_workspace() === this.metaWorkspace)
this._doAddWindow(metaWin);
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
// now was moved to this workspace
if (this._lookupIndex(metaWin) != -1)
if (this._lookupIndex(metaWin) !== -1)
return;
if (!this._isMyWindow(metaWin))
@ -1229,7 +1229,7 @@ class Workspace extends St.Widget {
// Let the top-most ancestor handle all transients
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
// and will take care of the dialog when added
@ -1276,7 +1276,7 @@ class Workspace extends St.Widget {
}
_windowLeftMonitor(metaDisplay, monitorIndex, metaWin) {
if (monitorIndex == this.monitorIndex)
if (monitorIndex === this.monitorIndex)
this._doRemoveWindow(metaWin);
}
@ -1376,7 +1376,7 @@ class Workspace extends St.Widget {
this._container.layout_manager.addWindow(clone, metaWindow);
if (this._windows.length == 0)
if (this._windows.length === 0)
clone.setStackAbove(null);
else
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
let index = this._lookupIndex(metaWin);
if (index == -1)
if (index === -1)
return null;
this._container.layout_manager.removeWindow(this._windows[index]);

View File

@ -68,7 +68,7 @@ class WorkspaceSwitcherPopup extends Clutter.Actor {
this._activeWorkspaceIndex = activeWorkspaceIndex;
this._redisplay();
if (this._timeoutId != 0)
if (this._timeoutId !== 0)
GLib.source_remove(this._timeoutId);
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');

View File

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

View File

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

View File

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

View File

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