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-07-09 15:57:42 +00:00
|
|
|
use gtk::{CssProvider, StyleContext, gdk::Display, STYLE_PROVIDER_PRIORITY_APPLICATION};
|
|
|
|
|
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-07-02 10:18:44 +00:00
|
|
|
use ui::*;
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-07-02 16:03:32 +00:00
|
|
|
// #[tokio::main]
|
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-07-09 15:57:42 +00:00
|
|
|
// Apply CSS styles to the application
|
|
|
|
let provider = CssProvider::new();
|
|
|
|
|
2022-07-10 09:55:49 +00:00
|
|
|
provider.load_from_data(include_bytes!("../assets/styles.css"));
|
2022-07-09 15:57:42 +00:00
|
|
|
|
|
|
|
StyleContext::add_provider_for_display(
|
|
|
|
&Display::default().expect("Could not connect to a display"),
|
|
|
|
&provider,
|
|
|
|
STYLE_PROVIDER_PRIORITY_APPLICATION
|
|
|
|
);
|
|
|
|
|
|
|
|
// Load main window and show it
|
|
|
|
let main = MainApp::new(app).expect("Failed to init MainApp");
|
2022-06-28 21:59:20 +00:00
|
|
|
|
2022-07-09 15:57:42 +00:00
|
|
|
main.show();
|
2022-06-28 21:59:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Run app
|
|
|
|
application.run();
|
|
|
|
}
|