403Webshell
Server IP : 104.21.25.180  /  Your IP : 104.23.197.122
Web Server : Apache/2.4.37
System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64
User : ricodeal ( 1046)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/sushi/js/ui/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/sushi/js/ui/spinnerBox.js
/*
 * 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 <[email protected]>
 *
 */

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'
                         });
    },
});

Youez - 2016 - github.com/yon3zu
LinuXploit