diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index 8497b563..9271c8c1 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -221,6 +221,11 @@ namespace SparkleLib { /// public delegate void FetchingFinishedEventHandler (object o, SparkleEventArgs args); + /// + /// Raised when when fetching from the remote repository has failed + /// + public delegate void FetchingFailedEventHandler (object o, SparkleEventArgs args); + /// /// Raised when the repository has received one or multiple new remote commits /// @@ -249,6 +254,7 @@ namespace SparkleLib { public event PushingFailedEventHandler PushingFailed; public event FetchingStartedEventHandler FetchingStarted; public event FetchingFinishedEventHandler FetchingFinished; + public event FetchingFailedEventHandler FetchingFailed; public event NewCommitEventHandler NewCommit; public event ConflictDetectedEventHandler ConflictDetected; public event ChangesDetectedEventHandler ChangesDetected; @@ -660,19 +666,27 @@ namespace SparkleLib { _IsSyncing = false; _IsFetching = false; - if (FetchingFinished != null) - FetchingFinished (this, args); - if (_IsPolling) RemoteTimer.Start (); _CurrentHash = GetCurrentHash (); - if (process.ExitCode != 0) + if (process.ExitCode != 0) { + _ServerOnline = false; - else + + if (FetchingFailed != null) + FetchingFailed (this, args); + + } else { + _ServerOnline = true; + if (FetchingFinished != null) + FetchingFinished (this, args); + + } + }; } diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index 66f5627d..986b0980 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -152,6 +152,7 @@ namespace SparkleShare { repo.PushingFinished -= UpdateEventLog; repo.PushingFailed -= UpdateEventLog; repo.FetchingFinished -= UpdateEventLog; + repo.FetchingFailed -= UpdateEventLog; } @@ -198,6 +199,7 @@ namespace SparkleShare { repo.PushingFailed += UpdateEventLog; repo.FetchingFinished += UpdateEventLog; + repo.FetchingFailed += UpdateEventLog; break; diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 8cc2621a..d9990518 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -417,7 +417,7 @@ namespace SparkleShare { if (SparkleUI.Repositories.Count > 0) StateText = _("Up to date") + " (" + FormatFileSize (FolderSize) + ")"; - else + else StateText = _("Welcome to SparkleShare!"); } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 25f1ebf0..050577aa 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -390,6 +390,10 @@ namespace SparkleShare { Application.Invoke (UpdateStatusIcon); }; + repo.FetchingFailed += delegate { + Application.Invoke (UpdateStatusIcon); + }; + repo.ChangesDetected += delegate { Application.Invoke (UpdateStatusIcon); }; @@ -406,7 +410,7 @@ namespace SparkleShare { Application.Invoke (UpdateStatusIcon); }; - repo.PushingFailed += delegate { // TODO: use UpdateStatusIcon and check for HasUnsyncedChanges in SparkleStatusIcon + repo.PushingFailed += delegate { Application.Invoke (UpdateStatusIcon); };