[geary/geary-0.13] Merge branch 'wip/fix-error-on-goa-account-disabled' into 'master'
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/geary-0.13] Merge branch 'wip/fix-error-on-goa-account-disabled' into 'master'
- Date: Wed, 6 Mar 2019 10:07:09 +0000 (UTC)
commit c3c1d9e3a3734d589a7f3a4e1738b146aa4163c7
Author: Michael Gratton <mike vee net>
Date: Wed Mar 6 10:06:37 2019 +0000
Merge branch 'wip/fix-error-on-goa-account-disabled' into 'master'
Fix an error being thrown when an active GOA account is disabled
See merge request GNOME/geary!165
(cherry picked from commit 15285ebeb69524ea93ea6498893342f8c7e35d42)
a2a31d38 Fix an error being thrown when an active GOA account is disabled
1e826e9f Remove obsolete comment
src/client/accounts/accounts-manager.vala | 24 ++++++++++++++----------
src/client/application/goa-mediator.vala | 11 +----------
2 files changed, 15 insertions(+), 20 deletions(-)
---
diff --git a/src/client/accounts/accounts-manager.vala b/src/client/accounts/accounts-manager.vala
index b8bbc982..a46cba55 100644
--- a/src/client/accounts/accounts-manager.vala
+++ b/src/client/accounts/accounts-manager.vala
@@ -784,11 +784,10 @@ public class Accounts.Manager : GLib.Object {
}
private bool is_valid_goa_account(Goa.Object handle) {
- // Goa.Account.mail_disabled doesn't seem to reflect if we get
- // get a valid mail object here, so just rely on that instead.
Goa.Mail? mail = handle.get_mail();
return (
mail != null &&
+ !handle.get_account().mail_disabled &&
!Geary.String.is_empty(mail.imap_host) &&
!Geary.String.is_empty(mail.smtp_host)
);
@@ -838,15 +837,18 @@ public class Accounts.Manager : GLib.Object {
}
private async void update_goa_account(Geary.AccountInformation account,
+ bool is_available,
GLib.Cancellable? cancellable) {
GoaMediator mediator = (GoaMediator) account.mediator;
try {
yield mediator.update(account, cancellable);
- // Update will clear the creds, so make sure they get
- // refreshed
- yield account.load_outgoing_credentials(cancellable);
- yield account.load_incoming_credentials(cancellable);
+ if (is_available) {
+ // Update will clear the creds, so make sure they get
+ // refreshed
+ yield account.load_outgoing_credentials(cancellable);
+ yield account.load_incoming_credentials(cancellable);
+ }
} catch (GLib.Error err) {
report_problem(
new Geary.AccountProblemReport(
@@ -856,9 +858,7 @@ public class Accounts.Manager : GLib.Object {
));
}
- // XXX need to notify the engine that creds may have changed
-
- set_available(account, mediator.is_available);
+ set_available(account, is_available);
}
@@ -929,7 +929,11 @@ public class Accounts.Manager : GLib.Object {
// We already know about this account, so check that it is
// still valid. If not, the account should be disabled,
// not deleted, since it may be re-enabled at some point.
- this.update_goa_account.begin(state.account, null);
+ this.update_goa_account.begin(
+ state.account,
+ is_valid_goa_account(account),
+ null
+ );
} else {
// We haven't created an account for this GOA account
// before, so try doing so now.
diff --git a/src/client/application/goa-mediator.vala b/src/client/application/goa-mediator.vala
index 09a87c44..40a41078 100644
--- a/src/client/application/goa-mediator.vala
+++ b/src/client/application/goa-mediator.vala
@@ -10,15 +10,6 @@
public class GoaMediator : Geary.CredentialsMediator, Object {
- public bool is_available {
- get {
- // Goa.Account.mail_disabled doesn't seem to reflect if we
- // get can get a valid mail object or not, so just rely on
- // actually getting one instead.
- return this.handle.get_mail() != null;
- }
- }
-
private Goa.Object handle;
@@ -111,7 +102,7 @@ public class GoaMediator : Geary.CredentialsMediator, Object {
// password" or "GOA credentials need renewing" or
// something. Connect to the GOA service and wait until we
// hear that needs attention is no longer true.
- return this.is_available;
+ return false;
}
private Geary.Credentials.Method get_auth_method() throws GLib.Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]