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 hammond_data::Podcast;
|
||||||
|
|
||||||
|
use appnotif::{InAppNotification, UndoState};
|
||||||
use headerbar::Header;
|
use headerbar::Header;
|
||||||
use settings::{self, WindowGeometry};
|
use settings::{self, WindowGeometry};
|
||||||
use stacks::{Content, PopulatedState};
|
use stacks::{Content, PopulatedState};
|
||||||
@ -18,7 +19,8 @@ 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;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[allow(dead_code)]
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
RefreshAllViews,
|
RefreshAllViews,
|
||||||
RefreshEpisodesView,
|
RefreshEpisodesView,
|
||||||
@ -34,6 +36,7 @@ pub enum Action {
|
|||||||
HeaderBarHideUpdateIndicator,
|
HeaderBarHideUpdateIndicator,
|
||||||
MarkAllPlayerNotification(Arc<Podcast>),
|
MarkAllPlayerNotification(Arc<Podcast>),
|
||||||
RemoveShow(Arc<Podcast>),
|
RemoveShow(Arc<Podcast>),
|
||||||
|
ErrorNotification(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -200,6 +203,15 @@ impl App {
|
|||||||
let notif = remove_show_notif(pd, sender.clone());
|
let notif = remove_show_notif(pd, sender.clone());
|
||||||
notif.show(&overlay);
|
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(_) => (),
|
Err(_) => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ use gtk::prelude::*;
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum UndoState {
|
pub enum UndoState {
|
||||||
Shown,
|
Shown,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user