app.rs: Add an action for showing error notification.
This commit is contained in:
parent
7035fe05c4
commit
118dac5a1a
@ -8,6 +8,7 @@ use gtk::SettingsExt as GtkSettingsExt;
|
||||
|
||||
use hammond_data::Podcast;
|
||||
|
||||
use appnotif::{InAppNotification, UndoState};
|
||||
use headerbar::Header;
|
||||
use settings::{self, WindowGeometry};
|
||||
use stacks::{Content, PopulatedState};
|
||||
@ -18,7 +19,8 @@ use std::rc::Rc;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Action {
|
||||
RefreshAllViews,
|
||||
RefreshEpisodesView,
|
||||
@ -34,6 +36,7 @@ pub enum Action {
|
||||
HeaderBarHideUpdateIndicator,
|
||||
MarkAllPlayerNotification(Arc<Podcast>),
|
||||
RemoveShow(Arc<Podcast>),
|
||||
ErrorNotification(String),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -200,6 +203,15 @@ impl App {
|
||||
let notif = remove_show_notif(pd, sender.clone());
|
||||
notif.show(&overlay);
|
||||
}
|
||||
Ok(Action::ErrorNotification(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 notif = InAppNotification::new(text, callback, || {}, UndoState::Hidden);
|
||||
notif.show(&overlay);
|
||||
}
|
||||
Err(_) => (),
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ use gtk::prelude::*;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum UndoState {
|
||||
Shown,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user