use glib::{Continue, Sender}; use gtk::prelude::*; use std::{ env, sync::{Arc, RwLock}, }; mod app_window; use app_window::ApplicationWindow; mod config; mod playlist_card; use playlist_card::PlaylistCard; mod types; use types::PlaybackState; #[derive(Clone, Debug)] pub enum Message {} #[derive(Clone)] pub struct Core { tx: Arc>>>, } pub fn main() { gio::resources_register_include!("com.luminescent-dreams.gm-control-panel.gresource") .expect("Failed to register resource"); let app = adw::Application::builder() .application_id("com.luminescent-dreams.gm-control-panel") .build(); let runtime = tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .unwrap(); let core = Core { tx: Arc::new(RwLock::new(None)), }; app.connect_activate(move |app| { let (gtk_tx, gtk_rx) = gtk::glib::MainContext::channel::(gtk::glib::PRIORITY_DEFAULT); *core.tx.write().unwrap() = Some(gtk_tx); let window = ApplicationWindow::new(app); window.window.present(); gtk_rx.attach(None, move |_msg| Continue(true)); }); let args: Vec = env::args().collect(); ApplicationExtManual::run_with_args(&app, &args); runtime.shutdown_background(); }