From 9e094516bcaa1fb669c3f867605ea3671f9f0d81 Mon Sep 17 00:00:00 2001 From: Philipp Gildein Date: Fri, 11 Jun 2010 19:23:25 +0200 Subject: [PATCH 01/15] Only add actions if the notification system permits it Fixes ugly dialogs in Ubuntu > 9.04. Changing the instructions in the bubbles would help the usability on such systems though. --- SparkleShare/SparkleBubble.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index b7189ad2..5064f261 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -29,6 +29,12 @@ namespace SparkleShare { AttachToStatusIcon (SparkleUI.NotificationIcon); } + new public void AddAction (string action, string label, ActionHandler handler) { + if (System.Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1) { + base.AddAction(action, label, handler); + } + } + } } From 697f135778f8c6ed317134df23f3d865e9dcef92 Mon Sep 17 00:00:00 2001 From: Sandy Armstrong Date: Fri, 11 Jun 2010 07:13:47 -0700 Subject: [PATCH 03/15] Update .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b95070bc..e51b33ff 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ *.exe *.exe.mdb *.userprefs +*.pidb +/SparkleShare/bin +/SparkleShare/obj +/notify-sharp/bin From 3bd3403c2c453a18c8ec3ced710c2baff00e3f28 Mon Sep 17 00:00:00 2001 From: Sandy Armstrong Date: Fri, 11 Jun 2010 10:58:40 -0700 Subject: [PATCH 04/15] Move tmp dir from /tmp/sparkleshare to ~/SparkleShare/.tmp Works around an issue where Directory.Move doesn't work across different partitions. --- SparkleShare/SparklePaths.cs | 7 ++----- SparkleShare/SparkleUI.cs | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SparkleShare/SparklePaths.cs b/SparkleShare/SparklePaths.cs index 500041cf..1c3c59a2 100644 --- a/SparkleShare/SparklePaths.cs +++ b/SparkleShare/SparklePaths.cs @@ -21,17 +21,14 @@ using System.IO; namespace SparkleShare { public static class SparklePaths { - - public static string SparkleTmpPath = - SparkleHelpers.CombineMore (Path.VolumeSeparatorChar.ToString (), - "tmp", "sparkleshare"); - private static UnixUserInfo UnixUserInfo = new UnixUserInfo (UnixEnvironment.UserName); public static string HomePath = UnixUserInfo.HomeDirectory; public static string SparklePath = Path.Combine (HomePath ,"SparkleShare"); + public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp"); + public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare"); diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 93ca7e88..7ce78041 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -80,6 +80,9 @@ namespace SparkleShare { } + if (!Directory.Exists (SparklePaths.SparkleTmpPath)) + Directory.CreateDirectory (SparklePaths.SparkleTmpPath); + if (!HideUI) { // Create the status icon NotificationIcon = new SparkleStatusIcon (); From a88eedf1bcd1a66566c63d0b1393039b788c42bf Mon Sep 17 00:00:00 2001 From: Sandy Armstrong Date: Fri, 11 Jun 2010 10:59:23 -0700 Subject: [PATCH 05/15] Specify git checkout directory name Guarantees that the checkout dir name is what we think. --- SparkleShare/SparkleDialog.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleDialog.cs b/SparkleShare/SparkleDialog.cs index 7b088d77..58e962c3 100644 --- a/SparkleShare/SparkleDialog.cs +++ b/SparkleShare/SparkleDialog.cs @@ -145,8 +145,9 @@ namespace SparkleShare { // Clone into the system's temporary folder Process.StartInfo.FileName = "git"; Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath; - Process.StartInfo.Arguments = "clone "; - Process.StartInfo.Arguments += RepoRemoteUrl; + Process.StartInfo.Arguments = String.Format ("clone {0} {1}", + RepoRemoteUrl, + RepoName); Process.WaitForExit (); Process.Start (); From cb87d142d9945ba5fa451a4e8cba4639b3ba8cb4 Mon Sep 17 00:00:00 2001 From: Sandy Armstrong Date: Fri, 11 Jun 2010 10:59:54 -0700 Subject: [PATCH 06/15] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e51b33ff..e3379ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /SparkleShare/bin /SparkleShare/obj /notify-sharp/bin +/notify-sharp/obj From ea1e82978bd0dcc1b637dbd0b29f436a53b126a2 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 10:03:37 +0100 Subject: [PATCH 07/15] update readme --- README | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README b/README index 43737c2d..e24007a7 100644 --- a/README +++ b/README @@ -3,9 +3,6 @@ SparkleShare Version 0.2 Beta 1 SparkleShare is a file sharing and collaboration tool inspired by Dropbox. -SparkleShare currently only works on Linux/GNOME. -Windows and OSX ports are planned for the future. - SparkleShare isn't just a piece of software, it's part of your workflow. It's designed to make sharing documents and collaboration easier, and to make peers aware of what you are doing. It allows you to instantly sync with any Git @@ -16,6 +13,9 @@ like backing up small files or monitoring your favourite project. In contrast to the projects name, we will very likely refuse to implement your personal ponies. +SparkleShare currently only works on Linux/GNOME. +Windows and OSX ports are planned for the future. + License ======= @@ -77,10 +77,14 @@ A: Because I hate freedom. Info ==== -The official website is: +Official website: http://www.sparkleshare.org/ -Community resources can be found at -http://www.github.com/hbons/SparkleShare +Project page: +http://gitorious.org/sparkleshare + +Wiki: +http://gitorious.org/sparkleshare/pages/Home + Now have fun and create cool things together! :) From 91b5ef7feb8dcf4b97cceb497e41ab906e1b3654 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 10:18:09 +0100 Subject: [PATCH 08/15] remove todo for fixed bug --- SparkleShare/SparkleStatusIcon.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index 82efe8d6..824f7a5d 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -198,9 +198,8 @@ namespace SparkleShare { StateText = _("Error syncing"); } - // TODO: menu should not dissappear on mouse up - public void SetPosition - (Menu menu, out int x, out int y, out bool push_in) { + public void SetPosition (Menu menu, out int x, out int y, + out bool push_in) { PositionMenu (menu, out x, out y, out push_in, Handle); @@ -210,7 +209,7 @@ namespace SparkleShare { public void Quit (object o, EventArgs args) { System.IO.File.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath + - "sparkleshare.pid")); + "sparkleshare.pid")); Application.Quit (); } From 52e975db527d429822e27076bee2657ff320777e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 10:33:20 +0100 Subject: [PATCH 09/15] remove spacs between debuginfo vars --- SparkleShare/SparkleHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SparkleShare/SparkleHelpers.cs b/SparkleShare/SparkleHelpers.cs index 3101ea12..9207f8f0 100644 --- a/SparkleShare/SparkleHelpers.cs +++ b/SparkleShare/SparkleHelpers.cs @@ -110,8 +110,8 @@ namespace SparkleShare { if (ShowDebugInfo) { DateTime DateTime = new DateTime (); string TimeStamp = DateTime.Now.ToString ("HH:mm:ss"); - Console.WriteLine ("[" + TimeStamp + "] " + - "[" + Type + "] " + Message); + Console.WriteLine ("[" + TimeStamp + "]" + + "[" + Type + "]" + Message); } } From 0298fc88ad00ad9797609889ad7eb448f8c9afd4 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 10:42:37 +0100 Subject: [PATCH 10/15] cleanup ugly path concatenations and add some comments --- SparkleShare/SparkleHelpers.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/SparkleShare/SparkleHelpers.cs b/SparkleShare/SparkleHelpers.cs index 9207f8f0..1b01a65e 100644 --- a/SparkleShare/SparkleHelpers.cs +++ b/SparkleShare/SparkleHelpers.cs @@ -28,9 +28,10 @@ namespace SparkleShare { public static bool ShowDebugInfo = true; + // Get's the avatar for a specific email address and size public static Gdk.Pixbuf GetAvatar (string Email, int Size) { - string AvatarPath = Path.Combine (SparklePaths.SparkleAvatarPath, + string AvatarPath = CombineMore (SparklePaths.SparkleAvatarPath, Size + "x" + Size); if (!Directory.Exists (AvatarPath)) { @@ -39,7 +40,7 @@ namespace SparkleShare { "Created '" + AvatarPath + "'"); } - string AvatarFilePath = AvatarPath + Email; + string AvatarFilePath = CombineMore (AvatarPath, Email); if (File.Exists (AvatarFilePath)) return new Gdk.Pixbuf (AvatarFilePath); @@ -49,23 +50,25 @@ namespace SparkleShare { WebClient WebClient = new WebClient (); Uri GravatarUri = new Uri ("http://www.gravatar.com/avatar/" + GetMD5 (Email) + ".jpg?s=" + Size + "&d=404"); - // TODO: Clean paths - string TmpFile = SparklePaths.SparkleTmpPath + Email + Size; + + string TmpFile = + CombineMore (SparklePaths.SparkleTmpPath, Email + Size); if (!File.Exists (TmpFile)) { WebClient.DownloadFileAsync (GravatarUri, TmpFile); WebClient.DownloadFileCompleted += delegate { - File.Delete (AvatarPath + Email); + File.Delete (AvatarFilePath); FileInfo TmpFileInfo = new FileInfo (TmpFile); if (TmpFileInfo.Length > 255) - File.Move (TmpFile, AvatarPath + Email); + File.Move (TmpFile, AvatarFilePath); }; } - if (File.Exists (AvatarPath + Email)) - return new Gdk.Pixbuf (AvatarPath + Email); + // Fall back to a generic icon if there is no gravatar + if (File.Exists (AvatarFilePath)) + return new Gdk.Pixbuf (AvatarFilePath); else return GetIcon ("avatar-default", Size); From 6946b9c27a61d92120bbab99727e254a932c8a78 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 10:45:44 +0100 Subject: [PATCH 11/15] fix some whitespace --- SparkleShare/SparkleHelpers.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleHelpers.cs b/SparkleShare/SparkleHelpers.cs index 1b01a65e..2f84d941 100644 --- a/SparkleShare/SparkleHelpers.cs +++ b/SparkleShare/SparkleHelpers.cs @@ -78,10 +78,11 @@ namespace SparkleShare { // Creates an MD5 hash public static string GetMD5 (string s) { - MD5 md5 = new MD5CryptoServiceProvider (); - Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s); - Byte[] EncodedBytes = md5.ComputeHash (Bytes); - return BitConverter.ToString (EncodedBytes).ToLower ().Replace ("-", ""); + MD5 md5 = new MD5CryptoServiceProvider (); + Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s); + Byte[] EncodedBytes = md5.ComputeHash (Bytes); + return BitConverter.ToString + (EncodedBytes).ToLower ().Replace ("-", ""); } // Makes it possible to combine more than From 487722112423d3c292b83527e33e3e554156e6cc Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 14:12:52 +0100 Subject: [PATCH 12/15] make coding style consistent in sparklebubble --- SparkleShare/SparkleBubble.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index 5064f261..e4fd1798 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -29,10 +29,15 @@ namespace SparkleShare { AttachToStatusIcon (SparkleUI.NotificationIcon); } - new public void AddAction (string action, string label, ActionHandler handler) { - if (System.Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1) { - base.AddAction(action, label, handler); - } + new public void AddAction (string Action, string Label, + ActionHandler Handler) { + + bool CanHaveButtons = + (System.Array.IndexOf (Notifications.Global.Capabilities, + "actions") > -1); + if (CanHaveButtons) + base.AddAction(Action, Label, Handler); + } } From 26d24334b6359ca043ee39e23ae27adf6538a09a Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 14:20:38 +0100 Subject: [PATCH 13/15] fix whitespace --- SparkleShare/SparkleBubble.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index e4fd1798..f2f8c554 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -34,7 +34,7 @@ namespace SparkleShare { bool CanHaveButtons = (System.Array.IndexOf (Notifications.Global.Capabilities, - "actions") > -1); + "actions") > -1); if (CanHaveButtons) base.AddAction(Action, Label, Handler); From 5fbed0cb9d56dd8e189b4fa9a4e4fd16a7752b4b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 14:25:11 +0100 Subject: [PATCH 14/15] add comments --- SparkleShare/SparkleBubble.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index f2f8c554..b1b90dad 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -29,6 +29,8 @@ namespace SparkleShare { AttachToStatusIcon (SparkleUI.NotificationIcon); } + // Checks whether the system allows adding buttons to a notification, + // prevents error messages in Ubuntu. new public void AddAction (string Action, string Label, ActionHandler Handler) { From 219a3a83255c8bd15221d64826927bd4b697b504 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 12 Jun 2010 14:31:33 +0100 Subject: [PATCH 15/15] fix whitespace --- SparkleShare/SparkleBubble.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index b1b90dad..d5a558fa 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -23,10 +23,12 @@ namespace SparkleShare { public class SparkleBubble : Notification { public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) { - Timeout = 4500; - Urgency = Urgency.Low; - IconName = "folder-sparkleshare"; - AttachToStatusIcon (SparkleUI.NotificationIcon); + + Timeout = 4500; + Urgency = Urgency.Low; + IconName = "folder-sparkleshare"; + AttachToStatusIcon (SparkleUI.NotificationIcon); + } // Checks whether the system allows adding buttons to a notification,