Better handling of spinners

This commit is contained in:
Benjamin Drieu 2021-12-06 11:45:02 +01:00 committed by Benjamin Drieu
parent bba8b0a69c
commit 44d2c57dc4
2 changed files with 14 additions and 9 deletions

View File

@ -215,8 +215,7 @@ class Indicator extends PanelMenu.Button {
if ( ! widget )
return;
widget.prevChild = widget.get_child ( );
let _size = widget.prevChild.width;
let _size = widget.get_child().width;
let _child = new St.Icon({
style_class: 'monito-button-icon',
@ -232,16 +231,24 @@ class Indicator extends PanelMenu.Button {
_transition.set_from ( 0 );
_transition.set_to ( 360 );
widget.set_child ( _child );
_child.set_pivot_point ( .5, .5 );
_child.add_transition ( 'rotation', _transition );
widget.set_child ( _child );
}
stopChildSpin ( widget )
{
widget.remove_all_children ( );
widget.set_child ( widget.prevChild );
let _size = widget.get_child().width;
widget.get_child().get_transition('rotation').stop();
widget.child = new St.Icon({
style_class: 'monito-button-icon',
icon_name: widget.prevIcon,
icon_size: _size,
width: _size,
height: _size,
});
}
createHeaderBin ( colName ) {
@ -545,6 +552,7 @@ class Indicator extends PanelMenu.Button {
style_class: 'button big-button',
rotation_angle_x: 0.0,
});
button.prevIcon = icon;
button.child = new St.Icon({
style_class: 'monito-button-icon',

View File

@ -228,10 +228,7 @@ class GenericServer {
formatDate ( date )
{
if ( typeof date == 'string' || date instanceof String )
{
date = Date.parse ( date ) / 1000;
log ( date );
}
return this.timeAgo ( new Date ( date * 1000 ) );
}