mail/status.rs: don't show all background jobs

Information can be retrieved from :manage-jobs tab, so it's redundant to
repeat it here.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/425/head
Manos Pitsidianakis 4 months ago
parent e96e9789db
commit 5b6c1aa88c
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -105,9 +105,15 @@ impl AccountStatus {
);
line += 2;
for (job_id, req) in a.active_jobs.iter() {
let mut total = a.active_jobs.len();
if let Some((job_id, req)) = a
.active_jobs
.iter()
.find(|(_, req)| matches!(req, JobRequest::Watch { .. }))
{
total -= 1;
let area = self.content.area().skip(1, line);
let (x, y) = self.content.grid_mut().write_string(
self.content.grid_mut().write_string(
&format!("{} {}", req, job_id),
self.theme_default.fg,
self.theme_default.bg,
@ -116,15 +122,19 @@ impl AccountStatus {
None,
None,
);
if let JobRequest::DeleteMailbox { mailbox_hash, .. }
| JobRequest::SetMailboxPermissions { mailbox_hash, .. }
| JobRequest::SetMailboxSubscription { mailbox_hash, .. }
| JobRequest::Refresh { mailbox_hash, .. }
| JobRequest::Fetch { mailbox_hash, .. } = req
{
let area = self.content.area().skip(x + 1, y + line);
line += 1;
}
if a.active_jobs.is_empty() || total != 0 {
let area = self.content.area().skip(1, line);
self.content.grid_mut().write_string(
a.mailbox_entries[mailbox_hash].name(),
&if a.active_jobs.is_empty() && total == 0 {
Cow::Borrowed("None.")
} else if total == a.active_jobs.len() {
Cow::Owned(format!("{} tasks", total))
} else {
Cow::Owned(format!("and other {} tasks", total))
},
self.theme_default.fg,
self.theme_default.bg,
self.theme_default.attrs,
@ -132,13 +142,9 @@ impl AccountStatus {
None,
None,
);
}
line += 1;
}
line += 2;
let area = self.content.area().skip(1, line);
let (_x, _y) = self.content.grid_mut().write_string(
"Tag support: ",

Loading…
Cancel
Save