diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/src/components/mail/listing/mod.rs | 9 | ||||
-rw-r--r-- | ui/src/state.rs | 17 |
2 files changed, 16 insertions, 10 deletions
diff --git a/ui/src/components/mail/listing/mod.rs b/ui/src/components/mail/listing/mod.rs index 21863ac6..611de7ab 100644 --- a/ui/src/components/mail/listing/mod.rs +++ b/ui/src/components/mail/listing/mod.rs @@ -21,7 +21,7 @@ use super::*; -use melib::mailbox::backends::BackendOp; +//use melib::mailbox::backends::BackendOp; mod compact; pub use self::compact::*; @@ -220,7 +220,7 @@ impl MailListing { container, &indentations, len, - context.accounts[self.cursor_pos.0].backend.operation(envelope.hash()) + // context.accounts[self.cursor_pos.0].backend.operation(envelope.hash()) ), &mut content, fg_color, @@ -421,7 +421,7 @@ impl MailListing { container: &Container, indentations: &[bool], idx_width: usize, - op: Box<BackendOp>, + //op: Box<BackendOp>, ) -> String { let has_sibling = container.has_sibling(); let has_parent = container.has_parent(); @@ -458,10 +458,13 @@ impl MailListing { if show_subject { s.push_str(&format!("{:.85}", envelope.subject())); } + /* + * Very slow since we have to build all attachments let attach_count = envelope.body(op).count_attachments(); if attach_count > 1 { s.push_str(&format!(" {}∞ ", attach_count - 1)); } + */ s } fn format_date(envelope: &Envelope) -> String { diff --git a/ui/src/state.rs b/ui/src/state.rs index bd4aebbc..c6f85c64 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -80,7 +80,7 @@ pub struct State<W: Write> { startup_thread: Option<chan::Sender<bool>>, - threads: FnvHashMap<thread::ThreadId, thread::JoinHandle<()>>, + threads: FnvHashMap<thread::ThreadId, (chan::Sender<bool>, thread::JoinHandle<()>)>, } impl<W: Write> Drop for State<W> { @@ -131,12 +131,14 @@ impl State<std::io::Stdout> { default => {}, startup_rx.recv() -> _ => { sender.send(ThreadEvent::ThreadJoin(thread::current().id())); - return; + break; } } sender.send(ThreadEvent::UIEvent(UIEventType::StartupCheck)); thread::sleep(dur); } + startup_rx.recv(); + return; }) .unwrap() }; @@ -162,11 +164,11 @@ impl State<std::io::Stdout> { input_thread, }, - startup_thread: Some(startup_tx), + startup_thread: Some(startup_tx.clone()), threads: FnvHashMap::with_capacity_and_hasher(1, Default::default()), }; s.threads - .insert(startup_thread.thread().id(), startup_thread); + .insert(startup_thread.thread().id(), (startup_tx.clone(), startup_thread)); write!( s.stdout(), "{}{}{}", @@ -218,15 +220,16 @@ impl State<std::io::Stdout> { }) .unwrap() }; - self.startup_thread = Some(startup_tx); + self.startup_thread = Some(startup_tx.clone()); self.threads - .insert(startup_thread.thread().id(), startup_thread); + .insert(startup_thread.thread().id(), (startup_tx, startup_thread)); } /// If an owned thread returns a `ThreadEvent::ThreadJoin` event to `State` then it must remove /// the thread from its list and `join` it. pub fn join(&mut self, id: thread::ThreadId) { - let handle = self.threads.remove(&id).unwrap(); + let (tx, handle) = self.threads.remove(&id).unwrap(); + tx.send(true); handle.join().unwrap(); } |