diff --git a/NEWS b/NEWS index 3adfa0d2..c74384cb 100755 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +0.8.0 for Linux and Mac (Sat Jan 14): + + Hylke: + - Show syncing progress in the status icon + - Hide dock icon on Mac until you open a window + - Update dates in the event log after midnight + - Don't let git compress already compressed files (.jpg .ogg .zip, etc.) + + 0.6.0 for Linux and Mac (Sun Dec 25 2011): Hylke: diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index f542e8b2..9c42a9ce 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -31,53 +31,54 @@ namespace SparkleLib { public SparkleFetcherGit (string server, string remote_folder, string target_folder) : base (server, remote_folder, target_folder) { - remote_folder = remote_folder.Trim ("/".ToCharArray ()); + if (server.EndsWith ("/")) + server = server.Substring (0, server.Length - 1); - if (server.StartsWith ("http")) { - base.target_folder = target_folder; - base.remote_url = server; - return; + if (!remote_folder.StartsWith ("/")) + remote_folder = "/" + remote_folder; + + + Uri uri; + + try { + uri = new Uri (server + remote_folder); + + } catch (UriFormatException) { + uri = new Uri ("ssh://" + server + remote_folder); } - // Gitorious formatting - if (server.Contains ("gitorious.org")) { - server = "ssh://git@gitorious.org"; - if (!remote_folder.EndsWith (".git")) { + if (!uri.Scheme.Equals ("ssh") && + !uri.Scheme.Equals ("git")) { - if (!remote_folder.Contains ("/")) - remote_folder = remote_folder + "/" + remote_folder; + uri = new Uri ("ssh://" + server); + } - remote_folder += ".git"; + + if (uri.Host.Equals ("gitorious.org")) { + if (!uri.AbsolutePath.Equals ("/") && + !uri.AbsolutePath.EndsWith (".git")) { + + uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath + ".git"); + + } else { + uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath); } - } else if (server.Contains ("github.com")) { - server = "ssh://git@github.com"; + } else if (uri.Host.Equals ("github.com")) { + uri = new Uri ("ssh://git@github.com" + uri.AbsolutePath); - } else if (server.Contains ("gnome.org")) { - server = "ssh://git@gnome.org/git"; + } else if (uri.Host.Equals ("gnome.org")) { + uri = new Uri ("ssh://git@gnome.org/git" + uri.AbsolutePath); } else { - server = server.TrimEnd ("/".ToCharArray ()); - - string protocol = "ssh://"; - - if (server.StartsWith ("ssh://")) - server = server.Substring (6); - - if (server.StartsWith ("git://")) { - server = server.Substring (6); - protocol = "git://"; - } - - if (!server.Contains ("@")) - server = "git@" + server; - - server = protocol + server; + if (string.IsNullOrEmpty (uri.UserInfo)) + uri = new Uri (uri.Scheme + "://git@" + uri.Host + uri.AbsolutePath); } + base.target_folder = target_folder; - base.remote_url = server + "/" + remote_folder; + base.remote_url = uri.ToString (); } @@ -208,9 +209,10 @@ namespace SparkleLib { // Add a .gitignore file to the repo private void InstallExcludeRules () { - DirectoryInfo info = Directory.CreateDirectory (SparkleHelpers.CombineMore ( - this.target_folder, ".git", "info")); + DirectoryInfo info = Directory.CreateDirectory ( + SparkleHelpers.CombineMore (this.target_folder, ".git", "info")); + // File that lists the files we want git to ignore string exlude_rules_file_path = Path.Combine (info.FullName, "exclude"); TextWriter writer = new StreamWriter (exlude_rules_file_path); @@ -230,14 +232,14 @@ namespace SparkleLib { // KDE writer.WriteLine (".directory"); - // Mac OSX + // Mac OS X writer.WriteLine (".DS_Store"); writer.WriteLine ("Icon?"); writer.WriteLine ("._*"); writer.WriteLine (".Spotlight-V100"); writer.WriteLine (".Trashes"); - // Mac OSX + // Omnigraffle writer.WriteLine ("*(Autosaved).graffle"); // Windows @@ -250,16 +252,16 @@ namespace SparkleLib { writer.WriteLine ("*~*.tmp"); writer.WriteLine ("*~*.TMP"); writer.WriteLine ("~*.ppt"); - writer.WriteLine ("~*.pptx"); writer.WriteLine ("~*.PPT"); + writer.WriteLine ("~*.pptx"); writer.WriteLine ("~*.PPTX"); writer.WriteLine ("~*.xls"); - writer.WriteLine ("~*.xlsx"); writer.WriteLine ("~*.XLS"); + writer.WriteLine ("~*.xlsx"); writer.WriteLine ("~*.XLSX"); writer.WriteLine ("~*.doc"); - writer.WriteLine ("~*.docx"); writer.WriteLine ("~*.DOC"); + writer.WriteLine ("~*.docx"); writer.WriteLine ("~*.DOCX"); // CVS @@ -272,6 +274,101 @@ namespace SparkleLib { writer.WriteLine ("*/.svn/*"); writer.Close (); + + + // File that lists the files we want don't want git to compress. + // Not compressing the already compressed files saves us memory + // usage and increases speed + string no_compression_rules_file_path = Path.Combine (info.FullName, "attributes"); + writer = new StreamWriter (no_compression_rules_file_path); + + // Images + writer.WriteLine ("*.jpg -delta"); + writer.WriteLine ("*.jpeg -delta"); + writer.WriteLine ("*.JPG -delta"); + writer.WriteLine ("*.JPEG -delta"); + + writer.WriteLine ("*.png -delta"); + writer.WriteLine ("*.PNG -delta"); + + writer.WriteLine ("*.tiff -delta"); + writer.WriteLine ("*.TIFF -delta"); + + // Audio + writer.WriteLine ("*.flac -delta"); + writer.WriteLine ("*.FLAC -delta"); + + writer.WriteLine ("*.mp3 -delta"); + writer.WriteLine ("*.MP3 -delta"); + + writer.WriteLine ("*.ogg -delta"); + writer.WriteLine ("*.OGG -delta"); + + writer.WriteLine ("*.oga -delta"); + writer.WriteLine ("*.OGA -delta"); + + // Video + writer.WriteLine ("*.avi -delta"); + writer.WriteLine ("*.AVI -delta"); + + writer.WriteLine ("*.mov -delta"); + writer.WriteLine ("*.MOV -delta"); + + writer.WriteLine ("*.mpg -delta"); + writer.WriteLine ("*.MPG -delta"); + writer.WriteLine ("*.mpeg -delta"); + writer.WriteLine ("*.MPEG -delta"); + + writer.WriteLine ("*.mkv -delta"); + writer.WriteLine ("*.MKV -delta"); + + writer.WriteLine ("*.ogv -delta"); + writer.WriteLine ("*.OGV -delta"); + + writer.WriteLine ("*.ogx -delta"); + writer.WriteLine ("*.OGX -delta"); + + writer.WriteLine ("*.webm -delta"); + writer.WriteLine ("*.WEBM -delta"); + + // Archives + writer.WriteLine ("*.zip -delta"); + writer.WriteLine ("*.ZIP -delta"); + + writer.WriteLine ("*.gz -delta"); + writer.WriteLine ("*.GZ -delta"); + + writer.WriteLine ("*.bz -delta"); + writer.WriteLine ("*.BZ -delta"); + + writer.WriteLine ("*.bz2 -delta"); + writer.WriteLine ("*.BZ2 -delta"); + + writer.WriteLine ("*.rpm -delta"); + writer.WriteLine ("*.RPM -delta"); + + writer.WriteLine ("*.deb -delta"); + writer.WriteLine ("*.DEB -delta"); + + writer.WriteLine ("*.tgz -delta"); + writer.WriteLine ("*.TGZ -delta"); + + writer.WriteLine ("*.rar -delta"); + writer.WriteLine ("*.RAR -delta"); + + writer.WriteLine ("*.ace -delta"); + writer.WriteLine ("*.ACE -delta"); + + writer.WriteLine ("*.7z -delta"); + writer.WriteLine ("*.7Z -delta"); + + writer.WriteLine ("*.pak -delta"); + writer.WriteLine ("*.PAK -delta"); + + writer.WriteLine ("*.tar -delta"); + writer.WriteLine ("*.TAR -delta"); + + writer.Close (); } } diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 9fa4adbd..6c1127b3 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -441,6 +441,7 @@ namespace SparkleLib { // DU unmerged, deleted by us -> Use theirs // AA unmerged, both added -> Use theirs, save ours as a timestamped copy // UU unmerged, both modified -> Use theirs, save ours as a timestamped copy + // ?? unmerged, new files -> Stage the new files // // Note that a rebase merge works by replaying each commit from the working branch on // top of the upstream branch. Because of this, when a merge conflict happens the @@ -525,6 +526,16 @@ namespace SparkleLib { git_rebase_skip.Start (); git_rebase_skip.WaitForExit (); } + + // New local files + if (line.StartsWith ("??")) { + + Add (); + + SparkleGit git_rebase_continue = new SparkleGit (LocalPath, "rebase --continue"); + git_rebase_continue.Start (); + git_rebase_continue.WaitForExit (); + } } } diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index df43b97d..1c927fe3 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -29,16 +29,23 @@ namespace SparkleLib { Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare"); + public bool DebugMode = true; + public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml"); public string FullPath; + public string LogFilePath; + public string TmpPath; + public string HomePath { get { - return Environment.GetFolderPath (Environment.SpecialFolder.Personal); - } + if (GetConfigOption ("home_path") != null) + return GetConfigOption ("home_path"); + else + return Environment.GetFolderPath (Environment.SpecialFolder.Personal); + } } - public string FoldersPath { get { if (GetConfigOption ("folders_path") != null) @@ -48,16 +55,19 @@ namespace SparkleLib { } } - public string TmpPath { - get { - return Path.Combine (FoldersPath, ".tmp"); - } - } - - public SparkleConfig (string config_path, string config_file_name) { - FullPath = System.IO.Path.Combine (config_path, config_file_name); + FullPath = Path.Combine (config_path, config_file_name); + LogFilePath = Path.Combine (config_path, "debug.log"); + + if (File.Exists (LogFilePath)) { + try { + File.Delete (LogFilePath); + + } catch (Exception) { + // Don't delete the debug.log if 'tail' is reading it + } + } if (!Directory.Exists (config_path)) { Directory.CreateDirectory (config_path); @@ -93,6 +103,7 @@ namespace SparkleLib { } finally { Load (FullPath); + TmpPath = Path.Combine (FoldersPath, ".tmp"); } } @@ -153,11 +164,11 @@ namespace SparkleLib { this.Save (); - ConfigureSSH (); + // ConfigureSSH (); } } - +/* private void ConfigureSSH () { if (User.Email.Equals ("Unknown")) @@ -209,7 +220,7 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Config", "Added key to " + ssh_config_file_path); } - +*/ public List Folders { get { diff --git a/SparkleLib/SparkleHelpers.cs b/SparkleLib/SparkleHelpers.cs index 0cc856d1..8a94ec85 100755 --- a/SparkleLib/SparkleHelpers.cs +++ b/SparkleLib/SparkleHelpers.cs @@ -23,7 +23,7 @@ namespace SparkleLib { public static class SparkleHelpers { public static bool ShowDebugInfo = true; - + private static object debug_lock = new object (); // Show debug info if needed public static void DebugInfo (string type, string message) @@ -34,8 +34,17 @@ namespace SparkleLib { if (!message.StartsWith ("[")) message = " " + message; - // TODO: Write to a log - Console.WriteLine (timestamp + " " + "[" + type + "]" + message); + string line = timestamp + " " + "[" + type + "]" + message; + + if (SparkleConfig.DefaultConfig.DebugMode) + Console.WriteLine (line); + + lock (debug_lock) { + File.AppendAllText ( + SparkleConfig.DefaultConfig.LogFilePath, + line + Environment.NewLine + ); + } } } diff --git a/SparkleLib/SparkleRepoBase.cs b/SparkleLib/SparkleRepoBase.cs index 05fad586..0ecb7075 100755 --- a/SparkleLib/SparkleRepoBase.cs +++ b/SparkleLib/SparkleRepoBase.cs @@ -578,7 +578,20 @@ namespace SparkleLib { { string file_path = Path.Combine (LocalPath, "SparkleShare.txt"); TextWriter writer = new StreamWriter (file_path); - writer.WriteLine (":)"); + writer.WriteLine ("Congratulations, you've successfully created a SparkleShare repository!"); + writer.WriteLine (""); + writer.WriteLine ("Any files you add or change in this folder will be automatically synced to "); + writer.WriteLine (SparkleConfig.DefaultConfig.GetUrlForFolder (Name) + " and everyone connected to it."); + // TODO: Url property? ^ + + writer.WriteLine (""); + writer.WriteLine ("SparkleShare is a Free and Open Source software program that helps people "); + writer.WriteLine ("collaborate and share files. If you like what we do, please consider a small "); + writer.WriteLine ("donation to support the project: http://sparkleshare.org/support-us/"); + writer.WriteLine (""); + writer.WriteLine ("Have fun! :)"); + writer.WriteLine (""); + writer.Close (); } diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index 3b4f0e4b..78f24a15 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -161,13 +161,13 @@ namespace SparkleShare { get { string resource_path = NSBundle.MainBundle.ResourcePath; string html_path = Path.Combine (resource_path, "HTML", "event-log.html"); - - StreamReader reader = new StreamReader (html_path); - string html = reader.ReadToEnd (); - reader.Close (); + string html = File.ReadAllText (html_path); - html = html.Replace ("", "file://" + - Path.Combine (NSBundle.MainBundle.ResourcePath, "HTML", "jquery.js")); + string jquery_file_path = Path.Combine (NSBundle.MainBundle.ResourcePath, + "HTML", "jquery.js"); + + string jquery = File.ReadAllText (jquery_file_path); + html = html.Replace ("", jquery); return html; } diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index f7b1d6f1..af1d84e8 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -11,7 +11,7 @@ SparkleShare SparkleShare v4.0 - 0.6.0 + 0.8.0 true diff --git a/SparkleShare/Mac/SparkleShare.sln b/SparkleShare/Mac/SparkleShare.sln index d22cce42..6de6c1e6 100644 --- a/SparkleShare/Mac/SparkleShare.sln +++ b/SparkleShare/Mac/SparkleShare.sln @@ -16,6 +16,6 @@ Global EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = SparkleShare.csproj - version = 0.6.0 + version = 0.8.0 EndGlobalSection EndGlobal diff --git a/SparkleShare/Mac/SparkleUI.cs b/SparkleShare/Mac/SparkleUI.cs index 642cd6f3..ab4163d7 100755 --- a/SparkleShare/Mac/SparkleUI.cs +++ b/SparkleShare/Mac/SparkleUI.cs @@ -94,13 +94,13 @@ namespace SparkleShare { public void UpdateDockIconVisibility () { - if (true) { // TODO: check for open windows + // if (true) { // TODO: check for open windows ShowDockIcon (); - } else { - HideDockIcon (); - } + // } else { + // HideDockIcon (); + // } } diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 647e6bec..e4736425 100755 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -175,13 +175,16 @@ namespace SparkleShare { public override string EventLogHTML { get { - string path = new string [] {Defines.PREFIX, - "share", "sparkleshare", "html", "event-log.html"}.Combine (); + string html_path = new string [] {Defines.PREFIX, "share", + "sparkleshare", "html", "event-log.html"}.Combine (); - string html = String.Join (Environment.NewLine, File.ReadAllLines (path)); + string html = File.ReadAllText (html_path); - html = html.Replace ("", "file://" + - new string [] {Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"}.Combine ()); + string jquery_file_path = new string [] {Defines.PREFIX, "share", + "sparkleshare", "html", "jquery.js"}.Combine () + + string jquery = File.ReadAllText (jquery_file_path); + html = html.Replace ("", jquery); return html; } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 7162c52b..e1bcfc1a 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -469,13 +469,17 @@ namespace SparkleShare { today.Month == activity_day.DateTime.Month && today.Year == activity_day.DateTime.Year) { - day_entry = day_entry_html.Replace ("", "Today"); + day_entry = day_entry_html.Replace ("", + "" + + _("Today") + ""); } else if (yesterday.Day == activity_day.DateTime.Day && yesterday.Month == activity_day.DateTime.Month && yesterday.Year == activity_day.DateTime.Year) { - day_entry = day_entry_html.Replace ("", "Yesterday"); + day_entry = day_entry_html.Replace ("", + "" + + _("Yesterday") + ""); } else { if (activity_day.DateTime.Year != DateTime.Now.Year) { @@ -495,9 +499,13 @@ namespace SparkleShare { event_log += day_entry.Replace ("", event_entries); } - string html = event_log_html.Replace ("", event_log) + + int midnight = (int) (DateTime.Today.AddDays (1) - new DateTime (1970, 1, 1)).TotalSeconds; + + string html = event_log_html.Replace ("", event_log) .Replace ("", UserName) - .Replace ("", "file://" + GetAvatar (UserEmail, 48)); + .Replace ("", "file://" + GetAvatar (UserEmail, 48)) + .Replace ("", midnight.ToString ()); return html; } diff --git a/SparkleShare/SparkleEventLog.cs b/SparkleShare/SparkleEventLog.cs index ed28ba79..72eb817e 100755 --- a/SparkleShare/SparkleEventLog.cs +++ b/SparkleShare/SparkleEventLog.cs @@ -225,7 +225,7 @@ namespace SparkleShare { Application.Invoke (delegate { this.spinner.Stop (); - this.web_view.LoadString (html, null, null, "file://"); + this.web_view.LoadString (html, null, null, "file:///"); this.content_wrapper.Remove (this.content_wrapper.Child); this.content_wrapper.Add (this.scrolled_window); this.content_wrapper.ShowAll (); diff --git a/configure.ac b/configure.ac index 2c97ee9f..2c4cf28d 100755 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. m4_define([sparkleshare_version], - [0.6.0]) + [0.8.0]) m4_define([sparkleshare_asm_version], - [0.6.0]) + [0.8.0]) AC_PREREQ([2.54]) AC_INIT([SparkleShare], sparkleshare_version) diff --git a/data/html/event-log.html b/data/html/event-log.html index 9f985338..bb1bc03d 100755 --- a/data/html/event-log.html +++ b/data/html/event-log.html @@ -2,9 +2,26 @@ SparkleShare Event Log - + +