diff --git a/podcasts-gtk/resources/gtk/inapp_notif.ui b/podcasts-gtk/resources/gtk/inapp_notif.ui
index 60cdd4e..46859e8 100644
--- a/podcasts-gtk/resources/gtk/inapp_notif.ui
+++ b/podcasts-gtk/resources/gtk/inapp_notif.ui
@@ -53,20 +53,12 @@ Tobias Bernard
3
6
-
@@ -97,6 +89,24 @@ Tobias Bernard
1
+
+
+ 150
+ True
+ False
+ center
+ center
+ 12
+ 12
+ An in-app action notification
+ start
+
+
+ False
+ False
+ 2
+
+
Undo
@@ -112,7 +122,7 @@ Tobias Bernard
False
False
end
- 2
+ 3
diff --git a/podcasts-gtk/src/app.rs b/podcasts-gtk/src/app.rs
index 545b332..05076a2 100644
--- a/podcasts-gtk/src/app.rs
+++ b/podcasts-gtk/src/app.rs
@@ -17,7 +17,7 @@ use settings::{self, WindowGeometry};
use stacks::{Content, PopulatedState};
use utils;
use widgets::about_dialog;
-use widgets::appnotif::{InAppNotification, State};
+use widgets::appnotif::{InAppNotification, SpinnerState, State};
use widgets::player;
use widgets::show_menu::{mark_all_notif, remove_show_notif, ShowMenu};
@@ -332,6 +332,7 @@ impl App {
let undo_cb: Option = None;
let updater = InAppNotification::new(&txt, 1, callback, undo_cb);
updater.set_close_state(State::Hidden);
+ updater.set_spinner_state(SpinnerState::Active);
let old = self.updater.replace(Some(updater));
old.map(|i| i.destroy());
diff --git a/podcasts-gtk/src/widgets/appnotif.rs b/podcasts-gtk/src/widgets/appnotif.rs
index 8771a75..5814e6c 100644
--- a/podcasts-gtk/src/widgets/appnotif.rs
+++ b/podcasts-gtk/src/widgets/appnotif.rs
@@ -12,12 +12,20 @@ pub(crate) enum State {
Hidden,
}
+#[derive(Debug, Clone, Copy)]
+#[allow(dead_code)]
+pub(crate) enum SpinnerState {
+ Active,
+ Stopped,
+}
+
#[derive(Debug, Clone)]
pub(crate) struct InAppNotification {
revealer: gtk::Revealer,
text: gtk::Label,
undo: gtk::Button,
close: gtk::Button,
+ spinner: gtk::Spinner,
}
impl Default for InAppNotification {
@@ -28,12 +36,14 @@ impl Default for InAppNotification {
let text: gtk::Label = builder.get_object("text").unwrap();
let undo: gtk::Button = builder.get_object("undo").unwrap();
let close: gtk::Button = builder.get_object("close").unwrap();
+ let spinner = builder.get_object("spinner").unwrap();
InAppNotification {
revealer,
text,
undo,
close,
+ spinner,
}
}
}
@@ -121,7 +131,6 @@ impl InAppNotification {
}
}
- #[allow(dead_code)]
pub(crate) fn set_close_state(&self, state: State) {
match state {
State::Shown => self.close.show(),
@@ -129,6 +138,19 @@ impl InAppNotification {
}
}
+ pub(crate) fn set_spinner_state(&self, state: SpinnerState) {
+ match state {
+ SpinnerState::Active => {
+ self.spinner.start();
+ self.spinner.show();
+ }
+ SpinnerState::Stopped => {
+ self.spinner.stop();
+ self.spinner.hide();
+ }
+ }
+ }
+
pub(crate) fn destroy(self) {
self.revealer.destroy();
}