h-gtk: Show error notifications when OPML import fails.
This commit is contained in:
parent
118dac5a1a
commit
ccd3e3ab2c
@ -19,7 +19,6 @@ use std::rc::Rc;
|
|||||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
RefreshAllViews,
|
RefreshAllViews,
|
||||||
@ -205,11 +204,8 @@ impl App {
|
|||||||
}
|
}
|
||||||
Ok(Action::ErrorNotification(err)) => {
|
Ok(Action::ErrorNotification(err)) => {
|
||||||
error!("An error notification was triggered: {}", err);
|
error!("An error notification was triggered: {}", err);
|
||||||
// FIXME: this is not good user-facing messages.
|
|
||||||
// should match on the error type and return a proper description of the Error.
|
|
||||||
let text = &err;
|
|
||||||
let callback = || glib::Continue(false);
|
let callback = || glib::Continue(false);
|
||||||
let notif = InAppNotification::new(text, callback, || {}, UndoState::Hidden);
|
let notif = InAppNotification::new(&err, callback, || {}, UndoState::Hidden);
|
||||||
notif.show(&overlay);
|
notif.show(&overlay);
|
||||||
}
|
}
|
||||||
Err(_) => (),
|
Err(_) => (),
|
||||||
|
|||||||
@ -269,10 +269,17 @@ fn on_import_clicked(window: >k::Window, sender: &Sender<Action>) {
|
|||||||
// Refresh the succesfully parsed feeds to index them
|
// Refresh the succesfully parsed feeds to index them
|
||||||
utils::refresh(Some(sources), sender)
|
utils::refresh(Some(sources), sender)
|
||||||
} else {
|
} else {
|
||||||
// TODO: Show an in-app notification if file can not be parsed
|
let text = String::from("Failed to parse the Imported file");
|
||||||
error!("Failed to parse the Import file")
|
sender.send(Action::ErrorNotification(text))
|
||||||
|
.map_err(|err| error!("Action Sender: {}", err))
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
} else {
|
||||||
|
let text = String::from("Selected File could not be accessed.");
|
||||||
|
sender.send(Action::ErrorNotification(text))
|
||||||
|
.map_err(|err| error!("Action Sender: {}", err))
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user