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.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.");
*/ }
*/
}
}
}

View file

@ -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",

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> errors = new List<string> ();
private Thread thread;

View file

@ -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 = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " +
"Does this look alright?",
Wrap = true,
Xalign = 0
};
Label label_two = new Label () {
Markup = "<b>" + Controller.PreviousUrl + "</b> 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<b>" + warnings [0] + "</b>",
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);

View file

@ -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
};

View file

@ -574,10 +574,12 @@ namespace SparkleShare {
"}" +
"</style>" +
"<ul>" +
" <li>Is the host online?</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>";
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.DrawsBackground = false;

View file

@ -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 ();
};

View file

@ -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;

View file

@ -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);