summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-12-01 18:25:56 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-12-01 20:03:58 +0200
commit0f86934e16cb2c13aa7df68f16473e5b10186fc7 (patch)
tree8da8a01a4351d2eb89d91b0f7dca311a376c822e
parentc5a5c2666bb32f2bd46a4ccfa465882638a8f068 (diff)
mail/status: display in-progress jobs first
-rw-r--r--src/components/mail/status.rs99
1 files changed, 50 insertions, 49 deletions
diff --git a/src/components/mail/status.rs b/src/components/mail/status.rs
index 53641c22..ca5748b5 100644
--- a/src/components/mail/status.rs
+++ b/src/components/mail/status.rs
@@ -90,6 +90,56 @@ impl Component for AccountStatus {
width = self.content.size().0;
let mut line = 2;
+ write_string_to_grid(
+ "In-progress jobs:",
+ &mut self.content,
+ self.theme_default.fg,
+ self.theme_default.bg,
+ Attr::BOLD,
+ ((1, line), (width - 1, line)),
+ None,
+ );
+ line += 2;
+
+ for (job_id, req) in a.active_jobs.iter() {
+ width = self.content.size().0;
+ use crate::conf::accounts::JobRequest;
+ let (x, y) = write_string_to_grid(
+ &format!("{} {}", req, job_id),
+ &mut self.content,
+ self.theme_default.fg,
+ self.theme_default.bg,
+ self.theme_default.attrs,
+ ((1, line), (width - 1, line)),
+ None,
+ );
+ if let JobRequest::DeleteMailbox { mailbox_hash, .. }
+ | JobRequest::SetMailboxPermissions { mailbox_hash, .. }
+ | JobRequest::SetMailboxSubscription { mailbox_hash, .. }
+ | JobRequest::CopyTo {
+ dest_mailbox_hash: mailbox_hash,
+ ..
+ }
+ | JobRequest::Refresh { mailbox_hash, .. }
+ | JobRequest::Fetch { mailbox_hash, .. } = req
+ {
+ write_string_to_grid(
+ a.mailbox_entries[mailbox_hash].name(),
+ &mut self.content,
+ self.theme_default.fg,
+ self.theme_default.bg,
+ self.theme_default.attrs,
+ ((x + 1, y), (width - 1, y)),
+ None,
+ );
+ }
+
+ line += 1;
+ }
+
+ line += 2;
+ width = self.content.size().0;
+
let (_x, _y) = write_string_to_grid(
"Tag support: ",
&mut self.content,
@@ -322,55 +372,6 @@ impl Component for AccountStatus {
line += 1;
}
}
- line += 2;
-
- width = self.content.size().0;
- write_string_to_grid(
- "In-progress jobs:",
- &mut self.content,
- self.theme_default.fg,
- self.theme_default.bg,
- Attr::BOLD,
- ((1, line), (width - 1, line)),
- None,
- );
- line += 2;
-
- for (job_id, req) in a.active_jobs.iter() {
- width = self.content.size().0;
- use crate::conf::accounts::JobRequest;
- let (x, y) = write_string_to_grid(
- &format!("{} {}", req, job_id),
- &mut self.content,
- self.theme_default.fg,
- self.theme_default.bg,
- self.theme_default.attrs,
- ((1, line), (width - 1, line)),
- None,
- );
- if let JobRequest::DeleteMailbox { mailbox_hash, .. }
- | JobRequest::SetMailboxPermissions { mailbox_hash, .. }
- | JobRequest::SetMailboxSubscription { mailbox_hash, .. }
- | JobRequest::CopyTo {
- dest_mailbox_hash: mailbox_hash,
- ..
- }
- | JobRequest::Refresh { mailbox_hash, .. }
- | JobRequest::Fetch { mailbox_hash, .. } = req
- {
- write_string_to_grid(
- a.mailbox_entries[mailbox_hash].name(),
- &mut self.content,
- self.theme_default.fg,
- self.theme_default.bg,
- self.theme_default.attrs,
- ((x + 1, y), (width - 1, y)),
- None,
- );
- }
-
- line += 1;
- }
/* self.content may have been resized with write_string_to_grid() calls above since it has
* growable set */