[geary/wip/713006-better-error-reporting: 4/6] Handle incoming connection failures in the same way as for outgoing.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713006-better-error-reporting: 4/6] Handle incoming connection failures in the same way as for outgoing.
- Date: Sun, 12 Nov 2017 11:23:51 +0000 (UTC)
commit c27ad286518d855fb5ac6d0aabbaaad62761dbf6
Author: Michael James Gratton <mike vee net>
Date: Thu Nov 9 17:50:57 2017 +1100
Handle incoming connection failures in the same way as for outgoing.
* src/client/application/geary-controller.vala
(GearyController::report_problem): Replace connection failure dialog
with use of an info bar.
* src/client/components/main-window-info-bar.vala (MainWindowInfoBar):
Add new infobar type for incoming mail errors.
* src/engine/api/geary-account.vala (Account.Problem): Rename
CONNECTION_FAILURE to RECV_EMAIL_ERROR to be consistent with
SEND_EMAIL_ERROR, update uses.
src/client/application/geary-controller.vala | 13 ++-----------
src/client/components/main-window-info-bar.vala | 7 +++++++
src/engine/api/geary-account.vala | 4 +++-
.../imap-engine/imap-engine-generic-account.vala | 2 +-
src/engine/imap/api/imap-account.vala | 4 ++--
5 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 910af28..5cecdcf 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -877,18 +877,10 @@ public class GearyController : Geary.BaseObject {
debug("Reported problem: %s Error: %s", problem.to_string(), err != null ? err.message : "(N/A)");
switch (problem) {
- case Geary.Account.Problem.CONNECTION_FAILURE:
- ErrorDialog dialog = new ErrorDialog(
- main_window,
- _("Error connecting to the server"),
- _("Geary encountered an error while connecting to the server. Please try again in a few
moments.")
- );
- dialog.run();
- break;
-
case Geary.Account.Problem.DATABASE_FAILURE:
case Geary.Account.Problem.HOST_UNREACHABLE:
case Geary.Account.Problem.NETWORK_UNAVAILABLE:
+ case Geary.Account.Problem.RECV_EMAIL_ERROR:
case Geary.Account.Problem.RECV_EMAIL_LOGIN_FAILED:
case Geary.Account.Problem.SEND_EMAIL_ERROR:
case Geary.Account.Problem.SEND_EMAIL_LOGIN_FAILED:
@@ -914,12 +906,11 @@ public class GearyController : Geary.BaseObject {
private void on_retry_problem(MainWindowInfoBar info_bar) {
switch (info_bar.problem) {
+ case Geary.Account.Problem.RECV_EMAIL_ERROR:
case Geary.Account.Problem.RECV_EMAIL_LOGIN_FAILED:
break;
case Geary.Account.Problem.SEND_EMAIL_ERROR:
- break;
-
case Geary.Account.Problem.SEND_EMAIL_LOGIN_FAILED:
break;
diff --git a/src/client/components/main-window-info-bar.vala b/src/client/components/main-window-info-bar.vala
index a5a6691..6c3579f 100644
--- a/src/client/components/main-window-info-bar.vala
+++ b/src/client/components/main-window-info-bar.vala
@@ -72,6 +72,13 @@ public class MainWindowInfoBar : Gtk.InfoBar {
show_close = true;
break;
+ case Geary.Account.Problem.RECV_EMAIL_ERROR:
+ type = Gtk.MessageType.ERROR;
+ title = _("A problem occurred checking for new mail");
+ descr = _("New messages can not be received for %s, try again in a moment").printf(name);
+ retry = _("Retry checking for new mail");
+ break;
+
case Geary.Account.Problem.RECV_EMAIL_LOGIN_FAILED:
title = _("Incoming mail password required");
descr = _("Messages cannot be received for %s without the correct password.").printf(name);
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index bd3145e..2655831 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -26,11 +26,13 @@ public abstract class Geary.Account : BaseObject {
/** Number of times to attempt re-authentication. */
internal const uint AUTH_ATTEMPTS_MAX = 3;
+
+ /** Describes problem types that are reported to the client. */
public enum Problem {
- CONNECTION_FAILURE,
DATABASE_FAILURE,
HOST_UNREACHABLE,
NETWORK_UNAVAILABLE,
+ RECV_EMAIL_ERROR,
RECV_EMAIL_LOGIN_FAILED,
SEND_EMAIL_DELIVERY_FAILURE,
SEND_EMAIL_ERROR,
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala
b/src/engine/imap-engine/imap-engine-generic-account.vala
index be64f58..f085b4b 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -433,7 +433,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
}
} catch (Error err) {
if (!(err is IOError.CANCELLED)) {
- report_problem(Geary.Account.Problem.CONNECTION_FAILURE, err);
+ report_problem(Geary.Account.Problem.RECV_EMAIL_ERROR, err);
}
}
diff --git a/src/engine/imap/api/imap-account.vala b/src/engine/imap/api/imap-account.vala
index 050992d..46218ee 100644
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@ -662,7 +662,7 @@ private class Geary.Imap.Account : BaseObject {
// Either the server was unavailable, or we were unable to
// parse the login response. Either way, indicate a
// non-login error.
- report_problem(Geary.Account.Problem.CONNECTION_FAILURE, login_error);
+ report_problem(Geary.Account.Problem.RECV_EMAIL_ERROR, login_error);
} else {
// Now, we should ask the user for their password
this.account.fetch_passwords_async.begin(
@@ -677,7 +677,7 @@ private class Geary.Imap.Account : BaseObject {
report_problem(Geary.Account.Problem.RECV_EMAIL_LOGIN_FAILED, null);
}
} catch (Error err) {
- report_problem(Geary.Account.Problem.CONNECTION_FAILURE, err);
+ report_problem(Geary.Account.Problem.RECV_EMAIL_ERROR, err);
}
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]