Add notifications for new notes
This commit is contained in:
parent
47f9439dfa
commit
68a90b1948
|
@ -67,9 +67,12 @@ namespace SparkleLib {
|
||||||
public delegate void SyncStatusChangedEventHandler (SyncStatus new_status);
|
public delegate void SyncStatusChangedEventHandler (SyncStatus new_status);
|
||||||
public event SyncStatusChangedEventHandler SyncStatusChanged;
|
public event SyncStatusChangedEventHandler SyncStatusChanged;
|
||||||
|
|
||||||
public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set, string source_path);
|
public delegate void NewChangeSetEventHandler (SparkleChangeSet change_set);
|
||||||
public event NewChangeSetEventHandler NewChangeSet;
|
public event NewChangeSetEventHandler NewChangeSet;
|
||||||
|
|
||||||
|
public delegate void NewNoteEventHandler (string user_name, string user_email);
|
||||||
|
public event NewNoteEventHandler NewNote;
|
||||||
|
|
||||||
public delegate void ConflictResolvedEventHandler ();
|
public delegate void ConflictResolvedEventHandler ();
|
||||||
public event ConflictResolvedEventHandler ConflictResolved;
|
public event ConflictResolvedEventHandler ConflictResolved;
|
||||||
|
|
||||||
|
@ -441,8 +444,23 @@ namespace SparkleLib {
|
||||||
if (SyncStatusChanged != null)
|
if (SyncStatusChanged != null)
|
||||||
SyncStatusChanged (SyncStatus.Idle);
|
SyncStatusChanged (SyncStatus.Idle);
|
||||||
|
|
||||||
|
SparkleChangeSet change_set = GetChangeSets (1) [0];
|
||||||
|
|
||||||
|
bool note_added = false;
|
||||||
|
foreach (string added in change_set.Added) {
|
||||||
|
if (added.StartsWith (".notes")) {
|
||||||
|
if (NewNote != null)
|
||||||
|
NewNote (change_set.UserName, change_set.UserEmail);
|
||||||
|
|
||||||
|
note_added = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!note_added) {
|
||||||
if (NewChangeSet != null)
|
if (NewChangeSet != null)
|
||||||
NewChangeSet (GetChangeSets (1) [0], LocalPath);
|
NewChangeSet (change_set);
|
||||||
|
}
|
||||||
|
|
||||||
// There could be changes from a
|
// There could be changes from a
|
||||||
// resolved conflict. Tries only once,
|
// resolved conflict. Tries only once,
|
||||||
|
|
|
@ -594,11 +594,17 @@ namespace SparkleShare {
|
||||||
else
|
else
|
||||||
repo = new SparkleRepoGit (folder_path, SparkleBackend.DefaultBackend);
|
repo = new SparkleRepoGit (folder_path, SparkleBackend.DefaultBackend);
|
||||||
|
|
||||||
repo.NewChangeSet += delegate (SparkleChangeSet change_set, string repository_path) {
|
repo.NewChangeSet += delegate (SparkleChangeSet change_set) {
|
||||||
string message = FormatMessage (change_set);
|
string message = FormatMessage (change_set);
|
||||||
|
|
||||||
if (NotificationRaised != null)
|
if (NotificationRaised != null)
|
||||||
NotificationRaised (change_set.UserName, change_set.UserEmail, message, repository_path);
|
NotificationRaised (change_set.UserName, change_set.UserEmail, message, repo.LocalPath);
|
||||||
|
};
|
||||||
|
|
||||||
|
repo.NewNote += delegate (string user_name, string user_email) {
|
||||||
|
if (NotificationRaised != null)
|
||||||
|
NotificationRaised (user_name, user_email,
|
||||||
|
"added a note to " + Path.GetFileName (repo.LocalPath), repo.LocalPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
repo.ConflictResolved += delegate {
|
repo.ConflictResolved += delegate {
|
||||||
|
|
Loading…
Reference in a new issue