diff --git a/src/main.rs b/src/main.rs index ea989fb..9237ae8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ mod ui_code; const APP_ID: &str = "net.nickiel.joystick-controller-client"; fn main() -> glib::ExitCode { + // set the environment var to make gtk use window's default action bar env::set_var("gtk_csd", "0"); if let Err(e) = SimpleLogger::init(simplelog::LevelFilter::Debug, simplelog::Config::default()) @@ -24,19 +25,17 @@ fn main() -> glib::ExitCode { let rt = runtime::Runtime::new().expect("Could not start tokio runtime"); let handle = rt.handle().clone(); - // Create a new application let app = Application::builder().application_id(APP_ID).build(); - // Connect to "activate" signal of `app` app.connect_startup(|_| load_css()); + app.connect_activate(move |app| { ui_code::build_ui(app, handle.clone()); }); - // Run the application let exit_code = app.run(); - info!("Closing down"); + info!("Gtk application has closed"); rt.block_on(async {});