From 6d796f35bf64255fdd49097f5761a7bacc1a3af4 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 17 Jun 2012 21:56:27 +0100 Subject: [PATCH] make --- SparkleLib/Git/SparkleFetcherGit.cs | 18 ++++++++++---- SparkleLib/Git/SparkleRepoGit.cs | 3 +-- SparkleLib/SparkleFetcherBase.cs | 8 ++++++ SparkleShare/Linux/SparkleSetup.cs | 32 ++++++++++++------------ SparkleShare/Mac/SparkleEventLog.cs | 4 +-- SparkleShare/Mac/SparkleSetup.cs | 6 +++-- SparkleShare/SparkleControllerBase.cs | 8 +++--- SparkleShare/SparkleSetupController.cs | 10 ++++---- SparkleShare/Windows/SparkleSetup.cs | 34 ++++++++++++++------------ 9 files changed, 72 insertions(+), 51 deletions(-) diff --git a/SparkleLib/Git/SparkleFetcherGit.cs b/SparkleLib/Git/SparkleFetcherGit.cs index d5e69cff..2d8756d8 100755 --- a/SparkleLib/Git/SparkleFetcherGit.cs +++ b/SparkleLib/Git/SparkleFetcherGit.cs @@ -16,8 +16,9 @@ using System; -using System.IO; +using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Text.RegularExpressions; using System.Threading; @@ -126,6 +127,9 @@ namespace SparkleLib.Git { } else { SparkleHelpers.DebugInfo ("Fetcher", line); + + if (line.StartsWith ("fatal:")) + base.errors.Add (line); } @@ -140,23 +144,25 @@ namespace SparkleLib.Git { } this.git.WaitForExit (); + SparkleHelpers.DebugInfo ("Git", "Exit code: " + this.git.ExitCode); if (this.git.ExitCode == 0) { while (percentage < 100) { percentage += 25; - + if (percentage >= 100) break; Thread.Sleep (500); base.OnProgressChanged (percentage); } - + base.OnProgressChanged (100); InstallConfiguration (); InstallExcludeRules (); + AddWarnings (); return true; @@ -439,7 +445,8 @@ namespace SparkleLib.Git { private void AddWarnings () { - /*SparkleGit git = new SparkleGit (TargetFolder, + /* + SparkleGit git = new SparkleGit (TargetFolder, "config --global core.excludesfile"); git.Start (); @@ -453,6 +460,7 @@ namespace SparkleLib.Git { return; else this.warnings.Add ("You seem to have a system wide ‘gitignore’ file, this may affect SparkleShare files."); - */ } + */ + } } } diff --git a/SparkleLib/Git/SparkleRepoGit.cs b/SparkleLib/Git/SparkleRepoGit.cs index 06490915..60c04ef0 100644 --- a/SparkleLib/Git/SparkleRepoGit.cs +++ b/SparkleLib/Git/SparkleRepoGit.cs @@ -158,8 +158,7 @@ namespace SparkleLib.Git { if (git.ExitCode != 0) return false; - string remote_revision = git.StandardOutput.ReadToEnd ().TrimEnd (); - remote_revision = remote_revision.Substring (0, 40); + string remote_revision = git.StandardOutput.ReadToEnd ().Substring (0, 40); if (!remote_revision.StartsWith (current_revision)) { SparkleHelpers.DebugInfo ("Git", diff --git a/SparkleLib/SparkleFetcherBase.cs b/SparkleLib/SparkleFetcherBase.cs index c436a522..490c962b 100755 --- a/SparkleLib/SparkleFetcherBase.cs +++ b/SparkleLib/SparkleFetcherBase.cs @@ -58,7 +58,15 @@ namespace SparkleLib { } } + public string [] Errors { + get { + return this.errors.ToArray (); + } + } + protected List warnings = new List (); + protected List errors = new List (); + private Thread thread; diff --git a/SparkleShare/Linux/SparkleSetup.cs b/SparkleShare/Linux/SparkleSetup.cs index 2e3e5d50..b0067719 100755 --- a/SparkleShare/Linux/SparkleSetup.cs +++ b/SparkleShare/Linux/SparkleSetup.cs @@ -450,25 +450,17 @@ namespace SparkleShare { Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)); Label label_one = new Label () { - Text = "Is the host online?", + Markup = "" + Controller.PreviousUrl + " is the address we've compiled. " + + "Does this look alright?", Wrap = true, Xalign = 0 }; Label label_two = new Label () { - Markup = "" + Controller.PreviousUrl + " is the address we've compiled. " + - "Does this look alright?", + Text = "Do you have access rights to this remote project?", Wrap = true, Xalign = 0 }; - - Label label_three = new Label () { - Text = "The host needs to know who you are. Did you upload the key that's in " + - "your SparkleShare folder?", - Wrap = true, - Xalign = 0 - }; - points.PackStart (new Label ("Please check the following:") { Xalign = 0 }, false, false, 6); @@ -481,11 +473,19 @@ namespace SparkleShare { point_two.PackStart (list_point_two, false, false, 0); point_two.PackStart (label_two, true, true, 12); points.PackStart (point_two, false, false, 12); - - HBox point_three = new HBox (false, 0); - point_three.PackStart (list_point_three, false, false, 0); - point_three.PackStart (label_three, true, true, 12); - points.PackStart (point_three, false, false, 12); + + if (warnings.Length > 0) { + Label label_three = new Label () { + Markup = "Here's the raw error message:\n" + warnings [0] + "", + Wrap = true, + Xalign = 0 + }; + + HBox point_three = new HBox (false, 0); + point_three.PackStart (list_point_three, false, false, 0); + point_three.PackStart (label_three, true, true, 12); + points.PackStart (point_three, false, false, 12); + } points.PackStart (new Label (""), true, true, 0); diff --git a/SparkleShare/Mac/SparkleEventLog.cs b/SparkleShare/Mac/SparkleEventLog.cs index 047edd33..94ae9fc9 100755 --- a/SparkleShare/Mac/SparkleEventLog.cs +++ b/SparkleShare/Mac/SparkleEventLog.cs @@ -152,8 +152,8 @@ namespace SparkleShare { this.background = new NSBox () { Frame = new RectangleF ( - new PointF (0, -1), - new SizeF (Frame.Width, this.web_view.Frame.Height + 2)), + new PointF (-1, -1), + new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 2)), FillColor = NSColor.White, BoxType = NSBoxType.NSBoxCustom }; diff --git a/SparkleShare/Mac/SparkleSetup.cs b/SparkleShare/Mac/SparkleSetup.cs index 518d0eb0..c516419e 100755 --- a/SparkleShare/Mac/SparkleSetup.cs +++ b/SparkleShare/Mac/SparkleSetup.cs @@ -574,10 +574,12 @@ namespace SparkleShare { "}" + "" + "
    " + - "
  • Is the host online?
  • " + "
  • " + Controller.PreviousUrl + " is the address we've compiled. Does this look alright?
  • " + - "
  • The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?
  • " + + "
  • Do you have access rights to this remote project?
  • " + "
"; + + if (warnings.Length > 0) + html = html.Replace ("", "
  • Here's the raw error message:
    " + warnings [0] + "
  • "); web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.DrawsBackground = false; diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index ccf87081..9097f0ee 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -66,7 +66,7 @@ namespace SparkleShare { public delegate void FolderFetchedEventHandler (string remote_url, string [] warnings); public event FolderFetchErrorHandler FolderFetchError; - public delegate void FolderFetchErrorHandler (string remote_url); + public delegate void FolderFetchErrorHandler (string remote_url, string [] errors); public event FolderFetchingHandler FolderFetching; public delegate void FolderFetchingHandler (double percentage); @@ -939,7 +939,9 @@ namespace SparkleShare { "Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\""); if (FolderFetchError != null) - FolderFetchError (Path.Combine (address, remote_path).Replace (@"\", "/")); + FolderFetchError ( + Path.Combine (address, remote_path).Replace (@"\", "/"), + new string [] {"Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\""}); return; } @@ -961,7 +963,7 @@ namespace SparkleShare { this.fetcher.Failed += delegate { if (FolderFetchError != null) - FolderFetchError (this.fetcher.RemoteUrl.ToString ()); + FolderFetchError (this.fetcher.RemoteUrl.ToString (), this.fetcher.Errors); StopFetcher (); }; diff --git a/SparkleShare/SparkleSetupController.cs b/SparkleShare/SparkleSetupController.cs index a801fd74..c882ed66 100755 --- a/SparkleShare/SparkleSetupController.cs +++ b/SparkleShare/SparkleSetupController.cs @@ -453,13 +453,13 @@ namespace SparkleShare { Program.Controller.FolderFetching -= SyncingPageFetchingDelegate; } - private void AddPageFetchErrorDelegate (string remote_url) + private void AddPageFetchErrorDelegate (string remote_url, string [] errors) { SyncingFolder = ""; PreviousUrl = remote_url; - + if (ChangePageEvent != null) - ChangePageEvent (PageType.Error, null); + ChangePageEvent (PageType.Error, errors); Program.Controller.FolderFetched -= AddPageFetchedDelegate; Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate; @@ -515,13 +515,13 @@ namespace SparkleShare { Program.Controller.FolderFetching -= SyncingPageFetchingDelegate; } - private void InvitePageFetchErrorDelegate (string remote_url) + private void InvitePageFetchErrorDelegate (string remote_url, string [] errors) { SyncingFolder = ""; PreviousUrl = remote_url; if (ChangePageEvent != null) - ChangePageEvent (PageType.Error, null); + ChangePageEvent (PageType.Error, errors); Program.Controller.FolderFetched -= AddPageFetchedDelegate; Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate; diff --git a/SparkleShare/Windows/SparkleSetup.cs b/SparkleShare/Windows/SparkleSetup.cs index aa2b0989..c3633760 100644 --- a/SparkleShare/Windows/SparkleSetup.cs +++ b/SparkleShare/Windows/SparkleSetup.cs @@ -64,7 +64,7 @@ namespace SparkleShare { switch (type) { case PageType.Setup: { Header = "Welcome to SparkleShare!"; - Description = "Before we get started, what's your name and email?\n" + + Description = "Before we get started, what's your name and email?\n" + "Don't worry, this information will only be visible to team members."; @@ -485,23 +485,26 @@ namespace SparkleShare { case PageType.Error: { Header = "Something went wrong…"; Description = "Please check the following:"; - - + TextBlock help_block = new TextBlock () { TextWrapping = TextWrapping.Wrap, Width = 310 }; - - help_block.Inlines.Add ("Is the host online?\n\n"); - help_block.Inlines.Add (new Bold (new Run (Controller.PreviousUrl))); - help_block.Inlines.Add (" is the address we've compiled. Does this look alright?\n\n"); - help_block.Inlines.Add ("The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?"); - - TextBlock bullets_block = new TextBlock () { - Text = "•\n\n•\n\n\n•" - }; - - + + TextBlock bullets_block = new TextBlock () { + Text = "•\n\n•" + }; + + help_block.Inlines.Add (new Bold (new Run (Controller.PreviousUrl))); + help_block.Inlines.Add (" is the address we've compiled. Does this look alright?\n\n"); + help_block.Inlines.Add ("Do you have access rights to this remote project?"); + + if (warnings.Length > 0) { + help_block.Inlines.Add ("\n\nHere's the raw error message:\n"); + help_block.Inlines.Add (new Bold (new Run (warning [0]))); + bullets_block.Text += "\n\n•"; + } + Button cancel_button = new Button () { Content = "Cancel" }; @@ -509,8 +512,7 @@ namespace SparkleShare { Button try_again_button = new Button () { Content = "Try again…" }; - - + ContentCanvas.Children.Add (bullets_block); Canvas.SetLeft (bullets_block, 195);