spawn with idle priority
This commit is contained in:
@ -30,7 +30,9 @@ impl<W: glib::IsA<gtk::Widget>> SpawnWithToast for W {
|
|||||||
.ancestor(adw::ToastOverlay::static_type())
|
.ancestor(adw::ToastOverlay::static_type())
|
||||||
.and_downcast();
|
.and_downcast();
|
||||||
let win: Option<NotifyWindow> = self.ancestor(NotifyWindow::static_type()).and_downcast();
|
let win: Option<NotifyWindow> = self.ancestor(NotifyWindow::static_type()).and_downcast();
|
||||||
glib::MainContext::default().spawn_local(async move {
|
glib::MainContext::ref_thread_default().spawn_local_with_priority(
|
||||||
|
glib::Priority::DEFAULT_IDLE,
|
||||||
|
async move {
|
||||||
if let Err(e) = f.await {
|
if let Err(e) = f.await {
|
||||||
if let Some(o) = toast_overlay
|
if let Some(o) = toast_overlay
|
||||||
.as_ref()
|
.as_ref()
|
||||||
@ -39,7 +41,8 @@ impl<W: glib::IsA<gtk::Widget>> SpawnWithToast for W {
|
|||||||
o.add_toast(adw::Toast::builder().title(&e.to_string()).build())
|
o.add_toast(adw::Toast::builder().title(&e.to_string()).build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user