[geary/wip/714104-refine-account-dialog: 174/180] Show GOA panel when user selects disabled GOA account in accounts list



commit 35428d1fb5d82a31e29202601ca2473c8c8e362a
Author: Michael Gratton <mike vee net>
Date:   Sat Nov 17 12:07:43 2018 +1100

    Show GOA panel when user selects disabled GOA account in accounts list

 src/client/accounts/accounts-editor-list-pane.vala | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/client/accounts/accounts-editor-list-pane.vala 
b/src/client/accounts/accounts-editor-list-pane.vala
index c54afb14..3165bb83 100644
--- a/src/client/accounts/accounts-editor-list-pane.vala
+++ b/src/client/accounts/accounts-editor-list-pane.vala
@@ -303,7 +303,28 @@ private class Accounts.AccountListRow : EditorRow<EditorListPane> {
     }
 
     public override void activated(EditorListPane pane) {
-        pane.show_existing_account(this.account);
+        Manager manager = pane.accounts;
+        if (manager.is_goa_account(this.account) &&
+            manager.get_status(this.account) != Manager.Status.ENABLED) {
+            // GOA account but it's disabled, so just take people
+            // directly to the GOA panel
+            manager.show_goa_account.begin(
+                account, null,
+                (obj, res) => {
+                    try {
+                        manager.show_goa_account.end(res);
+                    } catch (GLib.Error err) {
+                        // XXX display an error to the user
+                        debug(
+                            "Failed to show GOA account \"%s\": %s",
+                            account.id,
+                            err.message
+                        );
+                    }
+                });
+        } else {
+            pane.show_existing_account(this.account);
+        }
     }
 
     public void update_nickname() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]