[geary/wip/714104-refine-account-dialog] Implement basic support for disabling accounts
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/714104-refine-account-dialog] Implement basic support for disabling accounts
- Date: Sun, 9 Dec 2018 08:28:27 +0000 (UTC)
commit 48559f28fe590eab4aeeb036a7d04ac9ac38e927
Author: Michael Gratton <mike vee net>
Date: Sun Dec 9 19:26:58 2018 +1100
Implement basic support for disabling accounts
src/client/accounts/accounts-editor-list-pane.vala | 27 ++++++++++++++++++----
src/client/accounts/accounts-manager.vala | 7 ++++++
2 files changed, 29 insertions(+), 5 deletions(-)
---
diff --git a/src/client/accounts/accounts-editor-list-pane.vala
b/src/client/accounts/accounts-editor-list-pane.vala
index 131610e5..95b764fd 100644
--- a/src/client/accounts/accounts-editor-list-pane.vala
+++ b/src/client/accounts/accounts-editor-list-pane.vala
@@ -372,17 +372,34 @@ private class Accounts.AccountListRow : AccountRow<EditorListPane,Gtk.Grid> {
}
public void update_status(Manager.Status status) {
- if (status != Manager.Status.UNAVAILABLE) {
- this.unavailable_icon.hide();
+ bool enabled = false;
+ switch (status) {
+ case ENABLED:
+ enabled = true;
this.set_tooltip_text("");
- } else {
- this.unavailable_icon.show();
+ break;
+
+ case DISABLED:
this.set_tooltip_text(
+ // Translators: Tooltip for accounts that have been
+ // loaded by disabled by the user.
+ _("This account has been disabled")
+ );
+ break;
+
+ case UNAVAILABLE:
+ this.set_tooltip_text(
+ // Translators: Tooltip for accounts that have been
+ // loaded but because of some error are not able to be
+ // used.
_("This account has encountered a problem and is unavailable")
);
+ break;
}
- if (status == Manager.Status.ENABLED) {
+ this.unavailable_icon.set_visible(!enabled);
+
+ if (enabled) {
this.label.get_style_context().remove_class(
Gtk.STYLE_CLASS_DIM_LABEL
);
diff --git a/src/client/accounts/accounts-manager.vala b/src/client/accounts/accounts-manager.vala
index be2db840..e3c20ac6 100644
--- a/src/client/accounts/accounts-manager.vala
+++ b/src/client/accounts/accounts-manager.vala
@@ -656,6 +656,13 @@ public class Accounts.Manager : GLib.Object {
}
}
+ // If the account has been marked as disabled, mark it as such
+ // and bail out.
+ if (status == Status.DISABLED) {
+ set_enabled(account, false);
+ throw new ConfigError.UNAVAILABLE("Account disabled");
+ }
+
return account;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]