diff --git a/anime-game-core b/anime-game-core index ccb2f20..02b1fab 160000 --- a/anime-game-core +++ b/anime-game-core @@ -1 +1 @@ -Subproject commit ccb2f2082ad278cce946ebd960e4a065368babaf +Subproject commit 02b1fabc36807b1e9411ff32f84a991fbcbc949b diff --git a/assets/ui/main.blp b/assets/ui/main.blp index 10e3a99..ecc879f 100644 --- a/assets/ui/main.blp +++ b/assets/ui/main.blp @@ -20,6 +20,15 @@ Adw.ApplicationWindow window { title-widget: Adw.WindowTitle { title: "An Anime Game Launcher"; }; + + [end] + Gtk.MenuButton menu { + menu-model: app_menu; + icon-name: "open-menu-symbolic"; + halign: end; + valign: center; + margin-start: 12; + } } Adw.StatusPage status_page { @@ -101,3 +110,18 @@ Adw.ApplicationWindow window { } }; } + +Gtk.AboutDialog about { + program-name: "An Anime Game Launcher"; + + logo: "resource:///org/app/assets/images/icon.png"; + website: "https://gitlab.com/an-anime-team/alternatives/an-anime-game-launcher-gtk"; + + modal: true; + transient-for: window; +} + +menu app_menu { + item ("Check for updates") + item ("About", "show-about-dialog.show-about-dialog") +} diff --git a/assets/ui/preferences_general.blp b/assets/ui/preferences_general.blp index a2320c0..bb6c572 100644 --- a/assets/ui/preferences_general.blp +++ b/assets/ui/preferences_general.blp @@ -128,7 +128,6 @@ Adw.PreferencesPage general_page { Adw.ComboRow dxvk_selected { title: "Selected version"; - subtitle: "WIP: does nothing as for now"; } Adw.ActionRow { diff --git a/blueprint-compiler b/blueprint-compiler index 30f0dee..50db59f 160000 --- a/blueprint-compiler +++ b/blueprint-compiler @@ -1 +1 @@ -Subproject commit 30f0deea34851aa6fbb4f8a5dcd9216f5ac714f9 +Subproject commit 50db59f2d2c88fe0ee2fc979e11e7c989eaa07da diff --git a/src/main.rs b/src/main.rs index 8b4e497..7526d86 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,9 @@ pub mod lib; use ui::*; +pub const APP_ID: &str = "com.gitlab.an-anime-team.an-anime-game-launcher-gtk"; +pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); + #[tokio::main] async fn main() { gtk::init().expect("GTK initialization failed"); @@ -19,7 +22,7 @@ async fn main() { // Create app let application = gtk::Application::new( - Some("com.gitlab.an-anime-team.an-anime-game-launcher-gtk"), + Some(APP_ID), Default::default() ); diff --git a/src/ui/main.rs b/src/ui/main.rs index 921b143..fdc678b 100644 --- a/src/ui/main.rs +++ b/src/ui/main.rs @@ -29,6 +29,9 @@ pub struct AppWidgets { pub window: adw::ApplicationWindow, pub toast_overlay: adw::ToastOverlay, + pub menu: gtk::MenuButton, + pub about: gtk::AboutDialog, + pub leaflet: adw::Leaflet, pub status_page: adw::StatusPage, pub launcher_content: adw::PreferencesPage, @@ -54,6 +57,9 @@ impl AppWidgets { window: window.clone(), toast_overlay: toast_overlay.clone(), + menu: get_object(&builder, "menu")?, + about: get_object(&builder, "about")?, + leaflet: get_object(&builder, "leaflet")?, status_page: get_object(&builder, "status_page")?, launcher_content: get_object(&builder, "launcher_content")?, @@ -68,6 +74,18 @@ impl AppWidgets { preferences_stack: PreferencesStack::new(window, toast_overlay)? }; + // Set default About Dialog values + result.about.set_version(Some(crate::APP_VERSION)); + result.about.set_license_type(gtk::License::Gpl30); + + result.about.set_authors(&[ + "Nikita Podvirnyy " + ]); + + result.about.set_system_information(Some(&[ + format!("Anime Game core library version: {}", anime_game_core::VERSION) + ].join("\n"))); + // Add preferences page to the leaflet result.leaflet.append(&result.preferences_stack.preferences).set_name(Some("preferences_page")); @@ -145,6 +163,10 @@ impl App { /// Add default events and values to the widgets fn init_events(self) -> Self { + add_action(&self.widgets.menu, "show-about-dialog", clone!(@strong self.widgets.about as about => move || { + about.show(); + })); + // Open preferences page self.widgets.open_preferences.connect_clicked(Actions::OpenPreferencesPage.into_fn(&self));