big refactor and cleanup of dock + use tokio mpsc
This commit is contained in:
parent
346701b16d
commit
35eb571528
14 changed files with 578 additions and 674 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use glib;
|
||||
use gtk4::glib;
|
||||
use std::future::Future;
|
||||
|
||||
use crate::DockObject;
|
||||
use crate::Item;
|
||||
|
|
@ -20,3 +21,18 @@ pub fn data_path() -> PathBuf {
|
|||
path.push("data.json");
|
||||
path
|
||||
}
|
||||
|
||||
pub fn _thread_context() -> glib::MainContext {
|
||||
glib::MainContext::thread_default().unwrap_or_else(|| {
|
||||
let ctx = glib::MainContext::new();
|
||||
ctx.push_thread_default();
|
||||
ctx
|
||||
})
|
||||
}
|
||||
|
||||
pub fn _block_on<F>(future: F) -> F::Output
|
||||
where
|
||||
F: Future,
|
||||
{
|
||||
_thread_context().block_on(future)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue