conf/accounts.rs: use mailbox alias if available in MailboxEntry::name()

This commit is contained in:
Manos Pitsidianakis 2020-07-24 22:10:39 +03:00
parent 7744ef1462
commit 989cfcc877
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710
2 changed files with 8 additions and 3 deletions

View File

@ -1165,7 +1165,8 @@ impl Component for Listing {
match account[&mailbox_hash].status { match account[&mailbox_hash].status {
MailboxStatus::Available | MailboxStatus::Parsing(_, _) => format!( MailboxStatus::Available | MailboxStatus::Parsing(_, _) => format!(
"Mailbox: {}, Messages: {}, New: {}", "Mailbox: {}, Messages: {}, New: {}",
account[&mailbox_hash].ref_mailbox.name(), account[&mailbox_hash].name(),
// FIXME
account.collection.get_mailbox(mailbox_hash).len(), account.collection.get_mailbox(mailbox_hash).len(),
account[&mailbox_hash] account[&mailbox_hash]
.ref_mailbox .ref_mailbox
@ -1412,7 +1413,7 @@ impl Listing {
None, None,
); );
let (x, _) = write_string_to_grid( let (x, _) = write_string_to_grid(
mailboxes[&mailbox_idx].name(), context.accounts[a.index].mailbox_entries[&mailbox_idx].name(),
grid, grid,
att.fg, att.fg,
att.bg, att.bg,

View File

@ -130,7 +130,11 @@ impl MailboxEntry {
} }
pub fn name(&self) -> &str { pub fn name(&self) -> &str {
&self.name if let Some(name) = self.conf.mailbox_conf.alias.as_ref() {
name
} else {
&self.ref_mailbox.name()
}
} }
} }