[geary/wip/17-noisy-problem-reports: 2/2] Restart all effected services with a generic service status problem
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/17-noisy-problem-reports: 2/2] Restart all effected services with a generic service status problem
- Date: Mon, 7 Jan 2019 12:49:21 +0000 (UTC)
commit a641ac1e03c2609980322885b50d1055d8677404
Author: Michael Gratton <mike vee net>
Date: Mon Jan 7 23:47:11 2019 +1100
Restart all effected services with a generic service status problem
This stops Geary making the user click retry multiple times when they
have multiple accouts.
src/client/application/geary-controller.vala | 49 ++++++++++++++++------------
1 file changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/src/client/application/geary-controller.vala b/src/client/application/geary-controller.vala
index 986fd008..cb348db2 100644
--- a/src/client/application/geary-controller.vala
+++ b/src/client/application/geary-controller.vala
@@ -3054,29 +3054,38 @@ public class GearyController : Geary.BaseObject {
}
private void on_retry_service_problem(Geary.ClientService.Status type) {
- AccountContext? context = Geary.traverse(this.accounts.values)
- .first_matching((ctx) => (
- ctx.account.current_status.has_service_problem() &&
- (ctx.account.incoming.current_status == type ||
- ctx.account.outgoing.current_status == type)
- )
- );
-
- if (context != null) {
+ bool auth_restarted = false;
+ foreach (AccountContext context in this.accounts.values) {
Geary.Account account = context.account;
- Geary.ClientService service = account.incoming.current_status == type
- ? account.incoming
- : account.outgoing;
-
- switch (type) {
- case AUTHENTICATION_FAILED:
- // Reset so the infobar does not show up again
- context.authentication_failed = false;
- break;
+ if (account.current_status.has_service_problem() &&
+ (account.incoming.current_status == type ||
+ account.outgoing.current_status == type)) {
+
+ Geary.ClientService service =
+ (account.incoming.current_status == type)
+ ? account.incoming
+ : account.outgoing;
+
+ bool restart = true;
+ switch (type) {
+ case AUTHENTICATION_FAILED:
+ if (auth_restarted) {
+ // Only restart at most one at a time, so we
+ // don't attempt to re-auth multiple bad
+ // accounts at once.
+ restart = false;
+ } else {
+ // Reset so the infobar does not show up again
+ context.authentication_failed = false;
+ auth_restarted = true;
+ }
+ break;
+ }
+ if (restart) {
+ service.restart.begin(context.cancellable);
+ }
}
-
- service.restart.begin(context.cancellable);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]