/usr/share/sushi/js/ui/spinnerBox.js is in gnome-sushi 3.24.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | /*
* Copyright (C) 2011 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* The Sushi project hereby grant permission for non-gpl compatible GStreamer
* plugins to be used and distributed together with GStreamer and Sushi. This
* permission is above and beyond the permissions granted by the GPL license
* Sushi is covered by.
*
* Authors: Cosimo Cecchi <cosimoc@redhat.com>
*
*/
const Gettext = imports.gettext.domain('sushi');
const _ = Gettext.gettext;
const Gtk = imports.gi.Gtk;
const GtkClutter = imports.gi.GtkClutter;
const Tweener = imports.ui.tweener;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
let SPINNER_SIZE = 48;
let TIMEOUT = 500;
const SpinnerBox = new Lang.Class({
Name: 'SpinnerBox',
_init : function(args) {
this._timeoutId = 0;
this.canFullScreen = false;
this.moveOnClick = true;
this._spinnerBox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 12);
this._spinnerBox.show();
this._spinner = Gtk.Spinner.new();
this._spinner.show();
this._spinner.set_size_request(SPINNER_SIZE, SPINNER_SIZE);
this._spinnerBox.pack_start(this._spinner, true, true, 0);
this._label = new Gtk.Label();
this._label.set_text(_("Loading…"));
this._label.show();
this._spinnerBox.pack_start(this._label, true, true, 0);
this.actor = new GtkClutter.Actor({ contents: this._spinnerBox });
this.actor.set_opacity(0);
},
render : function() {
return this.actor;
},
getSizeForAllocation : function() {
let spinnerSize = this._spinnerBox.get_preferred_size();
return [ spinnerSize[0].width,
spinnerSize[0].height ];
},
startTimeout : function() {
if (this._timeoutId)
return;
this._spinner.start();
this._timeoutId = Mainloop.timeout_add(TIMEOUT,
Lang.bind(this,
this._onTimeoutCompleted));
},
destroy : function() {
if (this._timeoutId) {
Mainloop.source_remove(this._timeoutId);
this._timeoutId = 0;
}
Tweener.addTween(this.actor,
{ opacity: 0,
time: 0.15,
transition: 'easeOutQuad',
onComplete: function() {
this.actor.destroy();
},
onCompleteScope: this
});
},
_onTimeoutCompleted : function() {
this._timeoutId = 0;
Tweener.addTween(this.actor,
{ opacity: 255,
time: 0.3,
transition: 'easeOutQuad'
});
},
});
|