@@ -14,38 +14,26 @@ export global State {
1414 in-out property <[Task ]> active-action-tasks ;
1515 in-out property <[string ]> active-action-buttons ;
1616 in-out property <string > window-title ;
17+ in-out property <int > spinner-rotation ;
1718
1819 callback action-button-click (name : string );
1920 callback action-start (name : string );
2021}
2122
2223export component ActionState inherits Rectangle {
2324 in property <int > state ;
24- property <int > rotation : 0 ;
25-
26- timer := Timer {
27- interval : 150ms ;
28- running : true ;
29- triggered => {
30- rotation += 1 ;
31-
32- if rotation >= 8 {
33- rotation = 0 ;
34- }
35- }
36- }
3725
3826 width : 32px ;
3927 height : 32px ;
4028
4129 if state == 1 : Image {
42- source : rotation == 0 ? @image-url ("./assets/spinner.svg" ) :
43- rotation == 1 ? @image-url ("./assets/spinner-45.svg" ) :
44- rotation == 2 ? @image-url ("./assets/spinner-90.svg" ) :
45- rotation == 3 ? @image-url ("./assets/spinner-135.svg" ) :
46- rotation == 4 ? @image-url ("./assets/spinner-180.svg" ) :
47- rotation == 5 ? @image-url ("./assets/spinner-225.svg" ) :
48- rotation == 6 ? @image-url ("./assets/spinner-270.svg" ) :
30+ source : State.spinner- rotation == 0 ? @image-url ("./assets/spinner.svg" ) :
31+ State.spinner- rotation == 1 ? @image-url ("./assets/spinner-45.svg" ) :
32+ State.spinner- rotation == 2 ? @image-url ("./assets/spinner-90.svg" ) :
33+ State.spinner- rotation == 3 ? @image-url ("./assets/spinner-135.svg" ) :
34+ State.spinner- rotation == 4 ? @image-url ("./assets/spinner-180.svg" ) :
35+ State.spinner- rotation == 5 ? @image-url ("./assets/spinner-225.svg" ) :
36+ State.spinner- rotation == 6 ? @image-url ("./assets/spinner-270.svg" ) :
4937 @image-url ("./assets/spinner-315.svg" ) ;
5038 width : 100% ;
5139 colorize : Palette.control-foreground;
@@ -233,6 +221,18 @@ export component ActionList {
233221export component AppWindow inherits Window {
234222 default-font-family : "Adwaita Sans" ;
235223
224+ timer := Timer {
225+ interval : 150ms ;
226+ running : true ;
227+ triggered => {
228+ State.spinner-rotation += 1 ;
229+
230+ if State.spinner-rotation >= 8 {
231+ State.spinner-rotation = 0 ;
232+ }
233+ }
234+ }
235+
236236 if State.active-action == "" : ActionList {
237237 width : 100% ;
238238 height : 100% ;
0 commit comments