2022-06-28 21:59:20 +00:00
|
|
|
use gtk4::{self as gtk, prelude::*};
|
2022-06-29 07:11:19 +00:00
|
|
|
use libadwaita::{self as adw, prelude::*};
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-06-29 07:11:19 +00:00
|
|
|
pub mod ui;
|
2022-06-30 19:40:25 +00:00
|
|
|
pub mod lib;
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-06-29 07:11:19 +00:00
|
|
|
use ui::MainApp;
|
2022-06-28 21:59:20 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
gtk::init().expect("GTK initialization failed");
|
|
|
|
adw::init();
|
|
|
|
|
|
|
|
// Create app
|
|
|
|
let application = gtk::Application::new(
|
|
|
|
Some("com.gitlab.an-anime-team.an-anime-game-launcher"),
|
|
|
|
Default::default()
|
|
|
|
);
|
|
|
|
|
|
|
|
// Init app window and show it
|
|
|
|
application.connect_activate(|app| {
|
2022-06-29 15:58:48 +00:00
|
|
|
let app = MainApp::new(app).unwrap();
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-07-01 18:12:25 +00:00
|
|
|
let app_copy = app.clone();
|
|
|
|
|
2022-06-28 21:59:20 +00:00
|
|
|
app.open_preferences.connect_clicked(move |_| {
|
2022-07-01 18:12:25 +00:00
|
|
|
if let Err(err) = app_copy.open_preferences_page() {
|
|
|
|
app_copy.toast_error("Failed to open settings page", err);
|
|
|
|
}
|
2022-06-28 21:59:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
app.window.show();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Run app
|
|
|
|
application.run();
|
|
|
|
}
|