[repo][log] Add an infobar message for when fetching fails
This commit is contained in:
parent
70c718c3c7
commit
5d291cdef4
|
@ -76,6 +76,7 @@ namespace SparkleLib {
|
||||||
private bool _IsFetching;
|
private bool _IsFetching;
|
||||||
private bool _IsPushing;
|
private bool _IsPushing;
|
||||||
private bool _HasUnsyncedChanges;
|
private bool _HasUnsyncedChanges;
|
||||||
|
private bool _ServerOnline;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <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">
|
/// <event cref="Added">
|
||||||
/// Raised when local files have been added to the repository's staging area
|
/// Raised when local files have been added to the repository's staging area
|
||||||
/// </event>
|
/// </event>
|
||||||
|
@ -270,6 +283,7 @@ namespace SparkleLib {
|
||||||
_IsPolling = true;
|
_IsPolling = true;
|
||||||
_IsFetching = false;
|
_IsFetching = false;
|
||||||
_IsPushing = false;
|
_IsPushing = false;
|
||||||
|
_ServerOnline = true;
|
||||||
|
|
||||||
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
||||||
".git", "has_unsynced_changes");
|
".git", "has_unsynced_changes");
|
||||||
|
@ -654,6 +668,11 @@ namespace SparkleLib {
|
||||||
|
|
||||||
_CurrentHash = GetCurrentHash ();
|
_CurrentHash = GetCurrentHash ();
|
||||||
|
|
||||||
|
if (process.ExitCode != 0)
|
||||||
|
_ServerOnline = false;
|
||||||
|
else
|
||||||
|
_ServerOnline = true;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -805,10 +824,10 @@ namespace SparkleLib {
|
||||||
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath ,
|
||||||
".git", "has_unsynced_changes");
|
".git", "has_unsynced_changes");
|
||||||
|
|
||||||
// if (File.Exists (unsynced_file_path))
|
if (File.Exists (unsynced_file_path))
|
||||||
// File.Delete (unsynced_file_path); TODO: restore
|
File.Delete (unsynced_file_path);
|
||||||
|
|
||||||
// _HasUnsyncedChanges = false;TODO
|
_HasUnsyncedChanges = false;
|
||||||
|
|
||||||
if (PushingFinished != null)
|
if (PushingFinished != null)
|
||||||
PushingFinished (this, args);
|
PushingFinished (this, args);
|
||||||
|
|
|
@ -150,6 +150,8 @@ namespace SparkleShare {
|
||||||
// Remove the eventhooks
|
// Remove the eventhooks
|
||||||
repo.NewCommit -= UpdateEventLog;
|
repo.NewCommit -= UpdateEventLog;
|
||||||
repo.PushingFinished -= UpdateEventLog;
|
repo.PushingFinished -= UpdateEventLog;
|
||||||
|
repo.PushingFailed -= UpdateEventLog;
|
||||||
|
repo.FetchingFinished -= UpdateEventLog;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +195,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Update the log when changes are being sent
|
// Update the log when changes are being sent
|
||||||
repo.PushingFinished += UpdateEventLog;
|
repo.PushingFinished += UpdateEventLog;
|
||||||
|
repo.PushingFailed += UpdateEventLog;
|
||||||
|
|
||||||
|
repo.FetchingFinished += UpdateEventLog;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -232,17 +237,34 @@ namespace SparkleShare {
|
||||||
|
|
||||||
VBox layout_vertical = new VBox (false, 0);
|
VBox layout_vertical = new VBox (false, 0);
|
||||||
|
|
||||||
|
if (SparkleUI.Repositories.Find (
|
||||||
if ((SparkleUI.Repositories.Find (delegate (SparkleRepo r)
|
delegate (SparkleRepo r)
|
||||||
{ return r.LocalPath.Equals (LocalPath); }) as SparkleRepo).HasUnsyncedChanges == true) {
|
{ return r.LocalPath.Equals (LocalPath) && r.HasUnsyncedChanges; }
|
||||||
|
) != null) {
|
||||||
|
|
||||||
string title = _("This folder has unsynced changes");
|
string title = _("This folder has unsynced changes");
|
||||||
string text = _("We will sync these once connected again");
|
string text = _("We will sync these once we’re connected again");
|
||||||
|
|
||||||
SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);
|
SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text);
|
||||||
|
|
||||||
layout_vertical.PackStart (infobar, false, false, 0);
|
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 ();
|
TreeView tree_view = new TreeView ();
|
||||||
|
|
Loading…
Reference in a new issue