From 6af25b282c1381f940995e74075355338afa0ef8 Mon Sep 17 00:00:00 2001 From: Joonas Henriksson Date: Mon, 18 Nov 2019 22:18:29 +0200 Subject: [PATCH] animation: Turn Spinner animate parameter into Params option https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/832 --- js/ui/animation.js | 9 +++++++-- js/ui/components/keyring.js | 4 +++- js/ui/components/polkitAgent.js | 4 +++- js/ui/panel.js | 4 +++- js/ui/shellMountOperation.js | 4 +++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/js/ui/animation.js b/js/ui/animation.js index 0db7cd80e..6002a3754 100644 --- a/js/ui/animation.js +++ b/js/ui/animation.js @@ -3,6 +3,8 @@ const { Clutter, GLib, GObject, Gio, St } = imports.gi; +const Params = imports.misc.params; + var ANIMATED_ICON_UPDATE_TIMEOUT = 16; var SPINNER_ANIMATION_TIME = 300; var SPINNER_ANIMATION_DELAY = 1000; @@ -136,12 +138,15 @@ class AnimatedIcon extends Animation { var Spinner = GObject.registerClass( class Spinner extends AnimatedIcon { - _init(size, animate = false) { + _init(size, params) { + params = Params.parse(params, { + animate: false, + }); let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg'); super._init(file, size); this.opacity = 0; - this._animate = animate; + this._animate = params.animate; } _onDestroy() { diff --git a/js/ui/components/keyring.js b/js/ui/components/keyring.js index 8455eaa4e..8d0eccaa6 100644 --- a/js/ui/components/keyring.js +++ b/js/ui/components/keyring.js @@ -78,7 +78,9 @@ class KeyringDialog extends ModalDialog.ModalDialog { ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); this._passwordEntry.clutter_text.connect('activate', this._onPasswordActivate.bind(this)); - this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, true); + this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, { + animate: true, + }); if (rtl) { layout.attach(this._workSpinner, 0, row, 1, 1); diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index a25d65100..bef62bd95 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -103,7 +103,9 @@ var AuthenticationDialog = GObject.registerClass({ GObject.BindingFlags.SYNC_CREATE); this._passwordBox.add_child(this._passwordEntry); - this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, true); + this._workspinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, { + animate: true, + }); this._passwordBox.add(this._workSpinner); this._passwordBox.hide(); diff --git a/js/ui/panel.js b/js/ui/panel.js index e8e45b0ab..9e05722bf 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -237,7 +237,9 @@ var AppMenuButton = GObject.registerClass({ this._overviewHidingId = Main.overview.connect('hiding', this._sync.bind(this)); this._overviewShowingId = Main.overview.connect('showing', this._sync.bind(this)); - this._spinner = new Animation.Spinner(PANEL_ICON_SIZE, true); + this._spinner = new Animation.Spinner(PANEL_ICON_SIZE, { + animate: true, + }); this._container.add_actor(this._spinner); let menu = new AppMenu(this); diff --git a/js/ui/shellMountOperation.js b/js/ui/shellMountOperation.js index 4934ee426..68a6d3286 100644 --- a/js/ui/shellMountOperation.js +++ b/js/ui/shellMountOperation.js @@ -362,7 +362,9 @@ var ShellMountPasswordDialog = GObject.registerClass({ this._passwordEntry.clutter_text.set_password_char('\u25cf'); // ● U+25CF BLACK CIRCLE ShellEntry.addContextMenu(this._passwordEntry, { isPassword: true }); this.setInitialKeyFocus(this._passwordEntry); - this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, true); + this._workSpinner = new Animation.Spinner(WORK_SPINNER_ICON_SIZE, { + animate: true, + }); this._passwordEntry.secondary_icon = this._workSpinner; if (rtl) {