diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs
index 27bab4e0..54b44dc7 100644
--- a/SparkleLib/SparkleRepo.cs
+++ b/SparkleLib/SparkleRepo.cs
@@ -1046,38 +1046,30 @@ namespace SparkleLib {
int.Parse (match.Groups [9].Value));
string [] entry_lines = log_entry.Split ("\n".ToCharArray ());
-
- if (entry_lines.Length > 60) {
-
- commit.IsFileDump = true;
-
- } else {
-
- foreach (string entry_line in entry_lines) {
-
- if (entry_line.StartsWith (":")) {
-
- string change_type = entry_line [37].ToString ();
- string file_path = entry_line.Substring (39);
+
+ foreach (string entry_line in entry_lines) {
+
+ if (entry_line.StartsWith (":")) {
+
+ string change_type = entry_line [37].ToString ();
+ string file_path = entry_line.Substring (39);
+
+ if (change_type.Equals ("A")) {
- if (change_type.Equals ("A")) {
-
- commit.Added.Add (file_path);
-
- } else if (change_type.Equals ("M")) {
+ commit.Added.Add (file_path);
- commit.Edited.Add (file_path);
-
- } else if (change_type.Equals ("D")) {
-
- commit.Deleted.Add (file_path);
-
- }
+ } else if (change_type.Equals ("M")) {
+
+ commit.Edited.Add (file_path);
+
+ } else if (change_type.Equals ("D")) {
+
+ commit.Deleted.Add (file_path);
}
-
+
}
-
+
}
commits.Add (commit);
diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs
index 742c3e34..4d96f3db 100644
--- a/SparkleShare/SparkleController.cs
+++ b/SparkleShare/SparkleController.cs
@@ -74,7 +74,8 @@ namespace SparkleShare {
public delegate void ConflictNotificationRaisedEventHandler ();
public event NotificationRaisedEventHandler NotificationRaised;
- public delegate void NotificationRaisedEventHandler (SparkleCommit commit, string repository_path);
+ public delegate void NotificationRaisedEventHandler (string user_name, string user_email,
+ string message, string repository_path);
// Short alias for the translations
@@ -301,10 +302,6 @@ namespace SparkleShare {
if (change_set.IsMerge) {
event_entry += "
Merged a branch";
-
- } else if (change_set.IsFileDump) {
-
- event_entry += "Dumped a lot of files";
} else {
@@ -535,8 +532,10 @@ namespace SparkleShare {
repo.NewCommit += delegate (SparkleCommit commit, string repository_path) {
+ string message = FormatMessage (commit);
+
if (NotificationRaised != null)
- NotificationRaised (commit, repository_path);
+ NotificationRaised (commit.UserName, commit.UserEmail, message, repository_path);
};
@@ -680,6 +679,57 @@ namespace SparkleShare {
}
+ private string FormatMessage (SparkleCommit commit)
+ {
+
+ string file_name = "";
+ string message = null;
+
+ if (commit.Added.Count > 0) {
+
+ foreach (string added in commit.Added) {
+ file_name = added;
+ break;
+ }
+
+ message = String.Format (_("added ‘{0}’"), file_name);
+
+ }
+
+ if (commit.Edited.Count > 0) {
+
+ foreach (string modified in commit.Edited) {
+ file_name = modified;
+ break;
+ }
+
+ message = String.Format (_("edited ‘{0}’"), file_name);
+
+ }
+
+ if (commit.Deleted.Count > 0) {
+
+ foreach (string removed in commit.Deleted) {
+ file_name = removed;
+ break;
+ }
+
+ message = String.Format (_("deleted ‘{0}’"), file_name);
+
+ }
+
+ int changes_count = (commit.Added.Count +
+ commit.Edited.Count +
+ commit.Deleted.Count) - 1;
+
+ if (changes_count > 0)
+ message += "" + String.Format ("and {0} more", changes_count);
+
+ return message;
+
+ }
+
+
// Recursively gets a folder's size in bytes
private double CalculateFolderSize (DirectoryInfo parent)
{
diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs
index 15bbda6a..838e2804 100644
--- a/SparkleShare/SparkleIntro.cs
+++ b/SparkleShare/SparkleIntro.cs
@@ -354,10 +354,7 @@ namespace SparkleShare {
string canonical_name = System.IO.Path.GetFileNameWithoutExtension (name);
-
- Deletable = false;
ShowSyncingPage (canonical_name);
-
SparkleShare.Controller.FolderFetched += delegate {
@@ -614,6 +611,8 @@ namespace SparkleShare {
Reset ();
+ Deletable = false;
+
VBox layout_vertical = new VBox (false, 0);
Label header = new Label ("" +
diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs
index e0790b8c..683ec123 100644
--- a/SparkleShare/SparkleLog.cs
+++ b/SparkleShare/SparkleLog.cs
@@ -157,7 +157,7 @@ namespace SparkleShare {
public void UpdateEventLog ()
{
- if (HTML == null) {
+ if (HTML == null) { // TODO: there may be a race condition here
LayoutVertical.Remove (ScrolledWindow);
Spinner = new SparkleSpinner (22);
@@ -203,10 +203,11 @@ namespace SparkleShare {
Application.Invoke (delegate {
- if (Spinner.Active) {
+ Spinner.Stop ();
+
+ if (Spinner.Parent == LayoutVertical) {
LayoutVertical.Remove (Spinner);
- Spinner.Stop ();
} else {
@@ -227,7 +228,7 @@ namespace SparkleShare {
WebView.LoadString (HTML, null, null, "file://");
- LayoutVertical.ShowAll ();
+ ShowAll ();
});
diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs
index d46efbce..61e18da6 100644
--- a/SparkleShare/SparkleUI.cs
+++ b/SparkleShare/SparkleUI.cs
@@ -79,7 +79,8 @@ namespace SparkleShare {
};
// Show a bubble when there are new changes
- SparkleShare.Controller.NotificationRaised += delegate (SparkleCommit commit, string repository_path) {
+ SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
+ string message, string repository_path) {
foreach (SparkleLog log in OpenLogs) {
if (log.LocalPath.Equals (repository_path)) {
@@ -94,55 +95,11 @@ namespace SparkleShare {
if (!SparkleShare.Controller.NotificationsEnabled)
return;
- string file_name = "";
- string message = null;
-
- if (commit.Added.Count > 0) {
-
- foreach (string added in commit.Added) {
- file_name = added;
- break;
- }
-
- message = String.Format (_("added ‘{0}’"), file_name);
-
- }
-
- if (commit.Edited.Count > 0) {
-
- foreach (string modified in commit.Edited) {
- file_name = modified;
- break;
- }
-
- message = String.Format (_("edited ‘{0}’"), file_name);
-
- }
-
- if (commit.Deleted.Count > 0) {
-
- foreach (string removed in commit.Deleted) {
- file_name = removed;
- break;
- }
-
- message = String.Format (_("deleted ‘{0}’"), file_name);
-
- }
-
- int changes_count = (commit.Added.Count +
- commit.Edited.Count +
- commit.Deleted.Count);
-
- if (changes_count > 1)
- message += " + " + (changes_count - 1);
-
-
Application.Invoke (delegate {
- SparkleBubble bubble = new SparkleBubble (commit.UserName, message);
+ SparkleBubble bubble = new SparkleBubble (user_name, message);
- string avatar_file_path = SparkleUIHelpers.GetAvatar (commit.UserEmail, 32);
+ string avatar_file_path = SparkleUIHelpers.GetAvatar (user_email, 32);
if (avatar_file_path != null)
bubble.Icon = new Gdk.Pixbuf (avatar_file_path);