cleanup: Also replace Params.parse(..., true) with spread

This is what Params.parse() boils down to when accepting extra
parameters, so we can just as well use standard syntax here.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3196>
This commit is contained in:
Florian Müllner 2019-12-17 20:06:24 +01:00
parent 8eec7ac3f4
commit fe1eab1b3c
3 changed files with 6 additions and 11 deletions

View File

@ -21,7 +21,6 @@ import * as ParentalControlsManager from '../misc/parentalControlsManager.js';
import * as PopupMenu from './popupMenu.js'; import * as PopupMenu from './popupMenu.js';
import * as Search from './search.js'; import * as Search from './search.js';
import * as SwipeTracker from './swipeTracker.js'; import * as SwipeTracker from './swipeTracker.js';
import * as Params from '../misc/params.js';
import * as SystemActions from '../misc/systemActions.js'; import * as SystemActions from '../misc/systemActions.js';
import * as Main from './main.js'; import * as Main from './main.js';
@ -2986,10 +2985,9 @@ export const AppIcon = GObject.registerClass({
}, class AppIcon extends AppViewItem { }, class AppIcon extends AppViewItem {
_init(app, iconParams = {}) { _init(app, iconParams = {}) {
// Get the isDraggable property without passing it on to the BaseIcon: // Get the isDraggable property without passing it on to the BaseIcon:
const appIconParams = Params.parse(iconParams, {isDraggable: true}, true); const isDraggable = iconParams['isDraggable'] ?? true;
const isDraggable = appIconParams['isDraggable'];
delete iconParams['isDraggable']; delete iconParams['isDraggable'];
const expandTitleOnHover = appIconParams['expandTitleOnHover']; const expandTitleOnHover = iconParams['expandTitleOnHover'];
delete iconParams['expandTitleOnHover']; delete iconParams['expandTitleOnHover'];
super._init({style_class: 'overview-tile'}, isDraggable, expandTitleOnHover); super._init({style_class: 'overview-tile'}, isDraggable, expandTitleOnHover);

View File

@ -9,7 +9,6 @@ import Shell from 'gi://Shell';
import * as Config from '../misc/config.js'; import * as Config from '../misc/config.js';
import * as Main from './main.js'; import * as Main from './main.js';
import * as MessageTray from './messageTray.js'; import * as MessageTray from './messageTray.js';
import * as Params from '../misc/params.js';
import {loadInterfaceXML} from '../misc/fileUtils.js'; import {loadInterfaceXML} from '../misc/fileUtils.js';
import {NotificationErrors, NotificationError} from '../misc/dbusErrors.js'; import {NotificationErrors, NotificationError} from '../misc/dbusErrors.js';
@ -128,7 +127,7 @@ class FdoNotificationDaemon {
hints[hint] = hints[hint].deepUnpack(); hints[hint] = hints[hint].deepUnpack();
} }
hints = Params.parse(hints, {urgency: Urgency.NORMAL}, true); hints = {urgency: Urgency.NORMAL, ...hints};
// Be compatible with the various hints for image data and image path // Be compatible with the various hints for image data and image path
// 'image-data' and 'image-path' are the latest name of these hints, introduced in 1.2 // 'image-data' and 'image-path' are the latest name of these hints, introduced in 1.2

View File

@ -6,19 +6,17 @@ import GObject from 'gi://GObject';
import St from 'gi://St'; import St from 'gi://St';
import * as Main from './main.js'; import * as Main from './main.js';
import * as Params from '../misc/params.js';
import * as PopupMenu from './popupMenu.js'; import * as PopupMenu from './popupMenu.js';
export const ButtonBox = GObject.registerClass( export const ButtonBox = GObject.registerClass(
class ButtonBox extends St.Widget { class ButtonBox extends St.Widget {
_init(params) { _init(params) {
params = Params.parse(params, { super._init({
style_class: 'panel-button', style_class: 'panel-button',
x_expand: true, x_expand: true,
y_expand: true, y_expand: true,
}, true); ...params,
});
super._init(params);
this._delegate = this; this._delegate = this;