melib: add Failure to RefreshEventKind
parent
0812242f60
commit
c2c5f2db69
|
@ -94,6 +94,7 @@ pub enum RefreshEventKind {
|
|||
Create(Box<Envelope>),
|
||||
Remove(FolderHash),
|
||||
Rescan,
|
||||
Failure(MeliError),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -355,7 +355,12 @@ impl Account {
|
|||
}));
|
||||
Some(w)
|
||||
}
|
||||
pub fn reload(&mut self, event: RefreshEvent, folder_hash: FolderHash) -> Option<UIEvent> {
|
||||
pub fn reload(
|
||||
&mut self,
|
||||
event: RefreshEvent,
|
||||
folder_hash: FolderHash,
|
||||
sender: &chan::Sender<crate::types::ThreadEvent>,
|
||||
) -> Option<UIEvent> {
|
||||
if !self.folders[&folder_hash].is_available() {
|
||||
self.event_queue.push_back((folder_hash, event));
|
||||
return None;
|
||||
|
@ -424,6 +429,13 @@ impl Account {
|
|||
);
|
||||
self.workers.insert(folder_hash, handle);
|
||||
}
|
||||
RefreshEventKind::Failure(e) => {
|
||||
debug!("RefreshEvent Failure: {}", e.to_string());
|
||||
let sender = sender.clone();
|
||||
self.watch(RefreshEventConsumer::new(Box::new(move |r| {
|
||||
sender.send(crate::types::ThreadEvent::from(r));
|
||||
})));
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
|
@ -277,7 +277,9 @@ impl State {
|
|||
self.context.replies.push_back(UIEvent::from(event));
|
||||
return;
|
||||
}
|
||||
if let Some(notification) = self.context.accounts[idxa].reload(event, hash) {
|
||||
if let Some(notification) =
|
||||
self.context.accounts[idxa].reload(event, hash, &self.context.sender)
|
||||
{
|
||||
if let UIEvent::Notification(_, _) = notification {
|
||||
self.context
|
||||
.replies
|
||||
|
|
Loading…
Reference in New Issue