Add nicer error reporting

This commit is contained in:
Hylke Bons 2011-08-27 20:57:34 +02:00
parent 38cb2499ea
commit 7106f6baae
7 changed files with 66 additions and 30 deletions

View file

@ -40,11 +40,10 @@ namespace SparkleLib {
protected string target_folder;
protected string remote_url;
private Thread thread;
public abstract bool Fetch ();
public SparkleFetcherBase (string server, string remote_folder, string target_folder)
{
this.target_folder = target_folder;
@ -52,6 +51,9 @@ namespace SparkleLib {
}
public abstract bool Fetch ();
// Clones the remote repository
public void Start ()
{

View file

@ -45,7 +45,7 @@ namespace SparkleShare {
public delegate void FolderFetchedEventHandler ();
public event FolderFetchErrorEventHandler FolderFetchError;
public delegate void FolderFetchErrorEventHandler ();
public delegate void FolderFetchErrorEventHandler (string remote_url);
public event FolderFetchingEventHandler FolderFetching;
public delegate void FolderFetchingEventHandler (double percentage);
@ -1051,7 +1051,7 @@ namespace SparkleShare {
this.fetcher.Failed += delegate {
if (FolderFetchError != null)
FolderFetchError ();
FolderFetchError (this.fetcher.RemoteUrl);
this.fetcher.Dispose ();

View file

@ -331,29 +331,55 @@ namespace SparkleShare {
case PageType.Error: {
string n = Environment.NewLine;
Header = _("Something went wrong") + "…";
Description = "We don't know exactly what the problem is, " +
"but we can try to help you pinpoint it.";
VBox points = new VBox (false, 0);
Image list_point_one = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { };
Image list_point_two = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { };
Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16)) { };
Label label_one = new Label () {
Text = "First, have you tried turning it off and on again?",
Wrap = true,
Xalign = 0
};
Label label_two = new Label () {
Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we've compiled. " +
"Does this look allright?",
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);
HBox point_one = new HBox (false, 0);
point_one.PackStart (list_point_one, false, false, 0);
point_one.PackStart (label_one, true, true, 12);
points.PackStart (point_one, false, false, 12);
HBox point_two = new HBox (false, 0);
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);
points.PackStart (new Label (""), true, true, 0);
Label l = new Label (
"First, have you tried turning it off and on again?" + n +
n +
Controller.SyncingFolder +" is the address we've compiled from the information " +
"you entered. Does this look correct?" + n +
n +
"The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?");
l.Xpad = 12;
l.Wrap = true;
Button try_again_button = new Button (_("Try Again")) {
Button try_again_button = new Button (_("Try Again…")) {
Sensitive = true
};
@ -362,7 +388,7 @@ namespace SparkleShare {
};
AddButton (try_again_button);
Add (l);
Add (points);
break;
}

View file

@ -37,6 +37,12 @@ namespace SparkleShare {
public event UpdateProgressBarEventHandler UpdateProgressBarEvent;
public delegate void UpdateProgressBarEventHandler (double percentage);
public string PreviousUrl {
get {
return this.previous_url;
}
}
public string PreviousServer {
get {
return this.previous_server;
@ -63,6 +69,7 @@ namespace SparkleShare {
private string previous_server = "";
private string previous_folder = "";
private string previous_url = "";
private string syncing_folder = "";
private PageType previous_page;
@ -117,7 +124,9 @@ namespace SparkleShare {
this.syncing_folder = "";
};
SparkleShare.Controller.FolderFetchError += delegate {
SparkleShare.Controller.FolderFetchError += delegate (string remote_url) {
this.previous_url = remote_url;
if (ChangePageEvent != null)
ChangePageEvent (PageType.Error);

View file

@ -149,9 +149,7 @@ namespace SparkleShare {
new public void ShowAll ()
{
Present ();
Present ();
base.ShowAll ();
}

View file

@ -35,6 +35,7 @@ app_theme_icons = \
status,document-deleted-12.png \
status,document-moved-12.png \
status,dialog-error-16.png \
status,list-point-16.png \
status,dialog-error-24.png
install_icon_exec = $(top_srcdir)/build/icon-theme-installer \

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B