cleanup: Use new indentation style for arrays

We've made some progress on transitioning to the modern indentation
style, and for arrays the legacy style is now rare enough to make
a bulk transition feasible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2200>
This commit is contained in:
Florian Müllner 2020-03-27 14:18:34 +01:00 committed by Marge Bot
parent 696965c9f7
commit ac9fbe92e5
15 changed files with 125 additions and 75 deletions

View File

@ -1192,8 +1192,10 @@ var LoginDialog = GObject.registerClass({
this._updateCancelButton();
let batch = new Batch.ConcurrentBatch(this, [GdmUtil.cloneAndFadeOutActor(this._userSelectionBox),
this._beginVerificationForItem(activatedItem)]);
const batch = new Batch.ConcurrentBatch(this, [
GdmUtil.cloneAndFadeOutActor(this._userSelectionBox),
this._beginVerificationForItem(activatedItem),
]);
batch.run();
}

View File

@ -73,12 +73,13 @@ function waitSignal(object, signal) {
}
function extractBootTimestamp() {
let sp = Gio.Subprocess.new(['journalctl', '-b',
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
'UNIT=graphical.target',
'-o',
'json'],
Gio.SubprocessFlags.STDOUT_PIPE);
const sp = Gio.Subprocess.new([
'journalctl', '-b',
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
'UNIT=graphical.target',
'-o',
'json',
], Gio.SubprocessFlags.STDOUT_PIPE);
let result = null;
let datastream = Gio.DataInputStream.new(sp.get_stdout_pipe());

View File

@ -425,10 +425,12 @@ var VPNRequestHandler = class {
let connectionSetting = connection.get_setting_connection();
let argv = [authHelper.fileName,
'-u', connectionSetting.uuid,
'-n', connectionSetting.id,
'-s', serviceType];
const argv = [
authHelper.fileName,
'-u', connectionSetting.uuid,
'-n', connectionSetting.id,
'-s', serviceType,
];
if (authHelper.externalUIMode)
argv.push('--external-ui-mode');
if (flags & NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION)

View File

@ -145,10 +145,12 @@ class TelepathyClient extends Tp.BaseClient {
factory.add_account_features([Tp.Account.get_feature_quark_connection()]);
factory.add_connection_features([Tp.Connection.get_feature_quark_contact_list()]);
factory.add_channel_features([Tp.Channel.get_feature_quark_contacts()]);
factory.add_contact_features([Tp.ContactFeature.ALIAS,
Tp.ContactFeature.AVATAR_DATA,
Tp.ContactFeature.PRESENCE,
Tp.ContactFeature.SUBSCRIPTION_STATES]);
factory.add_contact_features([
Tp.ContactFeature.ALIAS,
Tp.ContactFeature.AVATAR_DATA,
Tp.ContactFeature.PRESENCE,
Tp.ContactFeature.SUBSCRIPTION_STATES,
]);
// Set up a SimpleObserver, which will call _observeChannels whenever a
// channel matching its filters is detected.

View File

@ -8,14 +8,18 @@ const Main = imports.ui.main;
var MAX_CANDIDATES_PER_PAGE = 16;
var DEFAULT_INDEX_LABELS = ['1', '2', '3', '4', '5', '6', '7', '8',
'9', '0', 'a', 'b', 'c', 'd', 'e', 'f'];
var DEFAULT_INDEX_LABELS = [
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'a', 'b', 'c', 'd', 'e', 'f',
];
var CandidateArea = GObject.registerClass({
Signals: {
'candidate-clicked': { param_types: [GObject.TYPE_UINT,
GObject.TYPE_UINT,
Clutter.ModifierType.$gtype] },
'candidate-clicked': {
param_types: [
GObject.TYPE_UINT, GObject.TYPE_UINT, Clutter.ModifierType.$gtype,
],
},
'cursor-down': {},
'cursor-up': {},
'next-page': {},

View File

@ -802,8 +802,10 @@ var ZoomRegion = class ZoomRegion {
}
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
let [xFocus, yFocus] = [(extents.x + (extents.width / 2)) * scaleFactor,
(extents.y + (extents.height / 2)) * scaleFactor];
const [xFocus, yFocus] = [
(extents.x + (extents.width / 2)) * scaleFactor,
(extents.y + (extents.height / 2)) * scaleFactor,
];
if (this._xFocus !== xFocus || this._yFocus !== yFocus) {
[this._xFocus, this._yFocus] = [xFocus, yFocus];
@ -997,9 +999,11 @@ var ZoomRegion = class ZoomRegion {
let roiWidth = this._viewPortWidth / this._xMagFactor;
let roiHeight = this._viewPortHeight / this._yMagFactor;
return [this._xCenter - roiWidth / 2,
this._yCenter - roiHeight / 2,
roiWidth, roiHeight];
return [
this._xCenter - roiWidth / 2,
this._yCenter - roiHeight / 2,
roiWidth, roiHeight,
];
}
/**
@ -1580,8 +1584,10 @@ var ZoomRegion = class ZoomRegion {
_screenToViewPort(screenX, screenY) {
// Converts coordinates relative to the (unmagnified) screen to coordinates
// relative to the origin of this._magView
return [this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor];
return [
this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor,
];
}
_updateMagViewGeometry() {

View File

@ -192,16 +192,20 @@ class ScaleLayout extends Clutter.BinLayout {
this._connectContainer(container);
let [min, nat] = super.vfunc_get_preferred_width(container, forHeight);
return [Math.floor(min * container.scale_x),
Math.floor(nat * container.scale_x)];
return [
Math.floor(min * container.scale_x),
Math.floor(nat * container.scale_x),
];
}
vfunc_get_preferred_height(container, forWidth) {
this._connectContainer(container);
let [min, nat] = super.vfunc_get_preferred_height(container, forWidth);
return [Math.floor(min * container.scale_y),
Math.floor(nat * container.scale_y)];
return [
Math.floor(min * container.scale_y),
Math.floor(nat * container.scale_y),
];
}
});
@ -275,10 +279,14 @@ var LabelExpanderLayout = GObject.registerClass({
if (children[1]) {
let [min2, nat2] = children[1].get_preferred_height(forWidth);
let [expMin, expNat] = [Math.min(min2, min * this._expandLines),
Math.min(nat2, nat * this._expandLines)];
[min, nat] = [min + this._expansion * (expMin - min),
nat + this._expansion * (expNat - nat)];
const [expMin, expNat] = [
Math.min(min2, min * this._expandLines),
Math.min(nat2, nat * this._expandLines),
];
[min, nat] = [
min + this._expansion * (expMin - min),
nat + this._expansion * (expNat - nat),
];
}
return [min, nat];

View File

@ -43,8 +43,10 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
_imageForNotificationData(hints) {
if (hints['image-data']) {
let [width, height, rowStride, hasAlpha,
bitsPerSample, nChannels_, data] = hints['image-data'];
const [
width, height, rowStride, hasAlpha,
bitsPerSample, nChannels_, data,
] = hints['image-data'];
return Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
bitsPerSample, width, height, rowStride);
} else if (hints['image-path']) {
@ -195,9 +197,8 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
}
_notifyForSource(source, ndata) {
let [id_, icon, summary, body, actions, hints, notification] =
[ndata.id, ndata.icon, ndata.summary, ndata.body,
ndata.actions, ndata.hints, ndata.notification];
const { icon, summary, body, actions, hints } = ndata;
let { notification } = ndata;
if (notification == null) {
notification = new MessageTray.Notification(source);

View File

@ -221,8 +221,10 @@ var RemoteSearchProvider = class {
} else if (meta['gicon']) {
gicon = Gio.icon_new_for_string(meta['gicon']);
} else if (meta['icon-data']) {
let [width, height, rowStride, hasAlpha,
bitsPerSample, nChannels_, data] = meta['icon-data'];
const [
width, height, rowStride, hasAlpha,
bitsPerSample, nChannels_, data,
] = meta['icon-data'];
gicon = Shell.util_create_pixbuf_from_data(data, GdkPixbuf.Colorspace.RGB, hasAlpha,
bitsPerSample, width, height, rowStride);
}

View File

@ -11,6 +11,14 @@ const Config = imports.misc.config;
const DEFAULT_MODE = 'restrictive';
const USER_SESSION_COMPONENTS = [
'polkitAgent', 'telepathyClient', 'keyring',
'autorunManager', 'automountManager',
];
if (Config.HAVE_NETWORKMANAGER)
USER_SESSION_COMPONENTS.push('networkAgent');
const _modes = {
'restrictive': {
parentMode: null,
@ -82,12 +90,7 @@ const _modes = {
isLocked: false,
isPrimary: true,
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
components: Config.HAVE_NETWORKMANAGER
? ['networkAgent', 'polkitAgent', 'telepathyClient',
'keyring', 'autorunManager', 'automountManager']
: ['polkitAgent', 'telepathyClient',
'keyring', 'autorunManager', 'automountManager'],
components: USER_SESSION_COMPONENTS,
panel: {
left: ['activities', 'appMenu'],
center: ['dateMenu'],

View File

@ -254,12 +254,18 @@ var ShellMountQuestionDialog = GObject.registerClass({
});
var ShellMountPasswordDialog = GObject.registerClass({
Signals: { 'response': { param_types: [GObject.TYPE_INT,
GObject.TYPE_STRING,
GObject.TYPE_BOOLEAN,
GObject.TYPE_BOOLEAN,
GObject.TYPE_BOOLEAN,
GObject.TYPE_UINT] } },
Signals: {
'response': {
param_types: [
GObject.TYPE_INT,
GObject.TYPE_STRING,
GObject.TYPE_BOOLEAN,
GObject.TYPE_BOOLEAN,
GObject.TYPE_BOOLEAN,
GObject.TYPE_UINT,
],
},
},
}, class ShellMountPasswordDialog extends ModalDialog.ModalDialog {
_init(message, flags) {
let strings = message.split('\n');

View File

@ -795,16 +795,20 @@ class InputSourceIndicatorContainer extends St.Widget {
// for those we don't actually display.
return this.get_children().reduce((maxWidth, child) => {
let width = child.get_preferred_width(forHeight);
return [Math.max(maxWidth[0], width[0]),
Math.max(maxWidth[1], width[1])];
return [
Math.max(maxWidth[0], width[0]),
Math.max(maxWidth[1], width[1]),
];
}, [0, 0]);
}
vfunc_get_preferred_height(forWidth) {
return this.get_children().reduce((maxHeight, child) => {
let height = child.get_preferred_height(forWidth);
return [Math.max(maxHeight[0], height[0]),
Math.max(maxHeight[1], height[1])];
return [
Math.max(maxHeight[0], height[0]),
Math.max(maxHeight[1], height[1]),
];
}, [0, 0]);
}

View File

@ -1752,9 +1752,11 @@ class Indicator extends PanelMenu.SystemIndicator {
this._nmDevices = [];
this._devices = { };
let categories = [NMConnectionCategory.WIRED,
NMConnectionCategory.WIRELESS,
NMConnectionCategory.WWAN];
const categories = [
NMConnectionCategory.WIRED,
NMConnectionCategory.WIRELESS,
NMConnectionCategory.WWAN,
];
for (let category of categories) {
this._devices[category] = new DeviceCategory(category);
this.menu.addMenuItem(this._devices[category]);

View File

@ -1135,9 +1135,11 @@ var WindowManager = class {
}
_minimizeWindow(shellwm, actor) {
let types = [Meta.WindowType.NORMAL,
Meta.WindowType.MODAL_DIALOG,
Meta.WindowType.DIALOG];
const types = [
Meta.WindowType.NORMAL,
Meta.WindowType.MODAL_DIALOG,
Meta.WindowType.DIALOG,
];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_minimize(actor);
return;
@ -1200,9 +1202,11 @@ var WindowManager = class {
}
_unminimizeWindow(shellwm, actor) {
let types = [Meta.WindowType.NORMAL,
Meta.WindowType.MODAL_DIALOG,
Meta.WindowType.DIALOG];
const types = [
Meta.WindowType.NORMAL,
Meta.WindowType.MODAL_DIALOG,
Meta.WindowType.DIALOG,
];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_unminimize(actor);
return;
@ -1467,9 +1471,11 @@ var WindowManager = class {
if (actor.meta_window.is_attached_dialog())
this._checkDimming(actor.get_meta_window().get_transient_for());
let types = [Meta.WindowType.NORMAL,
Meta.WindowType.DIALOG,
Meta.WindowType.MODAL_DIALOG];
const types = [
Meta.WindowType.NORMAL,
Meta.WindowType.DIALOG,
Meta.WindowType.MODAL_DIALOG,
];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_map(actor);
return;
@ -1544,9 +1550,11 @@ var WindowManager = class {
if (window.is_attached_dialog())
this._checkDimming(window.get_transient_for());
let types = [Meta.WindowType.NORMAL,
Meta.WindowType.DIALOG,
Meta.WindowType.MODAL_DIALOG];
const types = [
Meta.WindowType.NORMAL,
Meta.WindowType.DIALOG,
Meta.WindowType.MODAL_DIALOG,
];
if (!this._shouldAnimateActor(actor, types)) {
shellwm.completed_destroy(actor);
return;

View File

@ -7,7 +7,6 @@ rules:
- 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
CallExpression:
arguments: first
ArrayExpression: first
ObjectExpression: first
MemberExpression: off
jsdoc/check-alignment: off