diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index 36b6a45c..f9f78030 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -137,6 +137,30 @@ namespace SparkleLib { } + public override string [] Warnings { + get { + SparkleGit git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath, + "config --global core.excludesfile"); + + git.Start (); + + // Reading the standard output HAS to go before + // WaitForExit, or it will hang forever on output > 4096 bytes + string output = git.StandardOutput.ReadToEnd ().Trim (); + git.WaitForExit (); + + if (string.IsNullOrEmpty (output)) { + return null; + + } else { + return new string [] { + string.Format ("You seem to have configured a system ‘gitignore’ file. " + + "This may interfere with SparkleShare.\n({0})", output) + }; + } + } + } + public override void Stop () { if (this.git != null) { diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs index 86f869c5..ed194027 100755 --- a/SparkleLib/SparkleConfig.cs +++ b/SparkleLib/SparkleConfig.cs @@ -19,8 +19,9 @@ using System; using System.IO; using System.Collections.Generic; using System.Xml; +using System.Security.Principal; -using Mono.Unix; +//using Mono.Unix; namespace SparkleLib { @@ -98,11 +99,11 @@ namespace SparkleLib { if (SparkleBackend.Platform == PlatformID.Unix || SparkleBackend.Platform == PlatformID.MacOSX) { - user_name = new UnixUserInfo (UnixEnvironment.UserName).RealName; + user_name = Environment.UserName; if (string.IsNullOrEmpty (user_name)) - user_name = UnixEnvironment.UserName; + user_name = ""; else - user_name = user_name.TrimEnd (",".ToCharArray()); + user_name = user_name.TrimEnd (",".ToCharArray ()); } else { user_name = Environment.UserName; diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index bc2adf2d..6e01c748 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -18,10 +18,11 @@ using System; using System.IO; using System.Diagnostics; +using System.Security.AccessControl; using System.Text.RegularExpressions; using System.Threading; -using Mono.Unix; +//using Mono.Unix; namespace SparkleLib { @@ -29,7 +30,7 @@ namespace SparkleLib { public abstract class SparkleFetcherBase { public delegate void StartedEventHandler (); - public delegate void FinishedEventHandler (); + public delegate void FinishedEventHandler (string [] warnings); public delegate void FailedEventHandler (); public delegate void ProgressChangedEventHandler (double percentage); @@ -52,7 +53,7 @@ namespace SparkleLib { public abstract bool Fetch (); - + public abstract string [] Warnings { get; } // Clones the remote repository public void Start () @@ -83,7 +84,7 @@ namespace SparkleLib { EnableHostKeyCheckingForHost (host); if (Finished != null) - Finished (); + Finished (Warnings); } else { SparkleHelpers.DebugInfo ("Fetcher", "Failed"); @@ -157,9 +158,9 @@ namespace SparkleLib { File.WriteAllText (ssh_config_file_path, ssh_config); } - UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); - file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | - FileAccessPermissions.UserWrite); + //UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); + //file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | + // FileAccessPermissions.UserWrite); TODO SparkleHelpers.DebugInfo ("Fetcher", "Disabled host key checking " + host); } @@ -169,8 +170,8 @@ namespace SparkleLib { { string path = SparkleConfig.DefaultConfig.HomePath; - if (!(SparkleBackend.Platform == PlatformID.Unix || - SparkleBackend.Platform == PlatformID.MacOSX)) { + if (SparkleBackend.Platform != PlatformID.Unix && + SparkleBackend.Platform != PlatformID.MacOSX) { path = Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"); } @@ -208,9 +209,9 @@ namespace SparkleLib { } else { File.WriteAllText (ssh_config_file_path, new_ssh_config.Trim ()); - UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); - file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | - FileAccessPermissions.UserWrite); + //UnixFileSystemInfo file_info = new UnixFileInfo (ssh_config_file_path); + //file_info.FileAccessPermissions = (FileAccessPermissions.UserRead | + // FileAccessPermissions.UserWrite); TODO } } diff --git a/SparkleLib/SparkleLib.csproj b/SparkleLib/SparkleLib.csproj index 8e18cd24..a0ac9494 100755 --- a/SparkleLib/SparkleLib.csproj +++ b/SparkleLib/SparkleLib.csproj @@ -31,10 +31,6 @@ - - False - ..\bin\Meebey.SmartIrc4net.dll - diff --git a/SparkleLib/SparkleListenerBase.cs b/SparkleLib/SparkleListenerBase.cs index bba5b171..1770c04a 100755 --- a/SparkleLib/SparkleListenerBase.cs +++ b/SparkleLib/SparkleListenerBase.cs @@ -75,9 +75,6 @@ namespace SparkleLib { case "tcp": listeners.Add (new SparkleListenerTcp (announce_uri, folder_identifier)); break; - case "irc": - listeners.Add (new SparkleListenerIrc (announce_uri, folder_identifier)); - break; default: listeners.Add (new SparkleListenerTcp (announce_uri, folder_identifier)); break; diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 68bd39b9..c48c26b0 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -52,6 +52,9 @@ namespace SparkleShare { private NSTextField PathLabel; private NSTextField PathHelpLabel; private NSTextField AddProjectTextField; + private NSTextField WarningTextField; + private NSImage WarningImage; + private NSImageView WarningImageView; private NSTableView TableView; private NSScrollView ScrollView; private NSTableColumn IconColumn; @@ -61,7 +64,7 @@ namespace SparkleShare { public SparkleSetup () : base () { - Controller.ChangePageEvent += delegate (PageType type) { + Controller.ChangePageEvent += delegate (PageType type, string [] warnings) { InvokeOnMainThread (delegate { Reset (); @@ -452,6 +455,28 @@ namespace SparkleShare { "‘" + Controller.SyncingFolder + "’ in " + "your SparkleShare folder."; + if (warnings != null) { + WarningImage = NSImage.ImageNamed ("NSCaution"); + WarningImage.Size = new SizeF (24, 24); + + WarningImageView = new NSImageView () { + Image = WarningImage, + Frame = new RectangleF (190, Frame.Height - 175, 24, 24) + }; + + WarningTextField = new NSTextField () { + Frame = new RectangleF (230, Frame.Height - 245, 325, 100), + StringValue = warnings [0], + BackgroundColor = NSColor.WindowBackground, + Bordered = false, + Editable = false, + Font = SparkleUI.Font + }; + + ContentView.AddSubview (WarningImageView); + ContentView.AddSubview (WarningTextField); + } + FinishButton = new NSButton () { Title = "Finish" }; diff --git a/SparkleShare/Mac/SparkleSetupWindow.cs b/SparkleShare/Mac/SparkleSetupWindow.cs index d0a6ed79..e2bfa0c0 100755 --- a/SparkleShare/Mac/SparkleSetupWindow.cs +++ b/SparkleShare/Mac/SparkleSetupWindow.cs @@ -143,7 +143,7 @@ namespace SparkleShare { public override void PerformClose (NSObject sender) { - OrderOut (this); + base.OrderOut (this); NSApplication.SharedApplication.RemoveWindowsItem (this); return; } diff --git a/SparkleShare/Mac/SparkleShare.csproj b/SparkleShare/Mac/SparkleShare.csproj index fa5aa0d8..8c95d9e2 100755 --- a/SparkleShare/Mac/SparkleShare.csproj +++ b/SparkleShare/Mac/SparkleShare.csproj @@ -11,7 +11,7 @@ SparkleShare SparkleShare v4.0 - 0.4.0 + 0.2.5 true @@ -58,12 +58,11 @@ False - + False ..\..\bin\SparkleLib.dll - @@ -110,6 +109,9 @@ SparklePlugin.cs + + SparkleOptions.cs + diff --git a/SparkleShare/SparkleBubblesController.cs b/SparkleShare/SparkleBubblesController.cs index 68303c64..3fe424e4 100755 --- a/SparkleShare/SparkleBubblesController.cs +++ b/SparkleShare/SparkleBubblesController.cs @@ -60,22 +60,22 @@ namespace SparkleShare { if (change_set.Added.Count > 0) { file_name = change_set.Added [0]; - message = String.Format (_("added ‘{0}’"), file_name); + message = String.Format ("added ‘{0}’", file_name); } if (change_set.MovedFrom.Count > 0) { file_name = change_set.MovedFrom [0]; - message = String.Format (_("moved ‘{0}’"), file_name); + message = String.Format ("moved ‘{0}’", file_name); } if (change_set.Edited.Count > 0) { file_name = change_set.Edited [0]; - message = String.Format (_("edited ‘{0}’"), file_name); + 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); + message = String.Format ("deleted ‘{0}’", file_name); } int changes_count = (change_set.Added.Count + @@ -84,11 +84,11 @@ namespace SparkleShare { change_set.MovedFrom.Count) - 1; if (changes_count > 0) { - string msg = Catalog.GetPluralString ("and {0} more", "and {0} more", changes_count); + string msg = string.Format ("and {0} more", changes_count); message += " " + String.Format (msg, changes_count); } else if (changes_count < 0) { - message += _("did something magical"); + message += "did something magical"; } return message; diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index 6d1372d6..f6032dad 100755 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -42,7 +42,7 @@ namespace SparkleShare { public delegate void OnQuitWhileSyncingEventHandler (); public event FolderFetchedEventHandler FolderFetched; - public delegate void FolderFetchedEventHandler (); + public delegate void FolderFetchedEventHandler (string [] warnings); public event FolderFetchErrorEventHandler FolderFetchError; public delegate void FolderFetchErrorEventHandler (string remote_url); @@ -1013,7 +1013,7 @@ namespace SparkleShare { if (i > 1) target_folder_name += " (" + i + ")"; - this.fetcher.Finished += delegate { + this.fetcher.Finished += delegate (string [] warnings) { // Needed to do the moving SparkleHelpers.ClearAttributes (tmp_folder); @@ -1030,7 +1030,7 @@ namespace SparkleShare { AddRepository (target_folder_path); if (FolderFetched != null) - FolderFetched (); + FolderFetched (warnings); FolderSize = GetFolderSize (); diff --git a/SparkleShare/SparkleSetup.cs b/SparkleShare/SparkleSetup.cs index d8cde142..d01be29c 100755 --- a/SparkleShare/SparkleSetup.cs +++ b/SparkleShare/SparkleSetup.cs @@ -461,7 +461,31 @@ namespace SparkleShare { Close (); }; - Add (null); + + if (warnings != null) { + WarningImage = NSImage.ImageNamed ("NSCaution"); + WarningImage.Size = new SizeF (24, 24); + + WarningImageView = new NSImageView () { + Image = WarningImage, + Frame = new RectangleF (190, Frame.Height - 175, 24, 24) + }; + + Image warning_image = new Image (SparkleUIHelpers.GetIcon ("dialog-warning", 24)); + Label warning_label = new Label (warnings [0]) { + Xalign = 0 + }; + + HBox warning_layout = new HBox (false, 0); + warning_layout.PackStart (warning_image, false, false, 0); + warning_layout.PackStart (warning_label, true, true, 0); + + Add (warning_layout); + + } else { + Add (null); + } + AddButton (open_folder_button); AddButton (finish_button); diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index c54d034e..58ba3f44 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -42,7 +42,7 @@ namespace SparkleShare { public class SparkleSetupController { public event ChangePageEventHandler ChangePageEvent; - public delegate void ChangePageEventHandler (PageType page); + public delegate void ChangePageEventHandler (PageType page, string [] warnings); public event UpdateProgressBarEventHandler UpdateProgressBarEvent; public delegate void UpdateProgressBarEventHandler (double percentage); @@ -152,7 +152,7 @@ namespace SparkleShare { SelectedPlugin = Plugins [0]; - ChangePageEvent += delegate (PageType page) { + ChangePageEvent += delegate (PageType page, string [] warning) { this.previous_page = page; }; } @@ -161,7 +161,7 @@ namespace SparkleShare { public void ShowSetupPage () { if (ChangePageEvent != null) - ChangePageEvent (PageType.Setup); + ChangePageEvent (PageType.Setup, null); } @@ -187,7 +187,7 @@ namespace SparkleShare { Program.Controller.UpdateState (); if (ChangePageEvent != null) - ChangePageEvent (PageType.Tutorial); + ChangePageEvent (PageType.Tutorial, null); } @@ -196,7 +196,7 @@ namespace SparkleShare { this.tutorial_page_number++; if (ChangePageEvent != null) - ChangePageEvent (PageType.Tutorial); + ChangePageEvent (PageType.Tutorial, null); } @@ -205,14 +205,14 @@ namespace SparkleShare { this.tutorial_page_number = 4; if (ChangePageEvent != null) - ChangePageEvent (PageType.Tutorial); + ChangePageEvent (PageType.Tutorial, null); } public void ShowAddPage () { if (ChangePageEvent != null) - ChangePageEvent (PageType.Add); + ChangePageEvent (PageType.Add, null); SelectedPluginChanged (SelectedPluginIndex); } @@ -241,11 +241,13 @@ namespace SparkleShare { this.previous_path = path; if (ChangePageEvent != null) - ChangePageEvent (PageType.Syncing); + ChangePageEvent (PageType.Syncing, null); - Program.Controller.FolderFetched += delegate { + // TODO: Remove events afterwards + + Program.Controller.FolderFetched += delegate (string [] warnings) { if (ChangePageEvent != null) - ChangePageEvent (PageType.Finished); + ChangePageEvent (PageType.Finished, warnings); this.previous_address = ""; this.syncing_folder = ""; @@ -257,7 +259,7 @@ namespace SparkleShare { this.previous_url = remote_url; if (ChangePageEvent != null) - ChangePageEvent (PageType.Error); + ChangePageEvent (PageType.Error, null); this.syncing_folder = ""; }; @@ -274,7 +276,7 @@ namespace SparkleShare { public void ErrorPageCompleted () { if (ChangePageEvent != null) - ChangePageEvent (PageType.Add); + ChangePageEvent (PageType.Add, null); } @@ -283,7 +285,7 @@ namespace SparkleShare { Program.Controller.StopFetcher (); if (ChangePageEvent != null) - ChangePageEvent (PageType.Add); + ChangePageEvent (PageType.Add, null); } diff --git a/SparkleShare/SparkleStatusIconController.cs b/SparkleShare/SparkleStatusIconController.cs index 577a593d..30ab0408 100755 --- a/SparkleShare/SparkleStatusIconController.cs +++ b/SparkleShare/SparkleStatusIconController.cs @@ -24,7 +24,7 @@ namespace SparkleShare { Idle, SyncingUp, SyncingDown, - SyncingUpDown, + Syncing, Error }