animation: Turn Spinner animate parameter into Params option
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/834
This commit is contained in:
parent
7e8884a601
commit
96ac00b53c
@ -3,6 +3,8 @@
|
||||
|
||||
const { Clutter, GLib, 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;
|
||||
@ -131,12 +133,19 @@ var AnimatedIcon = class extends Animation {
|
||||
};
|
||||
|
||||
var Spinner = class extends AnimatedIcon {
|
||||
constructor(size, animate = false) {
|
||||
constructor(size, params) {
|
||||
// Compatibility with older callers
|
||||
if (params === true || params === false)
|
||||
params = { animate: params };
|
||||
|
||||
params = Params.parse(params, {
|
||||
animate: false,
|
||||
});
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
|
||||
super(file, size);
|
||||
|
||||
this.actor.opacity = 0;
|
||||
this._animate = animate;
|
||||
this._animate = params.animate;
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
|
@ -74,7 +74,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.actor, 0, row, 1, 1);
|
||||
|
@ -105,7 +105,9 @@ var AuthenticationDialog = GObject.registerClass({
|
||||
this._passwordBox.add(this._passwordEntry,
|
||||
{ expand: true });
|
||||
|
||||
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.actor);
|
||||
|
||||
this.setInitialKeyFocus(this._passwordEntry);
|
||||
|
@ -234,7 +234,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.actor);
|
||||
|
||||
let menu = new AppMenu(this);
|
||||
|
@ -359,7 +359,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.actor;
|
||||
|
||||
if (rtl) {
|
||||
|
Loading…
Reference in New Issue
Block a user