[repo][log] Add an infobar message for when fetching fails

This commit is contained in:
Hylke Bons 2010-10-07 22:31:48 +01:00
parent 70c718c3c7
commit 5d291cdef4
2 changed files with 48 additions and 7 deletions

View file

@ -76,6 +76,7 @@ namespace SparkleLib {
private bool _IsFetching;
private bool _IsPushing;
private bool _HasUnsyncedChanges;
private bool _ServerOnline;
/// <summary>
@ -173,6 +174,18 @@ namespace SparkleLib {
}
}
/// <summary>
/// Indicates whether the remote repository is online,
/// this is based on the result of the Fetch method
/// </summary>
public bool ServerOnline {
get {
return _ServerOnline;
}
}
/// <event cref="Added">
/// Raised when local files have been added to the repository's staging area
/// </event>
@ -270,6 +283,7 @@ namespace SparkleLib {
_IsPolling = true;
_IsFetching = false;
_IsPushing = false;
_ServerOnline = true;
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
".git", "has_unsynced_changes");
@ -654,6 +668,11 @@ namespace SparkleLib {
_CurrentHash = GetCurrentHash ();
if (process.ExitCode != 0)
_ServerOnline = false;
else
_ServerOnline = true;
};
}
@ -805,10 +824,10 @@ namespace SparkleLib {
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
".git", "has_unsynced_changes");
// if (File.Exists (unsynced_file_path))
// File.Delete (unsynced_file_path); TODO: restore
if (File.Exists (unsynced_file_path))
File.Delete (unsynced_file_path);
// _HasUnsyncedChanges = false;TODO
_HasUnsyncedChanges = false;
if (PushingFinished != null)
PushingFinished (this, args);

View file

@ -150,6 +150,8 @@ namespace SparkleShare {
// Remove the eventhooks
repo.NewCommit -= UpdateEventLog;
repo.PushingFinished -= UpdateEventLog;
repo.PushingFailed -= UpdateEventLog;
repo.FetchingFinished -= UpdateEventLog;
}
@ -193,6 +195,9 @@ namespace SparkleShare {
// Update the log when changes are being sent
repo.PushingFinished += UpdateEventLog;
repo.PushingFailed += UpdateEventLog;
repo.FetchingFinished += UpdateEventLog;
break;
@ -232,17 +237,34 @@ namespace SparkleShare {
VBox layout_vertical = new VBox (false, 0);
if ((SparkleUI.Repositories.Find (delegate (SparkleRepo r)
{ return r.LocalPath.Equals (LocalPath); }) as SparkleRepo).HasUnsyncedChanges == true) {
if (SparkleUI.Repositories.Find (
delegate (SparkleRepo r)
{ return r.LocalPath.Equals (LocalPath) && r.HasUnsyncedChanges; }
) != null) {
string title = _("This folder has unsynced changes");
string text = _("We will sync these once connected again");
string text = _("We will sync these once were connected again");
SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);
layout_vertical.PackStart (infobar, false, false, 0);
} else {
if (SparkleUI.Repositories.Find (
delegate (SparkleRepo r)
{ return r.LocalPath.Equals (LocalPath) && r.HasUnsyncedChanges; }
) != null) {
string title = _("Could not sync with the remote folder");
string text = _("Is the you and the server online?");
SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);
layout_vertical.PackStart (infobar, false, false, 0);
}
}
TreeView tree_view = new TreeView ();