statusicon: tell whether we're sending or receiving files (or both)

This commit is contained in:
Hylke Bons 2012-03-16 01:23:10 +00:00
parent daf4818cc2
commit 881eb94d48
4 changed files with 59 additions and 13 deletions

View file

@ -112,9 +112,17 @@ namespace SparkleShare {
break;
case IconState.Syncing:
case default:
string state_text;
if (state == IconState.SyncingUp)
state_text = _("Sending files…");
else if (state == IconState.SyncingDown)
state_text = _("Receiving files…");
else
state_text = _("Syncing…");
this.state_text = _("Syncing… ") +
this.state_text = state_text +
Controller.ProgressPercentage + "% " +
Controller.ProgressSpeed;

View file

@ -124,9 +124,17 @@ namespace SparkleShare {
break;
case IconState.Syncing:
case default:
string state_text;
if (state == IconState.SyncingUp)
state_text = "Sending files…";
else if (state == IconState.SyncingDown)
state_text = "Receiving files…";
else
state_text = "Syncing…";
StateText = _("Syncing… ") +
StateText = state_text +
Controller.ProgressPercentage + "% " +
Controller.ProgressSpeed;

View file

@ -95,7 +95,6 @@ namespace SparkleShare {
UpdateMenuEvent (CurrentState);
};
Program.Controller.OnIdle += delegate {
if (CurrentState != IconState.Error)
CurrentState = IconState.Idle;
@ -107,18 +106,40 @@ namespace SparkleShare {
UpdateMenuEvent (CurrentState);
};
Program.Controller.OnSyncing += delegate {
CurrentState = IconState.Syncing;
int repos_syncing_up = 0;
int repos_syncing_down = 0;
foreach (SparkleRepoBase repo in
Program.Controller.Repositories.GetRange (
0, Program.Controller.Repositories.Count)) {
if (repo.Status == SyncStatus.SyncUp)
repos_syncing_up++;
if (repo.Status == SyncStatus.SyncDown)
repos_syncing_down++;
}
if (repos_syncing_up > 0 &&
repos_syncing_down > 0) {
CurrentState = IconState.Syncing;
} else if (repos_syncing_down == 0) {
CurrentState = IconState.SyncingUp;
} else {
CurrentState = IconState.SyncingDown;
}
if (UpdateQuitItemEvent != null)
UpdateQuitItemEvent (QuitItemEnabled);
if (UpdateMenuEvent != null)
UpdateMenuEvent (IconState.Syncing);
UpdateMenuEvent (CurrentState);
};
Program.Controller.OnError += delegate {
CurrentState = IconState.Error;
@ -126,7 +147,7 @@ namespace SparkleShare {
UpdateQuitItemEvent (QuitItemEnabled);
if (UpdateMenuEvent != null)
UpdateMenuEvent (IconState.Error);
UpdateMenuEvent (CurrentState);
};
}
@ -160,6 +181,7 @@ namespace SparkleShare {
Program.Controller.ShowAboutWindow ();
}
public void QuitClicked ()
{
Program.Controller.Quit ();

View file

@ -96,9 +96,17 @@ namespace SparkleShare {
break;
}
case IconState.Syncing: {
this.notify_icon.Text = StateText = "Syncing… " +
default: {
string state_text;
if (state == IconState.SyncingUp)
state_text = "Sending files…";
else if (state == IconState.SyncingDown)
state_text = "Receiving files…";
else
state_text = "Syncing…";
this.notify_icon.Text = StateText = state_text + " " +
Controller.ProgressPercentage + "% " +
Controller.ProgressSpeed;