statusicon: Animate elipsis in menu when syncing

This commit is contained in:
Hylke Bons 2012-09-08 09:43:44 +01:00
parent efae41176a
commit ffe227003f

View file

@ -161,6 +161,8 @@ namespace SparkleShare {
UpdateMenuEvent (CurrentState); UpdateMenuEvent (CurrentState);
}; };
int periods = 3;
Program.Controller.OnSyncing += delegate { Program.Controller.OnSyncing += delegate {
int repos_syncing_up = 0; int repos_syncing_up = 0;
int repos_syncing_down = 0; int repos_syncing_down = 0;
@ -177,23 +179,32 @@ namespace SparkleShare {
repos_syncing_down > 0) { repos_syncing_down > 0) {
CurrentState = IconState.Syncing; CurrentState = IconState.Syncing;
StateText = "Syncing changes"; StateText = "Syncing changes";
} else if (repos_syncing_down == 0) { } else if (repos_syncing_down == 0) {
CurrentState = IconState.SyncingUp; CurrentState = IconState.SyncingUp;
StateText = "Sending changes"; StateText = "Sending changes";
} else { } else {
CurrentState = IconState.SyncingDown; CurrentState = IconState.SyncingDown;
StateText = "Receiving changes"; StateText = "Receiving changes";
} }
periods++;
for (int i = 0; i < periods; i++)
StateText += ".";
if (periods == 3)
periods = 0;
StateText += " " + ProgressPercentage + "% " + ProgressSpeed; StateText += " " + ProgressPercentage + "% " + ProgressSpeed;
UpdateStatusItemEvent (StateText); UpdateStatusItemEvent (StateText);
UpdateQuitItemEvent (QuitItemEnabled); UpdateQuitItemEvent (QuitItemEnabled);
this.animation.Start (); if (!this.animation.Enabled)
this.animation.Start ();
}; };
Program.Controller.OnError += delegate { Program.Controller.OnError += delegate {