This commit is contained in:
Hylke Bons 2012-06-17 21:56:27 +01:00
parent 06a9b0406c
commit 6d796f35bf
9 changed files with 72 additions and 51 deletions

View file

@ -16,8 +16,9 @@
using System; using System;
using System.IO; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
@ -126,6 +127,9 @@ namespace SparkleLib.Git {
} else { } else {
SparkleHelpers.DebugInfo ("Fetcher", line); SparkleHelpers.DebugInfo ("Fetcher", line);
if (line.StartsWith ("fatal:"))
base.errors.Add (line);
} }
@ -140,23 +144,25 @@ namespace SparkleLib.Git {
} }
this.git.WaitForExit (); this.git.WaitForExit ();
SparkleHelpers.DebugInfo ("Git", "Exit code: " + this.git.ExitCode); SparkleHelpers.DebugInfo ("Git", "Exit code: " + this.git.ExitCode);
if (this.git.ExitCode == 0) { if (this.git.ExitCode == 0) {
while (percentage < 100) { while (percentage < 100) {
percentage += 25; percentage += 25;
if (percentage >= 100) if (percentage >= 100)
break; break;
Thread.Sleep (500); Thread.Sleep (500);
base.OnProgressChanged (percentage); base.OnProgressChanged (percentage);
} }
base.OnProgressChanged (100); base.OnProgressChanged (100);
InstallConfiguration (); InstallConfiguration ();
InstallExcludeRules (); InstallExcludeRules ();
AddWarnings (); AddWarnings ();
return true; return true;
@ -439,7 +445,8 @@ namespace SparkleLib.Git {
private void AddWarnings () private void AddWarnings ()
{ {
/*SparkleGit git = new SparkleGit (TargetFolder, /*
SparkleGit git = new SparkleGit (TargetFolder,
"config --global core.excludesfile"); "config --global core.excludesfile");
git.Start (); git.Start ();
@ -453,6 +460,7 @@ namespace SparkleLib.Git {
return; return;
else else
this.warnings.Add ("You seem to have a system wide gitignore file, this may affect SparkleShare files."); this.warnings.Add ("You seem to have a system wide gitignore file, this may affect SparkleShare files.");
*/ } */
}
} }
} }

View file

@ -158,8 +158,7 @@ namespace SparkleLib.Git {
if (git.ExitCode != 0) if (git.ExitCode != 0)
return false; return false;
string remote_revision = git.StandardOutput.ReadToEnd ().TrimEnd (); string remote_revision = git.StandardOutput.ReadToEnd ().Substring (0, 40);
remote_revision = remote_revision.Substring (0, 40);
if (!remote_revision.StartsWith (current_revision)) { if (!remote_revision.StartsWith (current_revision)) {
SparkleHelpers.DebugInfo ("Git", SparkleHelpers.DebugInfo ("Git",

View file

@ -58,7 +58,15 @@ namespace SparkleLib {
} }
} }
public string [] Errors {
get {
return this.errors.ToArray ();
}
}
protected List<string> warnings = new List<string> (); protected List<string> warnings = new List<string> ();
protected List<string> errors = new List<string> ();
private Thread thread; private Thread thread;

View file

@ -450,25 +450,17 @@ namespace SparkleShare {
Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)); Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
Label label_one = new Label () { Label label_one = new Label () {
Text = "Is the host online?", Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " +
"Does this look alright?",
Wrap = true, Wrap = true,
Xalign = 0 Xalign = 0
}; };
Label label_two = new Label () { Label label_two = new Label () {
Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " + Text = "Do you have access rights to this remote project?",
"Does this look alright?",
Wrap = true, Wrap = true,
Xalign = 0 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); 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 (list_point_two, false, false, 0);
point_two.PackStart (label_two, true, true, 12); point_two.PackStart (label_two, true, true, 12);
points.PackStart (point_two, false, false, 12); points.PackStart (point_two, false, false, 12);
HBox point_three = new HBox (false, 0); if (warnings.Length > 0) {
point_three.PackStart (list_point_three, false, false, 0); Label label_three = new Label () {
point_three.PackStart (label_three, true, true, 12); Markup = "Here's the raw error message:\n<b>" + warnings [0] + "</b>",
points.PackStart (point_three, false, false, 12); 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); points.PackStart (new Label (""), true, true, 0);

View file

@ -152,8 +152,8 @@ namespace SparkleShare {
this.background = new NSBox () { this.background = new NSBox () {
Frame = new RectangleF ( Frame = new RectangleF (
new PointF (0, -1), new PointF (-1, -1),
new SizeF (Frame.Width, this.web_view.Frame.Height + 2)), new SizeF (Frame.Width + 2, this.web_view.Frame.Height + 2)),
FillColor = NSColor.White, FillColor = NSColor.White,
BoxType = NSBoxType.NSBoxCustom BoxType = NSBoxType.NSBoxCustom
}; };

View file

@ -574,10 +574,12 @@ namespace SparkleShare {
"}" + "}" +
"</style>" + "</style>" +
"<ul>" + "<ul>" +
" <li>Is the host online?</li>" +
" <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" + " <li><b>" + Controller.PreviousUrl + "</b> is the address we've compiled. Does this look alright?</li>" +
" <li>The host needs to know who you are. Did you upload the key that's in your SparkleShare folder?</li>" + " <li>Do you have access rights to this remote project?</li>" +
"</ul>"; "</ul>";
if (warnings.Length > 0)
html = html.Replace ("</ul>", "<li>Here's the raw error message:<br/> <b>" + warnings [0] + "</b></li></ul>");
web_view.MainFrame.LoadHtmlString (html, new NSUrl ("")); web_view.MainFrame.LoadHtmlString (html, new NSUrl (""));
web_view.DrawsBackground = false; web_view.DrawsBackground = false;

View file

@ -66,7 +66,7 @@ namespace SparkleShare {
public delegate void FolderFetchedEventHandler (string remote_url, string [] warnings); public delegate void FolderFetchedEventHandler (string remote_url, string [] warnings);
public event FolderFetchErrorHandler FolderFetchError; 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 event FolderFetchingHandler FolderFetching;
public delegate void FolderFetchingHandler (double percentage); public delegate void FolderFetchingHandler (double percentage);
@ -939,7 +939,9 @@ namespace SparkleShare {
"Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\""); "Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\"");
if (FolderFetchError != null) 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; return;
} }
@ -961,7 +963,7 @@ namespace SparkleShare {
this.fetcher.Failed += delegate { this.fetcher.Failed += delegate {
if (FolderFetchError != null) if (FolderFetchError != null)
FolderFetchError (this.fetcher.RemoteUrl.ToString ()); FolderFetchError (this.fetcher.RemoteUrl.ToString (), this.fetcher.Errors);
StopFetcher (); StopFetcher ();
}; };

View file

@ -453,13 +453,13 @@ namespace SparkleShare {
Program.Controller.FolderFetching -= SyncingPageFetchingDelegate; Program.Controller.FolderFetching -= SyncingPageFetchingDelegate;
} }
private void AddPageFetchErrorDelegate (string remote_url) private void AddPageFetchErrorDelegate (string remote_url, string [] errors)
{ {
SyncingFolder = ""; SyncingFolder = "";
PreviousUrl = remote_url; PreviousUrl = remote_url;
if (ChangePageEvent != null) if (ChangePageEvent != null)
ChangePageEvent (PageType.Error, null); ChangePageEvent (PageType.Error, errors);
Program.Controller.FolderFetched -= AddPageFetchedDelegate; Program.Controller.FolderFetched -= AddPageFetchedDelegate;
Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate; Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate;
@ -515,13 +515,13 @@ namespace SparkleShare {
Program.Controller.FolderFetching -= SyncingPageFetchingDelegate; Program.Controller.FolderFetching -= SyncingPageFetchingDelegate;
} }
private void InvitePageFetchErrorDelegate (string remote_url) private void InvitePageFetchErrorDelegate (string remote_url, string [] errors)
{ {
SyncingFolder = ""; SyncingFolder = "";
PreviousUrl = remote_url; PreviousUrl = remote_url;
if (ChangePageEvent != null) if (ChangePageEvent != null)
ChangePageEvent (PageType.Error, null); ChangePageEvent (PageType.Error, errors);
Program.Controller.FolderFetched -= AddPageFetchedDelegate; Program.Controller.FolderFetched -= AddPageFetchedDelegate;
Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate; Program.Controller.FolderFetchError -= AddPageFetchErrorDelegate;

View file

@ -64,7 +64,7 @@ namespace SparkleShare {
switch (type) { switch (type) {
case PageType.Setup: { case PageType.Setup: {
Header = "Welcome to SparkleShare!"; 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."; "Don't worry, this information will only be visible to team members.";
@ -485,23 +485,26 @@ namespace SparkleShare {
case PageType.Error: { case PageType.Error: {
Header = "Something went wrong…"; Header = "Something went wrong…";
Description = "Please check the following:"; Description = "Please check the following:";
TextBlock help_block = new TextBlock () { TextBlock help_block = new TextBlock () {
TextWrapping = TextWrapping.Wrap, TextWrapping = TextWrapping.Wrap,
Width = 310 Width = 310
}; };
help_block.Inlines.Add ("Is the host online?\n\n"); TextBlock bullets_block = new TextBlock () {
help_block.Inlines.Add (new Bold (new Run (Controller.PreviousUrl))); Text = "•\n\n•"
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?");
help_block.Inlines.Add (new Bold (new Run (Controller.PreviousUrl)));
TextBlock bullets_block = new TextBlock () { help_block.Inlines.Add (" is the address we've compiled. Does this look alright?\n\n");
Text = "•\n\n•\n\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 () { Button cancel_button = new Button () {
Content = "Cancel" Content = "Cancel"
}; };
@ -509,8 +512,7 @@ namespace SparkleShare {
Button try_again_button = new Button () { Button try_again_button = new Button () {
Content = "Try again…" Content = "Try again…"
}; };
ContentCanvas.Children.Add (bullets_block); ContentCanvas.Children.Add (bullets_block);
Canvas.SetLeft (bullets_block, 195); Canvas.SetLeft (bullets_block, 195);