summaryrefslogtreecommitdiff
path: root/SparkleShare/SparkleBubblesController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SparkleShare/SparkleBubblesController.cs')
-rwxr-xr-xSparkleShare/SparkleBubblesController.cs49
1 files changed, 18 insertions, 31 deletions
diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs
index e000086..2b682d2 100755
--- a/SparkleShare/SparkleBubblesController.cs
+++ b/SparkleShare/SparkleBubblesController.cs
@@ -33,15 +33,16 @@ namespace SparkleShare {
};
Program.Controller.NotificationRaised += delegate (SparkleChangeSet change_set) {
- ShowBubble (change_set.User.Name, FormatMessage (change_set),
- Program.Controller.GetAvatar (change_set.User.Email, 36));
+ if (Program.Controller.NotificationsEnabled)
+ ShowBubble (change_set.User.Name, FormatMessage (change_set),
+ Program.Controller.GetAvatar (change_set.User.Email, 48));
};
}
public void ShowBubble (string title, string subtext, string image_path)
{
- if (ShowBubbleEvent != null && Program.Controller.NotificationsEnabled)
+ if (ShowBubbleEvent != null)
ShowBubbleEvent (title, subtext, image_path);
}
@@ -54,40 +55,26 @@ namespace SparkleShare {
private string FormatMessage (SparkleChangeSet change_set)
{
- string file_name = "";
- string message = "";
+ string message = "";
- if (change_set.Added.Count > 0) {
- file_name = change_set.Added [0];
- message = String.Format ("added ‘{0}’", file_name);
- }
+ if (change_set.Changes [0].Type == SparkleChangeType.Deleted)
+ message = string.Format ("moved ‘{0}’", change_set.Changes [0].Path);
- if (change_set.MovedFrom.Count > 0) {
- file_name = change_set.MovedFrom [0];
- message = String.Format ("moved ‘{0}’", file_name);
- }
+ if (change_set.Changes [0].Type == SparkleChangeType.Moved)
+ message = string.Format ("moved ‘{0}’", change_set.Changes [0].Path);
- if (change_set.Edited.Count > 0) {
- file_name = change_set.Edited [0];
- message = String.Format ("edited ‘{0}’", file_name);
- }
-
- if (change_set.Deleted.Count > 0) {
- file_name = change_set.Deleted [0];
- message = String.Format ("deleted ‘{0}’", file_name);
- }
+ if (change_set.Changes [0].Type == SparkleChangeType.Added)
+ message = string.Format ("added ‘{0}’", change_set.Changes [0].Path);
- int changes_count = (change_set.Added.Count +
- change_set.Edited.Count +
- change_set.Deleted.Count +
- change_set.MovedFrom.Count) - 1;
+ if (change_set.Changes [0].Type == SparkleChangeType.Edited)
+ message = string.Format ("moved ‘{0}’", change_set.Changes [0].Path);
- if (changes_count > 0) {
- string msg = string.Format ("and {0} more", changes_count);
- message += " " + String.Format (msg, changes_count);
+ if (change_set.Changes.Count > 0) {
+ string msg = string.Format ("and {0} more", change_set.Changes.Count);
+ message = message + " " + string.Format (msg, change_set.Changes.Count);
- } else if (changes_count < 0) {
- message += "did something magical";
+ } else {
+ message = "did something magical";
}
return message;