InAppNotification: Fix autohiding after the callback is executed.
This commit is contained in:
parent
064879c4ce
commit
dbbb4e589e
@ -35,14 +35,18 @@ impl Default for InAppNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl InAppNotification {
|
impl InAppNotification {
|
||||||
pub fn new<F>(text: String, callback: F, sender: Sender<Action>) -> Self
|
pub fn new<F>(text: String, mut callback: F, sender: Sender<Action>) -> Self
|
||||||
where
|
where
|
||||||
F: FnMut() -> glib::Continue + 'static,
|
F: FnMut() -> glib::Continue + 'static,
|
||||||
{
|
{
|
||||||
let notif = InAppNotification::default();
|
let notif = InAppNotification::default();
|
||||||
notif.text.set_text(&text);
|
notif.text.set_text(&text);
|
||||||
|
|
||||||
let id = timeout_add_seconds(6, callback);
|
let revealer = notif.revealer.clone();
|
||||||
|
let id = timeout_add_seconds(6, move || {
|
||||||
|
revealer.set_reveal_child(false);
|
||||||
|
callback()
|
||||||
|
});
|
||||||
let id = Rc::new(RefCell::new(Some(id)));
|
let id = Rc::new(RefCell::new(Some(id)));
|
||||||
|
|
||||||
// Cancel the callback
|
// Cancel the callback
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user