2023-01-18 16:37:53 +00:00
|
|
|
use relm4::prelude::*;
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
use anime_launcher_sdk::config;
|
2022-07-27 15:37:52 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
pub mod i18n;
|
2022-06-29 07:11:19 +00:00
|
|
|
pub mod ui;
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2023-01-19 11:45:03 +00:00
|
|
|
pub const APP_ID: &str = "moe.launcher.an-anime-game-launcher-gtk";
|
|
|
|
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
pub const APP_DEBUG: bool = cfg!(debug_assertions);
|
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
fn main() {
|
|
|
|
tracing_subscriber::fmt()
|
|
|
|
.with_span_events(tracing_subscriber::fmt::format::FmtSpan::FULL)
|
|
|
|
.with_max_level(tracing::Level::TRACE)
|
|
|
|
.init();
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
tracing::info!("Starting application");
|
2022-07-26 08:57:12 +00:00
|
|
|
|
2022-09-24 14:52:31 +00:00
|
|
|
adw::init().expect("Libadwaita initialization failed");
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-07-24 12:02:14 +00:00
|
|
|
// Register and include resources
|
2023-01-18 16:37:53 +00:00
|
|
|
gtk::gio::resources_register_include!("resources.gresource")
|
2022-07-24 12:02:14 +00:00
|
|
|
.expect("Failed to register resources");
|
|
|
|
|
2022-07-26 15:34:46 +00:00
|
|
|
// Set application's title
|
2023-01-18 16:37:53 +00:00
|
|
|
gtk::glib::set_application_name("An Anime Game Launcher");
|
|
|
|
gtk::glib::set_program_name(Some("An Anime Game Launcher"));
|
2022-10-31 13:53:30 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
// Set UI language
|
|
|
|
unsafe {
|
|
|
|
i18n::LANG = config::get().unwrap().launcher.language.parse().unwrap();
|
2023-01-19 11:50:54 +00:00
|
|
|
|
|
|
|
tracing::info!("Set UI language to {}", i18n::LANG);
|
2023-01-18 16:37:53 +00:00
|
|
|
}
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
// Run the app
|
|
|
|
let app = RelmApp::new("moe.launcher.an-anime-game-launcher");
|
2022-07-24 13:01:59 +00:00
|
|
|
|
2023-01-18 16:37:53 +00:00
|
|
|
app.run::<ui::main::App>(());
|
2022-06-28 21:59:20 +00:00
|
|
|
}
|