cleanup: Use consistent switch indentation

We are currently inconsistent on whether case labels share the same
indentation level as the corresponding switch statement or not. gjs
goes with the default of no additional indentation, so go along with
that.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608
This commit is contained in:
Florian Müllner 2019-02-01 13:21:00 +01:00 committed by Georges Basile Stavracas Neto
parent 5ec4c2e43e
commit 6ed5bc2f6c
15 changed files with 267 additions and 267 deletions

View File

@ -284,24 +284,24 @@ const SystemActions = GObject.registerClass({
activateAction(id) { activateAction(id) {
switch (id) { switch (id) {
case POWER_OFF_ACTION_ID: case POWER_OFF_ACTION_ID:
this.activatePowerOff(); this.activatePowerOff();
break; break;
case LOCK_SCREEN_ACTION_ID: case LOCK_SCREEN_ACTION_ID:
this.activateLockScreen(); this.activateLockScreen();
break; break;
case LOGOUT_ACTION_ID: case LOGOUT_ACTION_ID:
this.activateLogout(); this.activateLogout();
break; break;
case SUSPEND_ACTION_ID: case SUSPEND_ACTION_ID:
this.activateSuspend(); this.activateSuspend();
break; break;
case SWITCH_USER_ACTION_ID: case SWITCH_USER_ACTION_ID:
this.activateSwitchUser(); this.activateSwitchUser();
break; break;
case LOCK_ORIENTATION_ACTION_ID: case LOCK_ORIENTATION_ACTION_ID:
this.activateLockOrientation(); this.activateLockOrientation();
break; break;
} }
} }

View File

@ -984,23 +984,23 @@ class WindowIcon extends St.BoxLayout {
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
switch (mode) { switch (mode) {
case AppIconMode.THUMBNAIL_ONLY: case AppIconMode.THUMBNAIL_ONLY:
size = WINDOW_PREVIEW_SIZE; size = WINDOW_PREVIEW_SIZE;
this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor)); this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor));
break; break;
case AppIconMode.BOTH: case AppIconMode.BOTH:
size = WINDOW_PREVIEW_SIZE; size = WINDOW_PREVIEW_SIZE;
this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor)); this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor));
if (this.app) if (this.app)
this._icon.add_actor(this._createAppIcon(this.app, this._icon.add_actor(this._createAppIcon(this.app,
APP_ICON_SIZE_SMALL)); APP_ICON_SIZE_SMALL));
break; break;
case AppIconMode.APP_ICON_ONLY: case AppIconMode.APP_ICON_ONLY:
size = APP_ICON_SIZE; size = APP_ICON_SIZE;
this._icon.add_actor(this._createAppIcon(this.app, size)); this._icon.add_actor(this._createAppIcon(this.app, size));
} }
this._icon.set_size(size * scaleFactor, size * scaleFactor); this._icon.set_size(size * scaleFactor, size * scaleFactor);

View File

@ -1331,22 +1331,22 @@ var AppFolderPopup = class AppFolderPopup {
let direction; let direction;
let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR; let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR;
switch (event.get_key_symbol()) { switch (event.get_key_symbol()) {
case Clutter.Down: case Clutter.Down:
direction = St.DirectionType.TAB_FORWARD; direction = St.DirectionType.TAB_FORWARD;
break; break;
case Clutter.Right: case Clutter.Right:
direction = isLtr ? St.DirectionType.TAB_FORWARD : direction = isLtr ? St.DirectionType.TAB_FORWARD :
St.DirectionType.TAB_BACKWARD; St.DirectionType.TAB_BACKWARD;
break; break;
case Clutter.Up: case Clutter.Up:
direction = St.DirectionType.TAB_BACKWARD; direction = St.DirectionType.TAB_BACKWARD;
break; break;
case Clutter.Left: case Clutter.Left:
direction = isLtr ? St.DirectionType.TAB_BACKWARD : direction = isLtr ? St.DirectionType.TAB_BACKWARD :
St.DirectionType.TAB_FORWARD; St.DirectionType.TAB_FORWARD;
break; break;
default: default:
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
return actor.navigate_focus(null, direction, false); return actor.navigate_focus(null, direction, false);
} }

View File

@ -55,27 +55,27 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
_getDeviceLabel(device) { _getDeviceLabel(device) {
switch (device) { switch (device) {
case AudioDevice.HEADPHONES: case AudioDevice.HEADPHONES:
return _("Headphones"); return _("Headphones");
case AudioDevice.HEADSET: case AudioDevice.HEADSET:
return _("Headset"); return _("Headset");
case AudioDevice.MICROPHONE: case AudioDevice.MICROPHONE:
return _("Microphone"); return _("Microphone");
default: default:
return null; return null;
} }
} }
_getDeviceIcon(device) { _getDeviceIcon(device) {
switch (device) { switch (device) {
case AudioDevice.HEADPHONES: case AudioDevice.HEADPHONES:
return 'audio-headphones-symbolic'; return 'audio-headphones-symbolic';
case AudioDevice.HEADSET: case AudioDevice.HEADSET:
return 'audio-headset-symbolic'; return 'audio-headset-symbolic';
case AudioDevice.MICROPHONE: case AudioDevice.MICROPHONE:
return 'audio-input-microphone-symbolic'; return 'audio-input-microphone-symbolic';
default: default:
return null; return null;
} }
} }

View File

@ -90,18 +90,18 @@ var BoxPointer = GObject.registerClass({
if (animate & PopupAnimation.SLIDE) { if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) { switch (this._arrowSide) {
case St.Side.TOP: case St.Side.TOP:
this.translation_y = -rise; this.translation_y = -rise;
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
this.translation_y = rise; this.translation_y = rise;
break; break;
case St.Side.LEFT: case St.Side.LEFT:
this.translation_x = -rise; this.translation_x = -rise;
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
this.translation_x = rise; this.translation_x = rise;
break; break;
} }
} }
@ -130,18 +130,18 @@ var BoxPointer = GObject.registerClass({
if (animate & PopupAnimation.SLIDE) { if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) { switch (this._arrowSide) {
case St.Side.TOP: case St.Side.TOP:
translationY = rise; translationY = rise;
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
translationY = -rise; translationY = -rise;
break; break;
case St.Side.LEFT: case St.Side.LEFT:
translationX = rise; translationX = rise;
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
translationX = -rise; translationX = -rise;
break; break;
} }
} }
@ -220,18 +220,18 @@ var BoxPointer = GObject.registerClass({
childBox.x2 = availWidth - borderWidth; childBox.x2 = availWidth - borderWidth;
childBox.y2 = availHeight - borderWidth; childBox.y2 = availHeight - borderWidth;
switch (this._arrowSide) { switch (this._arrowSide) {
case St.Side.TOP: case St.Side.TOP:
childBox.y1 += rise; childBox.y1 += rise;
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
childBox.y2 -= rise; childBox.y2 -= rise;
break; break;
case St.Side.LEFT: case St.Side.LEFT:
childBox.x1 += rise; childBox.x1 += rise;
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
childBox.x2 -= rise; childBox.x2 -= rise;
break; break;
} }
this.bin.allocate(childBox, flags); this.bin.allocate(childBox, flags);

View File

@ -360,28 +360,28 @@ var ChatSource = class extends MessageTray.Source {
let presenceType = this._contact.get_presence_type(); let presenceType = this._contact.get_presence_type();
switch (presenceType) { switch (presenceType) {
case Tp.ConnectionPresenceType.AVAILABLE: case Tp.ConnectionPresenceType.AVAILABLE:
iconName = 'user-available'; iconName = 'user-available';
break; break;
case Tp.ConnectionPresenceType.BUSY: case Tp.ConnectionPresenceType.BUSY:
iconName = 'user-busy'; iconName = 'user-busy';
break; break;
case Tp.ConnectionPresenceType.OFFLINE: case Tp.ConnectionPresenceType.OFFLINE:
iconName = 'user-offline'; iconName = 'user-offline';
break; break;
case Tp.ConnectionPresenceType.HIDDEN: case Tp.ConnectionPresenceType.HIDDEN:
iconName = 'user-invisible'; iconName = 'user-invisible';
break; break;
case Tp.ConnectionPresenceType.AWAY: case Tp.ConnectionPresenceType.AWAY:
iconName = 'user-away'; iconName = 'user-away';
break; break;
case Tp.ConnectionPresenceType.EXTENDED_AWAY: case Tp.ConnectionPresenceType.EXTENDED_AWAY:
iconName = 'user-idle'; iconName = 'user-idle';
break; break;
default: default:
iconName = 'user-offline'; iconName = 'user-offline';
} }
return new Gio.ThemedIcon({ name: iconName }); return new Gio.ThemedIcon({ name: iconName });
} }
_updateAvatarIcon() { _updateAvatarIcon() {

View File

@ -561,11 +561,11 @@ var _Draggable = class _Draggable {
let dropFunc = dragMonitors[i].dragDrop; let dropFunc = dragMonitors[i].dragDrop;
if (dropFunc) if (dropFunc)
switch (dropFunc(dropEvent)) { switch (dropFunc(dropEvent)) {
case DragDropResult.FAILURE: case DragDropResult.FAILURE:
case DragDropResult.SUCCESS: case DragDropResult.SUCCESS:
return true; return true;
case DragDropResult.CONTINUE: case DragDropResult.CONTINUE:
continue; continue;
} }
} }

View File

@ -472,19 +472,19 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
// Trigger the offline update as requested // Trigger the offline update as requested
if (this._checkBox.actor.checked) { if (this._checkBox.actor.checked) {
switch (signal) { switch (signal) {
case "ConfirmedReboot": case "ConfirmedReboot":
this._triggerOfflineUpdateReboot(callback); this._triggerOfflineUpdateReboot(callback);
break; break;
case "ConfirmedShutdown": case "ConfirmedShutdown":
// To actually trigger the offline update, we need to // To actually trigger the offline update, we need to
// reboot to do the upgrade. When the upgrade is complete, // reboot to do the upgrade. When the upgrade is complete,
// the computer will shut down automatically. // the computer will shut down automatically.
signal = "ConfirmedReboot"; signal = "ConfirmedReboot";
this._triggerOfflineUpdateShutdown(callback); this._triggerOfflineUpdateShutdown(callback);
break; break;
default: default:
callback(); callback();
break; break;
} }
} else { } else {
this._triggerOfflineUpdateCancel(callback); this._triggerOfflineUpdateCancel(callback);

View File

@ -312,14 +312,14 @@ var IconGrid = GObject.registerClass({
let leftEmptySpace; let leftEmptySpace;
switch (this._xAlign) { switch (this._xAlign) {
case St.Align.START: case St.Align.START:
leftEmptySpace = 0; leftEmptySpace = 0;
break; break;
case St.Align.MIDDLE: case St.Align.MIDDLE:
leftEmptySpace = Math.floor((availWidth - usedWidth) / 2); leftEmptySpace = Math.floor((availWidth - usedWidth) / 2);
break; break;
case St.Align.END: case St.Align.END:
leftEmptySpace = availWidth - usedWidth; leftEmptySpace = availWidth - usedWidth;
} }
let animating = this._clonesAnimating.length > 0; let animating = this._clonesAnimating.length > 0;
@ -806,14 +806,14 @@ var PaginatedIconGrid = GObject.registerClass({
let leftEmptySpace; let leftEmptySpace;
switch (this._xAlign) { switch (this._xAlign) {
case St.Align.START: case St.Align.START:
leftEmptySpace = 0; leftEmptySpace = 0;
break; break;
case St.Align.MIDDLE: case St.Align.MIDDLE:
leftEmptySpace = Math.floor((availWidth - usedWidth) / 2); leftEmptySpace = Math.floor((availWidth - usedWidth) / 2);
break; break;
case St.Align.END: case St.Align.END:
leftEmptySpace = availWidth - usedWidth; leftEmptySpace = availWidth - usedWidth;
} }
let x = box.x1 + leftEmptySpace + this.leftPadding; let x = box.x1 + leftEmptySpace + this.leftPadding;

View File

@ -688,17 +688,17 @@ var Extensions = class Extensions {
_stateToString(extensionState) { _stateToString(extensionState) {
switch (extensionState) { switch (extensionState) {
case ExtensionSystem.ExtensionState.ENABLED: case ExtensionSystem.ExtensionState.ENABLED:
return _("Enabled"); return _("Enabled");
case ExtensionSystem.ExtensionState.DISABLED: case ExtensionSystem.ExtensionState.DISABLED:
case ExtensionSystem.ExtensionState.INITIALIZED: case ExtensionSystem.ExtensionState.INITIALIZED:
return _("Disabled"); return _("Disabled");
case ExtensionSystem.ExtensionState.ERROR: case ExtensionSystem.ExtensionState.ERROR:
return _("Error"); return _("Error");
case ExtensionSystem.ExtensionState.OUT_OF_DATE: case ExtensionSystem.ExtensionState.OUT_OF_DATE:
return _("Out of date"); return _("Out of date");
case ExtensionSystem.ExtensionState.DOWNLOADING: case ExtensionSystem.ExtensionState.DOWNLOADING:
return _("Downloading"); return _("Downloading");
} }
return 'Unknown'; // Not translated, shouldn't appear return 'Unknown'; // Not translated, shouldn't appear
} }

View File

@ -1099,21 +1099,21 @@ var ZoomRegion = class ZoomRegion {
*/ */
setScreenPosition(inPosition) { setScreenPosition(inPosition) {
switch (inPosition) { switch (inPosition) {
case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN: case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN:
this.setFullScreenMode(); this.setFullScreenMode();
break; break;
case GDesktopEnums.MagnifierScreenPosition.TOP_HALF: case GDesktopEnums.MagnifierScreenPosition.TOP_HALF:
this.setTopHalf(); this.setTopHalf();
break; break;
case GDesktopEnums.MagnifierScreenPosition.BOTTOM_HALF: case GDesktopEnums.MagnifierScreenPosition.BOTTOM_HALF:
this.setBottomHalf(); this.setBottomHalf();
break; break;
case GDesktopEnums.MagnifierScreenPosition.LEFT_HALF: case GDesktopEnums.MagnifierScreenPosition.LEFT_HALF:
this.setLeftHalf(); this.setLeftHalf();
break; break;
case GDesktopEnums.MagnifierScreenPosition.RIGHT_HALF: case GDesktopEnums.MagnifierScreenPosition.RIGHT_HALF:
this.setRightHalf(); this.setRightHalf();
break; break;
} }
} }

View File

@ -76,13 +76,13 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
_fallbackIconForNotificationData(hints) { _fallbackIconForNotificationData(hints) {
let stockIcon; let stockIcon;
switch (hints.urgency) { switch (hints.urgency) {
case Urgency.LOW: case Urgency.LOW:
case Urgency.NORMAL: case Urgency.NORMAL:
stockIcon = 'dialog-information'; stockIcon = 'dialog-information';
break; break;
case Urgency.CRITICAL: case Urgency.CRITICAL:
stockIcon = 'dialog-error'; stockIcon = 'dialog-error';
break; break;
} }
return new Gio.ThemedIcon({ name: stockIcon }); return new Gio.ThemedIcon({ name: stockIcon });
} }
@ -270,15 +270,15 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
delete this._notifications[ndata.id]; delete this._notifications[ndata.id];
let notificationClosedReason; let notificationClosedReason;
switch (reason) { switch (reason) {
case MessageTray.NotificationDestroyedReason.EXPIRED: case MessageTray.NotificationDestroyedReason.EXPIRED:
notificationClosedReason = NotificationClosedReason.EXPIRED; notificationClosedReason = NotificationClosedReason.EXPIRED;
break; break;
case MessageTray.NotificationDestroyedReason.DISMISSED: case MessageTray.NotificationDestroyedReason.DISMISSED:
notificationClosedReason = NotificationClosedReason.DISMISSED; notificationClosedReason = NotificationClosedReason.DISMISSED;
break; break;
case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED: case MessageTray.NotificationDestroyedReason.SOURCE_CLOSED:
notificationClosedReason = NotificationClosedReason.APP_CLOSED; notificationClosedReason = NotificationClosedReason.APP_CLOSED;
break; break;
} }
this._emitNotificationClosed(ndata.id, notificationClosedReason); this._emitNotificationClosed(ndata.id, notificationClosedReason);
}); });
@ -330,15 +330,15 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
} }
switch (hints.urgency) { switch (hints.urgency) {
case Urgency.LOW: case Urgency.LOW:
notification.setUrgency(MessageTray.Urgency.LOW); notification.setUrgency(MessageTray.Urgency.LOW);
break; break;
case Urgency.NORMAL: case Urgency.NORMAL:
notification.setUrgency(MessageTray.Urgency.NORMAL); notification.setUrgency(MessageTray.Urgency.NORMAL);
break; break;
case Urgency.CRITICAL: case Urgency.CRITICAL:
notification.setUrgency(MessageTray.Urgency.CRITICAL); notification.setUrgency(MessageTray.Urgency.CRITICAL);
break; break;
} }
notification.setResident(!!hints.resident); notification.setResident(!!hints.resident);
// 'transient' is a reserved keyword in JS, so we have to retrieve the value // 'transient' is a reserved keyword in JS, so we have to retrieve the value

View File

@ -28,18 +28,18 @@ function isPopupMenuItemVisible(child) {
function arrowIcon(side) { function arrowIcon(side) {
let iconName; let iconName;
switch (side) { switch (side) {
case St.Side.TOP: case St.Side.TOP:
iconName = 'pan-up-symbolic'; iconName = 'pan-up-symbolic';
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
iconName = 'pan-end-symbolic'; iconName = 'pan-end-symbolic';
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
iconName = 'pan-down-symbolic'; iconName = 'pan-down-symbolic';
break; break;
case St.Side.LEFT: case St.Side.LEFT:
iconName = 'pan-start-symbolic'; iconName = 'pan-start-symbolic';
break; break;
} }
let arrow = new St.Icon({ style_class: 'popup-menu-arrow', let arrow = new St.Icon({ style_class: 'popup-menu-arrow',
@ -815,18 +815,18 @@ var PopupMenu = class extends PopupMenuBase {
let navKey; let navKey;
switch (this._boxPointer.arrowSide) { switch (this._boxPointer.arrowSide) {
case St.Side.TOP: case St.Side.TOP:
navKey = Clutter.KEY_Down; navKey = Clutter.KEY_Down;
break; break;
case St.Side.BOTTOM: case St.Side.BOTTOM:
navKey = Clutter.KEY_Up; navKey = Clutter.KEY_Up;
break; break;
case St.Side.LEFT: case St.Side.LEFT:
navKey = Clutter.KEY_Right; navKey = Clutter.KEY_Right;
break; break;
case St.Side.RIGHT: case St.Side.RIGHT:
navKey = Clutter.KEY_Left; navKey = Clutter.KEY_Left;
break; break;
} }
let state = event.get_state(); let state = event.get_state();

View File

@ -1559,29 +1559,29 @@ var DeviceCategory = class extends PopupMenu.PopupMenuSection {
_getSummaryIcon() { _getSummaryIcon() {
switch (this._category) { switch (this._category) {
case NMConnectionCategory.WIRED: case NMConnectionCategory.WIRED:
return 'network-wired-symbolic'; return 'network-wired-symbolic';
case NMConnectionCategory.WIRELESS: case NMConnectionCategory.WIRELESS:
case NMConnectionCategory.WWAN: case NMConnectionCategory.WWAN:
return 'network-wireless-symbolic'; return 'network-wireless-symbolic';
} }
return ''; return '';
} }
_getSummaryLabel(nDevices) { _getSummaryLabel(nDevices) {
switch (this._category) { switch (this._category) {
case NMConnectionCategory.WIRED: case NMConnectionCategory.WIRED:
return ngettext("%s Wired Connection", return ngettext("%s Wired Connection",
"%s Wired Connections", "%s Wired Connections",
nDevices).format(nDevices); nDevices).format(nDevices);
case NMConnectionCategory.WIRELESS: case NMConnectionCategory.WIRELESS:
return ngettext("%s Wi-Fi Connection", return ngettext("%s Wi-Fi Connection",
"%s Wi-Fi Connections", "%s Wi-Fi Connections",
nDevices).format(nDevices); nDevices).format(nDevices);
case NMConnectionCategory.WWAN: case NMConnectionCategory.WWAN:
return ngettext("%s Modem Connection", return ngettext("%s Modem Connection",
"%s Modem Connections", "%s Modem Connections",
nDevices).format(nDevices); nDevices).format(nDevices);
} }
return ''; return '';
} }

View File

@ -2080,27 +2080,27 @@ var WindowManager = class {
_startSwitcher(display, window, binding) { _startSwitcher(display, window, binding) {
let constructor = null; let constructor = null;
switch (binding.get_name()) { switch (binding.get_name()) {
case 'switch-applications': case 'switch-applications':
case 'switch-applications-backward': case 'switch-applications-backward':
case 'switch-group': case 'switch-group':
case 'switch-group-backward': case 'switch-group-backward':
constructor = AltTab.AppSwitcherPopup; constructor = AltTab.AppSwitcherPopup;
break; break;
case 'switch-windows': case 'switch-windows':
case 'switch-windows-backward': case 'switch-windows-backward':
constructor = AltTab.WindowSwitcherPopup; constructor = AltTab.WindowSwitcherPopup;
break; break;
case 'cycle-windows': case 'cycle-windows':
case 'cycle-windows-backward': case 'cycle-windows-backward':
constructor = AltTab.WindowCyclerPopup; constructor = AltTab.WindowCyclerPopup;
break; break;
case 'cycle-group': case 'cycle-group':
case 'cycle-group-backward': case 'cycle-group-backward':
constructor = AltTab.GroupCyclerPopup; constructor = AltTab.GroupCyclerPopup;
break; break;
case 'switch-monitor': case 'switch-monitor':
constructor = SwitchMonitor.SwitchMonitorPopup; constructor = SwitchMonitor.SwitchMonitorPopup;
break; break;
} }
if (!constructor) if (!constructor)