diff --git a/hammond-gtk/src/app.rs b/hammond-gtk/src/app.rs index 822fb3c..02cfa75 100644 --- a/hammond-gtk/src/app.rs +++ b/hammond-gtk/src/app.rs @@ -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), RemoveShow(Arc), + 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(_) => (), } diff --git a/hammond-gtk/src/appnotif.rs b/hammond-gtk/src/appnotif.rs index 9c9d5f9..806936c 100644 --- a/hammond-gtk/src/appnotif.rs +++ b/hammond-gtk/src/appnotif.rs @@ -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,