diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index a483f1b80..a849631f9 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -108,13 +108,21 @@ impl CompactListing { }); // Get mailbox as a reference. // - loop { - // TODO: Show progress visually - if context.accounts[self.cursor_pos.0] - .status(self.cursor_pos.1) - .is_ok() - { - break; + // TODO: Show progress visually + match context.accounts[self.cursor_pos.0].status(self.cursor_pos.1) { + Ok(_) => {} + Err(_) => { + self.content = CellBuffer::new(MAX_COLS, 1, Cell::with_char(' ')); + self.length = 0; + write_string_to_grid( + "Loading.", + &mut self.content, + Color::Default, + Color::Default, + ((0, 0), (MAX_COLS - 1, 0)), + true, + ); + return; } } let mailbox = &context.accounts[self.cursor_pos.0][self.cursor_pos.1] diff --git a/ui/src/state.rs b/ui/src/state.rs index 24ae50f4c..bb39129b1 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -103,7 +103,13 @@ impl Context { } pub fn account_status(&mut self, idx_a: usize, idx_m: usize) -> result::Result { match self.accounts[idx_a].status(idx_m) { - Ok(()) => Ok(true), + Ok(()) => { + self.replies.push_back(UIEvent { + id: 0, + event_type: UIEventType::MailboxUpdate((idx_a, idx_m)), + }); + Ok(true) + } Err(n) => Err(n), } }