cleanup
This commit is contained in:
parent
5404827e02
commit
936b3c0d81
2 changed files with 4 additions and 20 deletions
|
|
@ -11,14 +11,13 @@ use gtk4::CssProvider;
|
|||
use gtk4::StyleContext;
|
||||
use once_cell::sync::OnceCell;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::future::Future;
|
||||
use tokio::sync::mpsc;
|
||||
use x11rb::rust_connection::RustConnection;
|
||||
use zbus::Connection;
|
||||
use zvariant_derive::Type;
|
||||
|
||||
use crate::dock_list::DockListType;
|
||||
use crate::utils::BoxedWindowList;
|
||||
use crate::utils::{block_on, thread_context, BoxedWindowList};
|
||||
|
||||
use self::dock_object::DockObject;
|
||||
use self::window::Window;
|
||||
|
|
@ -54,21 +53,6 @@ pub struct Item {
|
|||
desktop_entry: String,
|
||||
}
|
||||
|
||||
fn thread_context() -> glib::MainContext {
|
||||
glib::MainContext::thread_default().unwrap_or_else(|| {
|
||||
let ctx = glib::MainContext::new();
|
||||
ctx.push_thread_default();
|
||||
ctx
|
||||
})
|
||||
}
|
||||
|
||||
fn block_on<F>(future: F) -> F::Output
|
||||
where
|
||||
F: Future,
|
||||
{
|
||||
thread_context().block_on(future)
|
||||
}
|
||||
|
||||
fn spawn_zbus(tx: mpsc::Sender<Event>) -> Connection {
|
||||
let connection = block_on(Connection::session()).unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ pub fn data_path() -> PathBuf {
|
|||
path
|
||||
}
|
||||
|
||||
pub fn _thread_context() -> glib::MainContext {
|
||||
pub fn thread_context() -> glib::MainContext {
|
||||
glib::MainContext::thread_default().unwrap_or_else(|| {
|
||||
let ctx = glib::MainContext::new();
|
||||
ctx.push_thread_default();
|
||||
|
|
@ -30,9 +30,9 @@ pub fn _thread_context() -> glib::MainContext {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn _block_on<F>(future: F) -> F::Output
|
||||
pub fn block_on<F>(future: F) -> F::Output
|
||||
where
|
||||
F: Future,
|
||||
{
|
||||
_thread_context().block_on(future)
|
||||
thread_context().block_on(future)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue