[gnome-shell/ewlsh/esm: 2/5] Remove Param.parse usage
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/ewlsh/esm: 2/5] Remove Param.parse usage
- Date: Fri, 24 Sep 2021 01:25:34 +0000 (UTC)
commit 438f19fd0b8f82e26c6b65c1093b1a4f85a8a996
Author: Evan Welsh <contact evanwelsh com>
Date: Thu Jul 15 21:03:58 2021 -0700
Remove Param.parse usage
js/gdm/authPrompt.js | 9 ++--
js/gdm/util.js | 7 ++-
js/misc/history.js | 17 +++----
js/misc/objectManager.js | 33 ++++++-------
js/misc/util.js | 41 ++++++++--------
js/ui/animation.js | 15 +++---
js/ui/appDisplay.js | 14 ++----
js/ui/background.js | 91 +++++++++++++++++++-----------------
js/ui/components/automountManager.js | 19 ++++----
js/ui/components/telepathyClient.js | 19 ++++----
js/ui/ctrlAltTab.js | 24 ++++++----
js/ui/dnd.js | 27 ++++++-----
js/ui/grabHelper.js | 49 +++++++++++--------
js/ui/iconGrid.js | 30 ++++++------
js/ui/layout.js | 5 +-
js/ui/lightbox.js | 29 ++++++------
js/ui/magnifier.js | 47 ++++++++++---------
js/ui/main.js | 15 +++---
js/ui/messageTray.js | 45 +++++++++---------
js/ui/modalDialog.js | 26 +++++------
js/ui/notificationDaemon.js | 3 +-
js/ui/overview.js | 14 ++----
js/ui/panelMenu.js | 13 +++---
js/ui/popupMenu.js | 41 ++++++++--------
js/ui/scripting.js | 19 ++++----
js/ui/sessionMode.js | 14 ++++--
js/ui/shellEntry.js | 7 ++-
js/ui/shellMountOperation.js | 7 ++-
js/ui/swipeTracker.js | 9 ++--
js/ui/userWidget.js | 23 +++++----
js/ui/workspace.js | 33 ++++++-------
31 files changed, 372 insertions(+), 373 deletions(-)
---
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 4844b9ee0c..d4edfb9ef5 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -8,7 +8,6 @@ const Batch = imports.gdm.batch;
const GdmUtil = imports.gdm.util;
const OVirt = imports.gdm.oVirt;
const Vmware = imports.gdm.vmware;
-const Params = imports.misc.params;
const ShellEntry = imports.ui.shellEntry;
const UserWidget = imports.ui.userWidget;
const Util = imports.misc.util;
@@ -584,17 +583,15 @@ var AuthPrompt = GObject.registerClass({
this._entry.clutter_text.insert_unichar(unichar);
}
- begin(params) {
- params = Params.parse(params, { userName: null,
- hold: null });
+ begin(params = {}) {
+ let { userName = null, hold = null } = params;
this.updateSensitivity(false);
- let hold = params.hold;
if (!hold)
hold = new Batch.Hold();
- this._userVerifier.begin(params.userName, hold);
+ this._userVerifier.begin(userName, hold);
this.verificationStatus = AuthPromptStatus.VERIFYING;
}
diff --git a/js/gdm/util.js b/js/gdm/util.js
index 72561daab2..c55905ab2f 100644
--- a/js/gdm/util.js
+++ b/js/gdm/util.js
@@ -10,7 +10,6 @@ const OVirt = imports.gdm.oVirt;
const Vmware = imports.gdm.vmware;
const Main = imports.ui.main;
const { loadInterfaceXML } = imports.misc.fileUtils;
-const Params = imports.misc.params;
const SmartcardManager = imports.misc.smartcardManager;
const FprintManagerIface = loadInterfaceXML('net.reactivated.Fprint.Manager');
@@ -137,9 +136,9 @@ function cloneAndFadeOutActor(actor) {
}
var ShellUserVerifier = class {
- constructor(client, params) {
- params = Params.parse(params, { reauthenticationOnly: false });
- this._reauthOnly = params.reauthenticationOnly;
+ constructor(client, params = {}) {
+ const { reauthenticationOnly = false } = params;
+ this._reauthOnly = reauthenticationOnly;
this._client = client;
diff --git a/js/misc/history.js b/js/misc/history.js
index 4152588818..8d2a2f3b63 100644
--- a/js/misc/history.js
+++ b/js/misc/history.js
@@ -2,18 +2,19 @@
const Signals = imports.signals;
const Clutter = imports.gi.Clutter;
-const Params = imports.misc.params;
var DEFAULT_LIMIT = 512;
var HistoryManager = class {
- constructor(params) {
- params = Params.parse(params, { gsettingsKey: null,
- limit: DEFAULT_LIMIT,
- entry: null });
+ constructor(params = {}) {
+ const {
+ gsettingsKey = null,
+ limit = DEFAULT_LIMIT,
+ entry = null,
+ } = params;
- this._key = params.gsettingsKey;
- this._limit = params.limit;
+ this._key = gsettingsKey;
+ this._limit = limit;
this._historyIndex = 0;
if (this._key) {
@@ -24,7 +25,7 @@ var HistoryManager = class {
this._history = [];
}
- this._entry = params.entry;
+ this._entry = entry;
if (this._entry) {
this._entry.connect('key-press-event',
diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js
index 4c4e0b6e32..12d415c1dc 100644
--- a/js/misc/objectManager.js
+++ b/js/misc/objectManager.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const { Gio, GLib } = imports.gi;
-const Params = imports.misc.params;
const Signals = imports.signals;
// Specified in the D-Bus specification here:
@@ -26,18 +25,20 @@ const ObjectManagerIface = `
const ObjectManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ObjectManagerIface);
var ObjectManager = class {
- constructor(params) {
- params = Params.parse(params, { connection: null,
- name: null,
- objectPath: null,
- knownInterfaces: null,
- cancellable: null,
- onLoaded: null });
-
- this._connection = params.connection;
- this._serviceName = params.name;
- this._managerPath = params.objectPath;
- this._cancellable = params.cancellable;
+ constructor(params = {}) {
+ const {
+ connection = null,
+ name = null,
+ objectPath = null,
+ knownInterfaces = null,
+ cancellable = null,
+ onLoaded = null,
+ } = params;
+
+ this._connection = connection;
+ this._serviceName = name;
+ this._managerPath = objectPath;
+ this._cancellable = cancellable;
this._managerProxy = new Gio.DBusProxy({ g_connection: this._connection,
g_interface_name: ObjectManagerInfo.name,
@@ -49,10 +50,10 @@ var ObjectManager = class {
this._interfaceInfos = {};
this._objects = {};
this._interfaces = {};
- this._onLoaded = params.onLoaded;
+ this._onLoaded = onLoaded;
- if (params.knownInterfaces)
- this._registerInterfaces(params.knownInterfaces);
+ if (knownInterfaces)
+ this._registerInterfaces(knownInterfaces);
// Start out inhibiting load until at least the proxy
// manager is loaded and the remote objects are fetched
diff --git a/js/misc/util.js b/js/misc/util.js
index bd57184728..dd25eacce9 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -8,7 +8,6 @@ const { Clutter, Gio, GLib, Shell, St, GnomeDesktop } = imports.gi;
const Gettext = imports.gettext;
const Main = imports.ui.main;
-const Params = imports.misc.params;
var SCROLL_TIME = 100;
@@ -206,7 +205,7 @@ function formatTimeSpan(date) {
"%d years ago", yearsAgo).format(yearsAgo);
}
-function formatTime(time, params) {
+function formatTime(time, params = {}) {
let date;
// HACK: The built-in Date type sucks at timezones, which we need for the
// world clock; it's often more convenient though, so allow either
@@ -226,14 +225,14 @@ function formatTime(time, params) {
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
let clockFormat = _desktopSettings.get_string('clock-format');
- params = Params.parse(params, {
- timeOnly: false,
- ampm: true,
- });
+ const {
+ timeOnly = false,
+ ampm = true,
+ } = params;
if (clockFormat == '24h') {
// Show only the time if date is on today
- if (daysAgo < 1 || params.timeOnly)
+ if (daysAgo < 1 || timeOnly)
/* Translators: Time in 24h format */
format = N_("%H\u2236%M");
// Show the word "Yesterday" and time if date is on yesterday
@@ -262,7 +261,7 @@ function formatTime(time, params) {
format = N_("%B %-d %Y, %H\u2236%M");
} else {
// Show only the time if date is on today
- if (daysAgo < 1 || params.timeOnly) // eslint-disable-line no-lonely-if
+ if (daysAgo < 1 || timeOnly) // eslint-disable-line no-lonely-if
/* Translators: Time in 12h format */
format = N_("%l\u2236%M %p");
// Show the word "Yesterday" and time if date is on yesterday
@@ -293,7 +292,7 @@ function formatTime(time, params) {
// Time in short 12h format, without the equivalent of "AM" or "PM"; used
// when it is clear from the context
- if (!params.ampm)
+ if (!ampm)
format = format.replace(/\s*%p/g, '');
let formattedTime = date.format(Shell.util_translate_time_string(format));
@@ -400,35 +399,35 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
});
}
-function wiggle(actor, params) {
+function wiggle(actor, params = {}) {
if (!St.Settings.get().enable_animations)
return;
- params = Params.parse(params, {
- offset: WIGGLE_OFFSET,
- duration: WIGGLE_DURATION,
- wiggleCount: N_WIGGLES,
- });
+ const {
+ offset = WIGGLE_OFFSET,
+ duration = WIGGLE_DURATION,
+ wiggleCount = N_WIGGLES,
+ } = params;
actor.translation_x = 0;
// Accelerate before wiggling
actor.ease({
- translation_x: -params.offset,
- duration: params.duration,
+ translation_x: -offset,
+ duration: WIGGLE_DURATION,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
onComplete: () => {
// Wiggle
actor.ease({
- translation_x: params.offset,
- duration: params.duration,
+ translation_x: offset,
+ duration,
mode: Clutter.AnimationMode.LINEAR,
- repeatCount: params.wiggleCount,
+ repeatCount: wiggleCount,
autoReverse: true,
onComplete: () => {
// Decelerate and return to the original position
actor.ease({
translation_x: 0,
- duration: params.duration,
+ duration,
mode: Clutter.AnimationMode.EASE_IN_QUAD,
});
},
diff --git a/js/ui/animation.js b/js/ui/animation.js
index 5cb3a83c13..b81eb2b904 100644
--- a/js/ui/animation.js
+++ b/js/ui/animation.js
@@ -3,7 +3,6 @@
const { Clutter, GLib, GObject, Gio, St } = imports.gi;
-const Params = imports.misc.params;
var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
var SPINNER_ANIMATION_TIME = 300;
@@ -139,17 +138,17 @@ class AnimatedIcon extends Animation {
var Spinner = GObject.registerClass(
class Spinner extends AnimatedIcon {
- _init(size, params) {
- params = Params.parse(params, {
- animate: false,
- hideOnStop: false,
- });
+ _init(size, params = {}) {
+ const {
+ animate = false,
+ hideOnStop = false,
+ } = params;
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
super._init(file, size);
this.opacity = 0;
- this._animate = params.animate;
- this._hideOnStop = params.hideOnStop;
+ this._animate = animate;
+ this._hideOnStop = hideOnStop;
this.visible = !this._hideOnStop;
}
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index e9bda12d5b..984844f117 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -17,7 +17,6 @@ const ParentalControlsManager = imports.misc.parentalControlsManager;
const PopupMenu = imports.ui.popupMenu;
const Search = imports.ui.search;
const SwipeTracker = imports.ui.swipeTracker;
-const Params = imports.misc.params;
const SystemActions = imports.misc.systemActions;
var MENU_POPUP_TIMEOUT = 600;
@@ -3088,11 +3087,7 @@ var AppIcon = GObject.registerClass({
}, class AppIcon extends AppViewItem {
_init(app, iconParams = {}) {
// Get the isDraggable property without passing it on to the BaseIcon:
- const appIconParams = Params.parse(iconParams, { isDraggable: true }, true);
- const isDraggable = appIconParams['isDraggable'];
- delete iconParams['isDraggable'];
- const expandTitleOnHover = appIconParams['expandTitleOnHover'];
- delete iconParams['expandTitleOnHover'];
+ const { isDraggable = true, expandTitleOnHover } = iconParams;
super._init({ style_class: 'app-well-app' }, isDraggable, expandTitleOnHover);
@@ -3297,14 +3292,13 @@ var AppIcon = GObject.registerClass({
this.icon.animateZoomOutAtPos(x, y);
}
- shellWorkspaceLaunch(params) {
+ shellWorkspaceLaunch(params = {}) {
let { stack } = new Error();
log('shellWorkspaceLaunch is deprecated, use app.open_new_window() instead\n%s'.format(stack));
- params = Params.parse(params, { workspace: -1,
- timestamp: 0 });
+ const { workspace = -1 } = params;
- this.app.open_new_window(params.workspace);
+ this.app.open_new_window(workspace);
}
getDragActor() {
diff --git a/js/ui/background.js b/js/ui/background.js
index 3011fb2bb1..08d024a9db 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -99,7 +99,6 @@ const Signals = imports.signals;
const LoginManager = imports.misc.loginManager;
const Main = imports.ui.main;
-const Params = imports.misc.params;
Gio._promisify(Gio._LocalFilePrototype, 'query_info_async', 'query_info_finish');
@@ -158,34 +157,36 @@ var BackgroundCache = class BackgroundCache {
this._fileMonitors[key] = monitor;
}
- getAnimation(params) {
- params = Params.parse(params, { file: null,
- settingsSchema: null,
- onLoaded: null });
+ getAnimation(params = {}) {
+ const {
+ file = null,
+ settingsSchema = null,
+ onLoaded = null,
+ } = params;
- let animation = this._animations[params.settingsSchema];
- if (animation && _fileEqual0(animation.file, params.file)) {
- if (params.onLoaded) {
+ let animation = this._animations[settingsSchema];
+ if (animation && _fileEqual0(animation.file, file)) {
+ if (onLoaded) {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
- params.onLoaded(this._animations[params.settingsSchema]);
+ onLoaded(this._animations[settingsSchema]);
return GLib.SOURCE_REMOVE;
});
- GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
+ GLib.Source.set_name_by_id(id, '[gnome-shell] onLoaded');
}
return;
}
- animation = new Animation({ file: params.file });
+ animation = new Animation({ file });
animation.loadAsync(() => {
this._animations[params.settingsSchema] = animation;
- if (params.onLoaded) {
+ if (onLoaded) {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
- params.onLoaded(this._animations[params.settingsSchema]);
+ onLoaded(this._animations[settingsSchema]);
return GLib.SOURCE_REMOVE;
});
- GLib.Source.set_name_by_id(id, '[gnome-shell] params.onLoaded');
+ GLib.Source.set_name_by_id(id, '[gnome-shell] onLoaded');
}
});
}
@@ -226,20 +227,22 @@ function getBackgroundCache() {
var Background = GObject.registerClass({
Signals: { 'loaded': {}, 'bg-changed': {} },
}, class Background extends Meta.Background {
- _init(params) {
- params = Params.parse(params, { monitorIndex: 0,
- layoutManager: Main.layoutManager,
- settings: null,
- file: null,
- style: null });
+ _init(params = {}) {
+ const {
+ monitorIndex = 0,
+ layoutManager = Main.layoutManager,
+ settings = null,
+ file = null,
+ style = null,
+ } = params;
super._init({ meta_display: global.display });
- this._settings = params.settings;
- this._file = params.file;
- this._style = params.style;
- this._monitorIndex = params.monitorIndex;
- this._layoutManager = params.layoutManager;
+ this._settings = settings;
+ this._file = file;
+ this._style = style;
+ this._monitorIndex = monitorIndex;
+ this._layoutManager = layoutManager;
this._fileWatches = {};
this._cancellable = new Gio.Cancellable();
this.isLoaded = false;
@@ -663,27 +666,27 @@ class Animation extends GnomeDesktop.BGSlideShow {
});
var BackgroundManager = class BackgroundManager {
- constructor(params) {
- params = Params.parse(params, {
- container: null,
- layoutManager: Main.layoutManager,
- monitorIndex: null,
- vignette: false,
- controlPosition: true,
- settingsSchema: BACKGROUND_SCHEMA,
- useContentSize: true,
- });
+ constructor(params = {}) {
+ const {
+ container = null,
+ layoutManager = Main.layoutManager,
+ monitorIndex = null,
+ vignette = false,
+ controlPosition = true,
+ settingsSchema = BACKGROUND_SCHEMA,
+ useContentSize = true,
+ } = params;
let cache = getBackgroundCache();
- this._settingsSchema = params.settingsSchema;
- this._backgroundSource = cache.getBackgroundSource(params.layoutManager, params.settingsSchema);
-
- this._container = params.container;
- this._layoutManager = params.layoutManager;
- this._vignette = params.vignette;
- this._monitorIndex = params.monitorIndex;
- this._controlPosition = params.controlPosition;
- this._useContentSize = params.useContentSize;
+ this._settingsSchema = settingsSchema;
+ this._backgroundSource = cache.getBackgroundSource(layoutManager, settingsSchema);
+
+ this._container = container;
+ this._layoutManager = layoutManager;
+ this._vignette = vignette;
+ this._monitorIndex = monitorIndex;
+ this._controlPosition = controlPosition;
+ this._useContentSize = useContentSize;
this.backgroundActor = this._createBackgroundActor();
this._newBackgroundActor = null;
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 5f0a8aad50..ecf9fa144c 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -2,7 +2,6 @@
/* exported Component */
const { Gio, GLib } = imports.gi;
-const Params = imports.misc.params;
const GnomeSession = imports.misc.gnomeSession;
const Main = imports.ui.main;
@@ -131,12 +130,14 @@ var AutomountManager = class {
this._checkAndMountVolume(volume);
}
- _checkAndMountVolume(volume, params) {
- params = Params.parse(params, { checkSession: true,
- useMountOp: true,
- allowAutorun: true });
+ _checkAndMountVolume(volume, params = {}) {
+ const {
+ checkSession = true,
+ useMountOp = true,
+ allowAutorun = true,
+ } = params;
- if (params.checkSession) {
+ if (checkSession) {
// if we're not in the current ConsoleKit session,
// don't attempt automount
if (!this._session.SessionIsActive)
@@ -163,11 +164,11 @@ var AutomountManager = class {
return;
}
- if (params.useMountOp) {
+ if (useMountOp) {
let operation = new ShellMountOperation.ShellMountOperation(volume);
- this._mountVolume(volume, operation, params.allowAutorun);
+ this._mountVolume(volume, operation, allowAutorun);
} else {
- this._mountVolume(volume, null, params.allowAutorun);
+ this._mountVolume(volume, null, allowAutorun);
}
}
diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js
index 103688259c..3d7020041c 100644
--- a/js/ui/components/telepathyClient.js
+++ b/js/ui/components/telepathyClient.js
@@ -23,7 +23,6 @@ const History = imports.misc.history;
const Main = imports.ui.main;
const MessageList = imports.ui.messageList;
const MessageTray = imports.ui.messageTray;
-const Params = imports.misc.params;
const Util = imports.misc.util;
const HAVE_TP = Tp != null && Tpl != null;
@@ -760,15 +759,12 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
* {number} props.timestamp: The timestamp of the message.
* {bool} props.noTimestamp: suppress timestamp signal?
*/
- _append(props) {
+ _append(props = {}) {
let currentTime = Date.now() / 1000;
- props = Params.parse(props, { body: null,
- group: null,
- styles: [],
- timestamp: currentTime,
- noTimestamp: false });
- const { noTimestamp } = props;
- delete props.noTimestamp;
+ const {
+ noTimestamp = currentTime,
+ ...messageProps
+ } = props;
// Reset the old message timeout
if (this._timestampTimeoutId)
@@ -778,7 +774,10 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
let message = new ChatNotificationMessage({
realMessage: props.group !== 'meta',
showTimestamp: false,
- ...props,
+ body: null,
+ group: null,
+ styles: [],
+ ...messageProps,
});
this.messages.unshift(message);
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index fbc7a0f5fc..6507886a40 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -5,7 +5,6 @@ const { Clutter, GObject, Meta, Shell, St } = imports.gi;
const Main = imports.ui.main;
const SwitcherPopup = imports.ui.switcherPopup;
-const Params = imports.misc.params;
var POPUP_APPICON_SIZE = 96;
@@ -23,14 +22,21 @@ var CtrlAltTabManager = class CtrlAltTabManager {
focusCallback: this._focusWindows.bind(this) });
}
- addGroup(root, name, icon, params) {
- let item = Params.parse(params, { sortGroup: SortGroup.MIDDLE,
- proxy: root,
- focusCallback: null });
-
- item.root = root;
- item.name = name;
- item.iconName = icon;
+ addGroup(root, name, icon, params = {}) {
+ const {
+ sortGroup = SortGroup.MIDDLE,
+ proxy = root,
+ focusCallback = null,
+ } = params;
+
+ const item = {
+ name,
+ root,
+ sortGroup,
+ proxy,
+ focusCallback,
+ iconName: icon,
+ };
this._items.push(item);
root.connect('destroy', () => this.removeGroup(root));
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index cefde6f603..027497284f 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -5,7 +5,6 @@ const { Clutter, GLib, Meta, Shell, St } = imports.gi;
const Signals = imports.signals;
const Main = imports.ui.main;
-const Params = imports.misc.params;
// Time to scale down to maxDragActorSize
var SCALE_ANIMATION_TIME = 250;
@@ -79,19 +78,19 @@ function removeDragMonitor(monitor) {
}
var _Draggable = class _Draggable {
- constructor(actor, params) {
- params = Params.parse(params, {
- manualMode: false,
- timeoutThreshold: 0,
- restoreOnSuccess: false,
- dragActorMaxSize: undefined,
- dragActorOpacity: undefined,
- });
+ constructor(actor, params = {}) {
+ const {
+ manualMode = false,
+ timeoutThreshold = 0,
+ restoreOnSuccess = false,
+ dragActorMaxSize = undefined,
+ dragActorOpacity = undefined,
+ } = params;
this.actor = actor;
this._dragState = DragState.INIT;
- if (!params.manualMode) {
+ if (!manualMode) {
this.actor.connect('button-press-event',
this._onButtonPress.bind(this));
this.actor.connect('touch-event',
@@ -108,10 +107,10 @@ var _Draggable = class _Draggable {
this._onEventId = null;
this._touchSequence = null;
- this._restoreOnSuccess = params.restoreOnSuccess;
- this._dragActorMaxSize = params.dragActorMaxSize;
- this._dragActorOpacity = params.dragActorOpacity;
- this._dragTimeoutThreshold = params.timeoutThreshold;
+ this._restoreOnSuccess = restoreOnSuccess;
+ this._dragActorMaxSize = dragActorMaxSize;
+ this._dragActorOpacity = dragActorOpacity;
+ this._dragTimeoutThreshold = timeoutThreshold;
this._buttonDown = false; // The mouse button has been pressed and has not yet been released.
this._animationInProgress = false; // The drag is over and the item is in the process of animating
to its original position (snapping back or reverting).
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index e70285bdee..72c1fec44d 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -4,7 +4,6 @@
const { Clutter, St } = imports.gi;
const Main = imports.ui.main;
-const Params = imports.misc.params;
let _capturedEventId = 0;
let _grabHelperStack = [];
@@ -165,27 +164,35 @@ var GrabHelper = class GrabHelper {
// to that actor instead of navigating in @params.actor. This is for
// use cases like menus, where we want to grab the menu actor, but keep
// focus on the clicked on menu item.
- grab(params) {
- params = Params.parse(params, { actor: null,
- focus: null,
- onUngrab: null });
-
- let focus = global.stage.key_focus;
- let hadFocus = focus && this._isWithinGrabbedActor(focus);
- let newFocus = params.actor;
-
- if (this.isActorGrabbed(params.actor))
+ grab(params = {}) {
+ const {
+ actor = null,
+ focus = null,
+ onUngrab = null,
+ } = params;
+
+ const keyFocus = global.stage.key_focus;
+ let hadFocus = keyFocus && this._isWithinGrabbedActor(keyFocus);
+ let newFocus = actor;
+
+ if (this.isActorGrabbed(actor))
return true;
- params.savedFocus = focus;
+ const stackParams = {
+ ...params,
+ savedFocus: keyFocus,
+ actor,
+ focus,
+ onUngrab,
+ };
if (!this._takeModalGrab())
return false;
- this._grabStack.push(params);
+ this._grabStack.push(stackParams);
- if (params.focus) {
- params.focus.grab_key_focus();
+ if (focus) {
+ focus.grab_key_focus();
} else if (newFocus && hadFocus) {
if (!newFocus.navigate_focus(null, St.DirectionType.TAB_FORWARD, false))
newFocus.grab_key_focus();
@@ -249,11 +256,13 @@ var GrabHelper = class GrabHelper {
// popped until the grabbed actor is at the top of the grab stack.
// The onUngrab callback for every grab is called for every popped
// grab with the parameter %false.
- ungrab(params) {
- params = Params.parse(params, { actor: this.currentGrab.actor,
- isUser: false });
+ ungrab(params = {}) {
+ const {
+ actor = this.currentGrab.actor,
+ isUser = false,
+ } = params;
- let grabStackIndex = this._findStackIndex(params.actor);
+ let grabStackIndex = this._findStackIndex(actor);
if (grabStackIndex < 0)
return;
@@ -269,7 +278,7 @@ var GrabHelper = class GrabHelper {
let poppedGrab = poppedGrabs[i];
if (poppedGrab.onUngrab)
- poppedGrab.onUngrab(params.isUser);
+ poppedGrab.onUngrab(isUser);
this._releaseModalGrab();
}
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 65b130ce74..4f011fe67f 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -3,7 +3,6 @@
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi;
-const Params = imports.misc.params;
const Main = imports.ui.main;
var ICON_SIZE = 96;
@@ -65,15 +64,15 @@ var DragLocation = {
var BaseIcon = GObject.registerClass(
class BaseIcon extends Shell.SquareBin {
- _init(label, params) {
- params = Params.parse(params, {
- createIcon: null,
- setSizeManually: false,
- showLabel: true,
- });
+ _init(label, params = {}) {
+ const {
+ createIcon = null,
+ setSizeManually = false,
+ showLabel = true,
+ } = params;
let styleClass = 'overview-icon';
- if (params.showLabel)
+ if (showLabel)
styleClass += ' overview-icon-with-label';
super._init({ style_class: styleClass });
@@ -92,7 +91,7 @@ class BaseIcon extends Shell.SquareBin {
this._box.add_actor(this._iconBin);
- if (params.showLabel) {
+ if (showLabel) {
this.label = new St.Label({ text: label });
this.label.clutter_text.set({
x_align: Clutter.ActorAlign.CENTER,
@@ -103,9 +102,9 @@ class BaseIcon extends Shell.SquareBin {
this.label = null;
}
- if (params.createIcon)
- this.createIcon = params.createIcon;
- this._setSizeManually = params.setSizeManually;
+ if (createIcon)
+ this.createIcon = createIcon;
+ this._setSizeManually = setSizeManually;
this.icon = null;
@@ -1162,7 +1161,7 @@ var IconGrid = GObject.registerClass({
},
}, class IconGrid extends St.Viewport {
_init(layoutParams = {}) {
- layoutParams = Params.parse(layoutParams, {
+ const iconGridLayoutParams = {
allow_incomplete_pages: false,
orientation: Clutter.Orientation.HORIZONTAL,
columns_per_page: 6,
@@ -1173,8 +1172,9 @@ var IconGrid = GObject.registerClass({
last_row_align: Clutter.ActorAlign.START,
column_spacing: 0,
row_spacing: 0,
- });
- const layoutManager = new IconGridLayout(layoutParams);
+ ...layoutParams,
+ };
+ const layoutManager = new IconGridLayout(iconGridLayoutParams);
const pagesChangedId = layoutManager.connect('pages-changed',
() => this.emit('pages-changed'));
diff --git a/js/ui/layout.js b/js/ui/layout.js
index e3c5f49755..fb263f490a 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -9,7 +9,6 @@ const BackgroundMenu = imports.ui.backgroundMenu;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const Ripples = imports.ui.ripples;
var STARTUP_ANIMATION_TIME = 500;
@@ -849,11 +848,11 @@ var LayoutManager = GObject.registerClass({
return -1;
}
- _trackActor(actor, params) {
+ _trackActor(actor, params = {}) {
if (this._findActor(actor) != -1)
throw new Error('trying to re-track existing chrome actor');
- let actorData = Params.parse(params, defaultParams);
+ let actorData = { ...defaultParams, ...params };
actorData.actor = actor;
actorData.visibleId = actor.connect('notify::visible',
this._queueUpdateRegions.bind(this));
diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js
index 8348abada0..9e66ffd58f 100644
--- a/js/ui/lightbox.js
+++ b/js/ui/lightbox.js
@@ -3,7 +3,6 @@
const { Clutter, GObject, Shell, St } = imports.gi;
-const Params = imports.misc.params;
var DEFAULT_FADE_FACTOR = 0.4;
var VIGNETTE_BRIGHTNESS = 0.5;
@@ -109,27 +108,27 @@ var Lightbox = GObject.registerClass({
'active', 'active', 'active', GObject.ParamFlags.READABLE, false),
},
}, class Lightbox extends St.Bin {
- _init(container, params) {
- params = Params.parse(params, {
- inhibitEvents: false,
- width: null,
- height: null,
- fadeFactor: DEFAULT_FADE_FACTOR,
- radialEffect: false,
- });
+ _init(container, params = {}) {
+ const {
+ inhibitEvents = false,
+ width = null,
+ height = null,
+ fadeFactor = DEFAULT_FADE_FACTOR,
+ radialEffect = false,
+ } = params;
super._init({
- reactive: params.inhibitEvents,
- width: params.width,
- height: params.height,
+ reactive: inhibitEvents,
+ width,
+ height,
visible: false,
});
this._active = false;
this._container = container;
this._children = container.get_children();
- this._fadeFactor = params.fadeFactor;
- this._radialEffect = Clutter.feature_available(Clutter.FeatureFlags.SHADERS_GLSL) &&
params.radialEffect;
+ this._fadeFactor = fadeFactor;
+ this._radialEffect = Clutter.feature_available(Clutter.FeatureFlags.SHADERS_GLSL) && radialEffect;
if (this._radialEffect)
this.add_effect(new RadialShaderEffect({ name: 'radial' }));
@@ -141,7 +140,7 @@ var Lightbox = GObject.registerClass({
this.connect('destroy', this._onDestroy.bind(this));
- if (!params.width || !params.height) {
+ if (!width || !height) {
this.add_constraint(new Clutter.BindConstraint({
source: container,
coordinate: Clutter.BindCoordinate.ALL,
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 1adae95112..bdae5fefe0 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -7,7 +7,6 @@ const Signals = imports.signals;
const Background = imports.ui.background;
const FocusCaretTracker = imports.ui.focusCaretTracker;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const PointerWatcher = imports.ui.pointerWatcher;
var CROSSHAIRS_CLIP_SIZE = [100, 100];
@@ -1396,44 +1395,46 @@ var ZoomRegion = class ZoomRegion {
Main.uiGroup.set_opacity(uiGroupIsOccluded ? 0 : 255);
}
- _changeROI(params) {
+ _changeROI(params = {}) {
// Updates the area we are viewing; the magnification factors
// and center can be set explicitly, or we can recompute
// the position based on the mouse cursor position
- params = Params.parse(params, { xMagFactor: this._xMagFactor,
- yMagFactor: this._yMagFactor,
- xCenter: this._xCenter,
- yCenter: this._yCenter,
- redoCursorTracking: false,
- animate: false });
+ let {
+ xMagFactor = this._xMagFactor,
+ yMagFactor = this._yMagFactor,
+ xCenter = this._xCenter,
+ yCenter = this._yCenter,
+ redoCursorTracking = false,
+ animate = false,
+ } = params;
- if (params.xMagFactor <= 0)
- params.xMagFactor = this._xMagFactor;
- if (params.yMagFactor <= 0)
- params.yMagFactor = this._yMagFactor;
+ if (xMagFactor <= 0)
+ xMagFactor = this._xMagFactor;
+ if (yMagFactor <= 0)
+ yMagFactor = this._yMagFactor;
- this._xMagFactor = params.xMagFactor;
- this._yMagFactor = params.yMagFactor;
+ this._xMagFactor = xMagFactor;
+ this._yMagFactor = yMagFactor;
- if (params.redoCursorTracking &&
+ if (redoCursorTracking &&
this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE) {
// This depends on this.xMagFactor/yMagFactor already being updated
- [params.xCenter, params.yCenter] = this._centerFromMousePosition();
+ [xCenter, yCenter] = this._centerFromMousePosition();
}
if (this._clampScrollingAtEdges) {
let roiWidth = this._viewPortWidth / this._xMagFactor;
let roiHeight = this._viewPortHeight / this._yMagFactor;
- params.xCenter = Math.min(params.xCenter, global.screen_width - roiWidth / 2);
- params.xCenter = Math.max(params.xCenter, roiWidth / 2);
- params.yCenter = Math.min(params.yCenter, global.screen_height - roiHeight / 2);
- params.yCenter = Math.max(params.yCenter, roiHeight / 2);
+ xCenter = Math.min(xCenter, global.screen_width - roiWidth / 2);
+ xCenter = Math.max(xCenter, roiWidth / 2);
+ yCenter = Math.min(yCenter, global.screen_height - roiHeight / 2);
+ yCenter = Math.max(yCenter, roiHeight / 2);
}
- this._xCenter = params.xCenter;
- this._yCenter = params.yCenter;
+ this._xCenter = xCenter;
+ this._yCenter = yCenter;
// If in lens mode, move the magnified view such that it is centered
// over the actual mouse. However, in full screen mode, the "lens" is
@@ -1445,7 +1446,7 @@ var ZoomRegion = class ZoomRegion {
height: this._viewPortHeight }, true);
}
- this._updateCloneGeometry(params.animate);
+ this._updateCloneGeometry(animate);
}
_isMouseOverRegion() {
diff --git a/js/ui/main.js b/js/ui/main.js
index c7bac11f25..1069674ae9 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -27,7 +27,6 @@ const OsdMonitorLabeler = imports.ui.osdMonitorLabeler;
const Overview = imports.ui.overview;
const PadOsd = imports.ui.padOsd;
const Panel = imports.ui.panel;
-const Params = imports.misc.params;
const RunDialog = imports.ui.runDialog;
const WelcomeDialog = imports.ui.welcomeDialog;
const Layout = imports.ui.layout;
@@ -518,13 +517,15 @@ function _findModal(actor) {
*
* @returns {bool}: true iff we successfully acquired a grab or already had one
*/
-function pushModal(actor, params) {
- params = Params.parse(params, { timestamp: global.get_current_time(),
- options: 0,
- actionMode: Shell.ActionMode.NONE });
+function pushModal(actor, params = {}) {
+ const {
+ timestamp = global.get_current_time(),
+ options = 0,
+ actionMode: modalActionMode = Shell.ActionMode.NONE,
+ } = params;
if (modalCount == 0) {
- if (!global.begin_modal(params.timestamp, params.options)) {
+ if (!global.begin_modal(timestamp, options)) {
log('pushModal: invocation of begin_modal failed');
return false;
}
@@ -555,7 +556,7 @@ function pushModal(actor, params) {
prevFocusDestroyId,
actionMode });
- actionMode = params.actionMode;
+ actionMode = modalActionMode;
global.stage.set_key_focus(actor);
return true;
}
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 8a5c262a99..7596f105f6 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -9,7 +9,6 @@ const Calendar = imports.ui.calendar;
const GnomeSession = imports.misc.gnomeSession;
const Layout = imports.ui.layout;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
@@ -393,41 +392,43 @@ var Notification = GObject.registerClass({
// Updates the notification by regenerating its icon and updating
// the title/banner. If @params.clear is %true, it will also
// remove any additional actors/action buttons previously added.
- update(title, banner, params) {
- params = Params.parse(params, { gicon: null,
- secondaryGIcon: null,
- bannerMarkup: false,
- clear: false,
- datetime: null,
- soundName: null,
- soundFile: null });
+ update(title, banner, params = {}) {
+ const {
+ gicon = null,
+ secondaryGIcon = null,
+ bannerMarkup = false,
+ clear = false,
+ datetime = null,
+ soundName = null,
+ soundFile = null,
+ } = params;
this.title = title;
this.bannerBodyText = banner;
- this.bannerBodyMarkup = params.bannerMarkup;
+ this.bannerBodyMarkup = bannerMarkup;
- if (params.datetime)
- this.datetime = params.datetime;
+ if (datetime)
+ this.datetime = datetime;
else
this.datetime = GLib.DateTime.new_now_local();
- if (params.gicon || params.clear)
- this.gicon = params.gicon;
+ if (gicon || clear)
+ this.gicon = gicon;
- if (params.secondaryGIcon || params.clear)
- this.secondaryGIcon = params.secondaryGIcon;
+ if (secondaryGIcon || clear)
+ this.secondaryGIcon = secondaryGIcon;
- if (params.clear)
+ if (clear)
this.actions = [];
- if (this._soundName != params.soundName ||
- this._soundFile != params.soundFile) {
- this._soundName = params.soundName;
- this._soundFile = params.soundFile;
+ if (this._soundName != soundName ||
+ this._soundFile != soundFile) {
+ this._soundName = soundName;
+ this._soundFile = soundFile;
this._soundPlayed = false;
}
- this.emit('updated', params.clear);
+ this.emit('updated', clear);
}
// addAction:
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index caa874454f..10fe90310c 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -7,7 +7,6 @@ const Dialog = imports.ui.dialog;
const Layout = imports.ui.layout;
const Lightbox = imports.ui.lightbox;
const Main = imports.ui.main;
-const Params = imports.misc.params;
var OPEN_AND_CLOSE_TIME = 100;
var FADE_OUT_DIALOG_TIME = 1000;
@@ -30,26 +29,27 @@ var ModalDialog = GObject.registerClass({
},
Signals: { 'opened': {}, 'closed': {} },
}, class ModalDialog extends St.Widget {
- _init(params) {
+ _init(params = {}) {
super._init({ visible: false,
x: 0,
y: 0,
accessible_role: Atk.Role.DIALOG });
- params = Params.parse(params, { shellReactive: false,
- styleClass: null,
- actionMode: Shell.ActionMode.SYSTEM_MODAL,
- shouldFadeIn: true,
- shouldFadeOut: true,
- destroyOnClose: true });
+ const {
+ shellReactive = false,
+ actionMode = Shell.ActionMode.SYSTEM_MODAL,
+ shouldFadeIn = true,
+ shouldFadeOut = true,
+ destroyOnClose = true,
+ } = params;
this._state = State.CLOSED;
this._hasModal = false;
- this._actionMode = params.actionMode;
- this._shellReactive = params.shellReactive;
- this._shouldFadeIn = params.shouldFadeIn;
- this._shouldFadeOut = params.shouldFadeOut;
- this._destroyOnClose = params.destroyOnClose;
+ this._actionMode = actionMode;
+ this._shellReactive = shellReactive;
+ this._shouldFadeIn = shouldFadeIn;
+ this._shouldFadeOut = shouldFadeOut;
+ this._destroyOnClose = destroyOnClose;
Main.layoutManager.modalDialogGroup.add_actor(this);
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 69137b1b23..0f0ba9cf55 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -6,7 +6,6 @@ const { GdkPixbuf, Gio, GLib, GObject, Shell, St } = imports.gi;
const Config = imports.misc.config;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
-const Params = imports.misc.params;
const { loadInterfaceXML } = imports.misc.fileUtils;
@@ -136,7 +135,7 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
hints[hint] = hints[hint].deep_unpack();
}
- hints = Params.parse(hints, { urgency: Urgency.NORMAL }, true);
+ hints = { urgency: Urgency.NORMAL, ...hints };
// Filter out chat, presence, calls and invitation notifications from
// Empathy, since we handle that information from telepathyClient.js
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 87bf835b03..49a724b661 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -13,7 +13,6 @@ const LayoutManager = imports.ui.layout;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
const OverviewControls = imports.ui.overviewControls;
-const Params = imports.misc.params;
const SwipeTracker = imports.ui.swipeTracker;
const WindowManager = imports.ui.windowManager;
const WorkspaceThumbnail = imports.ui.workspaceThumbnail;
@@ -27,14 +26,11 @@ var ShellInfo = class {
this._source = null;
}
- setMessage(text, options) {
- options = Params.parse(options, {
- undoCallback: null,
- forFeedback: false,
- });
-
- let undoCallback = options.undoCallback;
- let forFeedback = options.forFeedback;
+ setMessage(text, options = {}) {
+ const {
+ undoCallback = null,
+ forFeedback = false,
+ } = options;
if (this._source == null) {
this._source = new MessageTray.SystemNotificationSource();
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index 0c2478f8db..ccfe97613c 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -4,19 +4,18 @@
const { Atk, Clutter, GObject, St } = imports.gi;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
var ButtonBox = GObject.registerClass(
class ButtonBox extends St.Widget {
_init(params) {
- params = Params.parse(params, {
- style_class: 'panel-button',
- x_expand: true,
- y_expand: true,
- }, true);
+ const {
+ style_class = 'panel-button',
+ x_expand = true,
+ y_expand = true,
+ } = params;
- super._init(params);
+ super._init({ ...params, style_class, x_expand, y_expand });
this._delegate = this;
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index ff83d2ceb2..9526c5e44d 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -9,7 +9,6 @@ const Signals = imports.signals;
const BoxPointer = imports.ui.boxpointer;
const GrabHelper = imports.ui.grabHelper;
const Main = imports.ui.main;
-const Params = imports.misc.params;
var Ornament = {
NONE: 0,
@@ -70,18 +69,19 @@ var PopupBaseMenuItem = GObject.registerClass({
'activate': { param_types: [Clutter.Event.$gtype] },
},
}, class PopupBaseMenuItem extends St.BoxLayout {
- _init(params) {
- params = Params.parse(params, {
- reactive: true,
- activate: true,
- hover: true,
- style_class: null,
- can_focus: true,
- });
+ _init(params = {}) {
+ const {
+ reactive = true,
+ activate = true,
+ hover = true,
+ style_class: styleClass = null,
+ can_focus = true,
+ } = params;
+
super._init({ style_class: 'popup-menu-item',
- reactive: params.reactive,
- track_hover: params.reactive,
- can_focus: params.can_focus,
+ reactive,
+ track_hover: reactive,
+ can_focus,
accessible_role: Atk.Role.MENU_ITEM });
this._delegate = this;
@@ -91,16 +91,16 @@ var PopupBaseMenuItem = GObject.registerClass({
this._parent = null;
this._active = false;
- this._activatable = params.reactive && params.activate;
+ this._activatable = reactive && activate;
this._sensitive = true;
if (!this._activatable)
this.add_style_class_name('popup-inactive-menu-item');
- if (params.style_class)
- this.add_style_class_name(params.style_class);
+ if (styleClass)
+ this.add_style_class_name(styleClass);
- if (params.reactive && params.hover)
+ if (reactive && hover)
this.bind_property('hover', this, 'active', GObject.BindingFlags.SYNC_CREATE);
}
@@ -1286,10 +1286,11 @@ class PopupSubMenuMenuItem extends PopupBaseMenuItem {
* Call addMenu to add menus
*/
var PopupMenuManager = class {
- constructor(owner, grabParams) {
- grabParams = Params.parse(grabParams,
- { actionMode: Shell.ActionMode.POPUP });
- this._grabHelper = new GrabHelper.GrabHelper(owner, grabParams);
+ constructor(owner, grabParams = {}) {
+ this._grabHelper = new GrabHelper.GrabHelper(owner, {
+ actionMode: Shell.ActionMode.POPUP,
+ ...grabParams,
+ });
this._menus = [];
}
diff --git a/js/ui/scripting.js b/js/ui/scripting.js
index e4b29a4cc6..69bd229df5 100644
--- a/js/ui/scripting.js
+++ b/js/ui/scripting.js
@@ -7,7 +7,6 @@ const { Gio, GLib, Meta, Shell } = imports.gi;
const Config = imports.misc.config;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const Util = imports.misc.util;
const { loadInterfaceXML } = imports.misc.fileUtils;
@@ -111,17 +110,19 @@ function _callRemote(obj, method, ...args) {
* because of the normal X asynchronous mapping process, to actually wait
* until the window has been mapped and exposed, use waitTestWindows().
*/
-function createTestWindow(params) {
- params = Params.parse(params, { width: 640,
- height: 480,
- alpha: false,
- maximized: false,
- redraws: false });
+function createTestWindow(params = {}) {
+ const {
+ width = 640,
+ height = 480,
+ alpha = false,
+ maximized = false,
+ redraws = false,
+ } = params;
let perfHelper = _getPerfHelper();
return _callRemote(perfHelper, perfHelper.CreateWindowRemote,
- params.width, params.height,
- params.alpha, params.maximized, params.redraws);
+ width, height,
+ alpha, maximized, redraws);
}
/**
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index afcd67cfd2..254266d018 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -5,7 +5,6 @@ const GLib = imports.gi.GLib;
const Signals = imports.signals;
const FileUtils = imports.misc.fileUtils;
-const Params = imports.misc.params;
const Config = imports.misc.config;
@@ -181,12 +180,17 @@ var SessionMode = class {
let params = _modes[this.currentMode];
let defaults;
if (params.parentMode) {
- defaults = Params.parse(_modes[params.parentMode],
- _modes[DEFAULT_MODE]);
+ defaults = {
+ ..._modes[DEFAULT_MODE],
+ ..._modes[params.parentMode],
+ };
} else {
- defaults = _modes[DEFAULT_MODE];
+ defaults = {
+ ..._modes[DEFAULT_MODE],
+ };
}
- params = Params.parse(params, defaults);
+
+ params = { ...defaults, ...params };
// A simplified version of Lang.copyProperties, handles
// undefined as a special case for "no change / inherit from previous mode"
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index a2010b39e0..f3e2b63d33 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -5,7 +5,6 @@ const { Clutter, GObject, Pango, Shell, St } = imports.gi;
const BoxPointer = imports.ui.boxpointer;
const Main = imports.ui.main;
-const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
var EntryMenu = class extends PopupMenu.PopupMenu {
@@ -127,15 +126,15 @@ function _onPopup(actor, entry) {
entry.menu.open(BoxPointer.PopupAnimation.FULL);
}
-function addContextMenu(entry, params) {
+function addContextMenu(entry, params = {}) {
if (entry.menu)
return;
- params = Params.parse(params, { actionMode: Shell.ActionMode.POPUP });
+ const { actionMode = Shell.ActionMode.POPUP } = params;
entry.menu = new EntryMenu(entry);
entry._menuManager = new PopupMenu.PopupMenuManager(entry,
- { actionMode: params.actionMode });
+ { actionMode });
entry._menuManager.addMenu(entry.menu);
// Add an event handler to both the entry and its clutter_text; the former
diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js
index 2956c0e967..1101c03b37 100644
--- a/js/ui/shellMountOperation.js
+++ b/js/ui/shellMountOperation.js
@@ -9,7 +9,6 @@ const Dialog = imports.ui.dialog;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
const ModalDialog = imports.ui.modalDialog;
-const Params = imports.misc.params;
const ShellEntry = imports.ui.shellEntry;
const { loadInterfaceXML } = imports.misc.fileUtils;
@@ -50,12 +49,12 @@ function _setLabelsForMessage(content, message) {
/* -------------------------------------------------------- */
var ShellMountOperation = class {
- constructor(source, params) {
- params = Params.parse(params, { existingDialog: null });
+ constructor(source, params = {}) {
+ const { existingDialog = null } = params;
this._dialog = null;
this._dialogId = 0;
- this._existingDialog = params.existingDialog;
+ this._existingDialog = existingDialog;
this._processesDialog = null;
this.mountOp = new Shell.MountOperation();
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index 4546b76b61..8d96c2dd87 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -4,7 +4,6 @@
const { Clutter, Gio, GObject, Meta } = imports.gi;
const Main = imports.ui.main;
-const Params = imports.misc.params;
// FIXME: ideally these values matches physical touchpad size. We can get the
// correct values for gnome-shell specifically, since mutter uses libinput
@@ -463,9 +462,9 @@ var SwipeTracker = GObject.registerClass({
'end': { param_types: [GObject.TYPE_UINT64, GObject.TYPE_DOUBLE] },
},
}, class SwipeTracker extends GObject.Object {
- _init(actor, orientation, allowedModes, params) {
+ _init(actor, orientation, allowedModes, params = {}) {
super._init();
- params = Params.parse(params, { allowDrag: true, allowScroll: true });
+ const { allowDrag = true, allowScroll = true } = params;
this.orientation = orientation;
this._allowedModes = allowedModes;
@@ -495,7 +494,7 @@ var SwipeTracker = GObject.registerClass({
this.bind_property('distance', this._touchGesture, 'distance', 0);
global.stage.add_action(this._touchGesture);
- if (params.allowDrag) {
+ if (allowDrag) {
this._dragGesture = new TouchSwipeGesture(allowedModes, 1,
Clutter.GestureTriggerEdge.AFTER);
this._dragGesture.connect('begin', this._beginGesture.bind(this));
@@ -511,7 +510,7 @@ var SwipeTracker = GObject.registerClass({
this._dragGesture = null;
}
- if (params.allowScroll) {
+ if (allowScroll) {
this._scrollGesture = new ScrollGesture(actor, allowedModes);
this._scrollGesture.connect('begin', this._beginGesture.bind(this));
this._scrollGesture.connect('update', this._updateGesture.bind(this));
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js
index c376028af3..bfc91e2766 100644
--- a/js/ui/userWidget.js
+++ b/js/ui/userWidget.js
@@ -5,7 +5,6 @@
const { Clutter, GLib, GObject, St } = imports.gi;
-const Params = imports.misc.params;
var AVATAR_ICON_SIZE = 64;
@@ -16,22 +15,22 @@ var AVATAR_ICON_SIZE = 64;
var Avatar = GObject.registerClass(
class Avatar extends St.Bin {
- _init(user, params) {
+ _init(user, params = {}) {
let themeContext = St.ThemeContext.get_for_stage(global.stage);
- params = Params.parse(params, {
- styleClass: 'user-icon',
- reactive: false,
- iconSize: AVATAR_ICON_SIZE,
- });
+ const {
+ styleClass = 'user-icon',
+ reactive = false,
+ iconSize = AVATAR_ICON_SIZE,
+ } = params;
super._init({
- style_class: params.styleClass,
- reactive: params.reactive,
- width: params.iconSize * themeContext.scaleFactor,
- height: params.iconSize * themeContext.scaleFactor,
+ style_class: styleClass,
+ reactive,
+ width: iconSize * themeContext.scaleFactor,
+ height: iconSize * themeContext.scaleFactor,
});
- this._iconSize = params.iconSize;
+ this._iconSize = iconSize;
this._user = user;
this.bind_property('reactive', this, 'track-hover',
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 6c32f01da9..1c3a15710a 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -7,7 +7,6 @@ const Background = imports.ui.background;
const DND = imports.ui.dnd;
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
-const Params = imports.misc.params;
const Util = imports.misc.util;
const { WindowPreview } = imports.ui.windowPreview;
@@ -97,19 +96,19 @@ const BACKGROUND_MARGIN = 12;
// and center it horizontally, and align it to the bottom vertically.
var LayoutStrategy = class {
- constructor(params) {
- params = Params.parse(params, {
- monitor: null,
- rowSpacing: 0,
- columnSpacing: 0,
- });
-
- if (!params.monitor)
+ constructor(params = {}) {
+ const {
+ monitor = null,
+ rowSpacing = 0,
+ columnSpacing = 0,
+ } = params;
+
+ if (!monitor)
throw new Error(`No monitor param passed to ${this.constructor.name}`);
- this._monitor = params.monitor;
- this._rowSpacing = params.rowSpacing;
- this._columnSpacing = params.columnSpacing;
+ this._monitor = monitor;
+ this._rowSpacing = rowSpacing;
+ this._columnSpacing = columnSpacing;
}
// Compute a strategy-specific overall layout given a list of WindowPreviews
@@ -204,16 +203,12 @@ var UnalignedLayoutStrategy = class extends LayoutStrategy {
row.windows.sort((a, b) => a.windowCenter.x - b.windowCenter.x);
}
- computeLayout(windows, layoutParams) {
- layoutParams = Params.parse(layoutParams, {
- numRows: 0,
- });
+ computeLayout(windows, layoutParams = {}) {
+ const { numRows = 0 } = layoutParams;
- if (layoutParams.numRows === 0)
+ if (numRows === 0)
throw new Error(`${this.constructor.name}: No numRows given in layout params`);
- const numRows = layoutParams.numRows;
-
let rows = [];
let totalWidth = 0;
for (let i = 0; i < windows.length; i++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]