[geary/wip/714104-refine-account-dialog: 9/15] Update account nickname in AccountsEditorListPane when it changes
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/714104-refine-account-dialog: 9/15] Update account nickname in AccountsEditorListPane when it changes
- Date: Fri, 19 Oct 2018 23:50:39 +0000 (UTC)
commit 53e97f91d3f9322a33110ea04630212163ea47e2
Author: Michael Gratton <mike vee net>
Date: Sat Sep 8 21:55:31 2018 +1000
Update account nickname in AccountsEditorListPane when it changes
src/client/accounts/accounts-editor-list-pane.vala | 30 +++++++++++++++-------
1 file changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/client/accounts/accounts-editor-list-pane.vala
b/src/client/accounts/accounts-editor-list-pane.vala
index f5798bde..4f3ad517 100644
--- a/src/client/accounts/accounts-editor-list-pane.vala
+++ b/src/client/accounts/accounts-editor-list-pane.vala
@@ -210,7 +210,7 @@ internal class Accounts.EditorListPane : Gtk.Grid, EditorPane {
Manager.Status status) {
AccountListRow? row = get_account_row(account);
if (row != null) {
- row.update(status);
+ row.update_status(status);
}
}
@@ -291,14 +291,28 @@ private class Accounts.AccountListRow : EditorRow<EditorListPane> {
this.layout.add(this.account_name);
this.layout.add(this.account_details);
- update(status);
+ this.account.information_changed.connect(on_account_changed);
+ update_nickname();
+ update_status(status);
+ }
+
+ ~AccountListRow() {
+ this.account.information_changed.disconnect(on_account_changed);
}
public override void activated(EditorListPane pane) {
pane.show_existing_account(this.account);
}
- public void update(Manager.Status status) {
+ public void update_nickname() {
+ string name = this.account.nickname;
+ if (Geary.String.is_empty(name)) {
+ name = account.primary_mailbox.to_address_display("", "");
+ }
+ this.account_name.set_text(name);
+ }
+
+ public void update_status(Manager.Status status) {
if (status != Manager.Status.UNAVAILABLE) {
this.unavailable_icon.hide();
this.set_tooltip_text("");
@@ -309,12 +323,6 @@ private class Accounts.AccountListRow : EditorRow<EditorListPane> {
);
}
- string name = this.account.nickname;
- if (Geary.String.is_empty(name)) {
- name = account.primary_mailbox.to_address_display("", "");
- }
- this.account_name.set_text(name);
-
string? details = this.account.service_label;
switch (account.service_provider) {
case Geary.ServiceProvider.GMAIL:
@@ -348,6 +356,10 @@ private class Accounts.AccountListRow : EditorRow<EditorListPane> {
}
}
+ private void on_account_changed() {
+ update_nickname();
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]