[Xfce4-commits] <midori:master> Display error dialog on external download failure
Christian Dywan
noreply at xfce.org
Thu Apr 5 23:50:01 CEST 2012
Updating branch refs/heads/master
to 2377ee3c94116a1b41a553d08e330a5858a8d955 (commit)
from c4d1a96ca4366490f153c3defcd5ded85da61422 (commit)
commit 2377ee3c94116a1b41a553d08e330a5858a8d955
Author: André Stösel <andre at stoesel.de>
Date: Thu Apr 5 22:55:40 2012 +0200
Display error dialog on external download failure
extensions/external-download-manager.vala | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/extensions/external-download-manager.vala b/extensions/external-download-manager.vala
index 62151da..ba397c0 100644
--- a/extensions/external-download-manager.vala
+++ b/extensions/external-download-manager.vala
@@ -113,6 +113,21 @@ namespace EDM {
manager.deactivated (this);
}
+ public void handle_exception (GLib.Error error) {
+ string ext_name;
+ this.get ("name",out ext_name);
+ var dialog = new MessageDialog (null, DialogFlags.MODAL,
+ MessageType.ERROR, ButtonsType.CLOSE,
+ _("An error occurred when attempting to download a file with the following plugin:\n" +
+ "%s\n\n" +
+ "Error:\n%s\n\n" +
+ "Carry on without this plugin."
+ ),
+ ext_name, error.message);
+ dialog.response.connect ((a) => { dialog.destroy (); });
+ dialog.run ();
+ }
+
public abstract bool download (DownloadRequest dlReq);
}
@@ -146,7 +161,7 @@ namespace EDM {
XMLRPC.parse_method_response ((string) message.response_body.flatten ().data, -1, out v);
return true;
} catch (Error e) {
- stderr.printf ("Error while processing the response: %s\n", e.message);
+ this.handle_exception (e);
}
return false;
@@ -174,7 +189,7 @@ namespace EDM {
dm.AddFile (dlReq.uri);
return true;
} catch (Error e) {
- stderr.printf("Error: %s\n", e.message);
+ this.handle_exception (e);
}
return false;
}
More information about the Xfce4-commits
mailing list