From 3b8ec109384ef82e2c2065586733d5b30763dfc9 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Sun, 9 Apr 2023 18:56:13 +0200 Subject: [PATCH] feat(ui): fixed app version display in changelog --- src/ui/about.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/ui/about.rs b/src/ui/about.rs index e590d08..163adeb 100644 --- a/src/ui/about.rs +++ b/src/ui/about.rs @@ -1,12 +1,19 @@ use relm4::prelude::*; use gtk::prelude::*; -use crate::APP_VERSION; use anime_launcher_sdk::VERSION as SDK_VERSION; use anime_launcher_sdk::anime_game_core::VERSION as CORE_VERSION; use crate::*; +lazy_static::lazy_static! { + pub static ref APP_VERSION: String = if crate::APP_DEBUG && !crate::APP_VERSION.contains('-') { + format!("{}-dev", crate::APP_VERSION) + } else { + crate::APP_VERSION.to_string() + }; +} + #[derive(Debug)] pub struct AboutDialog { visible: bool @@ -33,17 +40,7 @@ impl SimpleComponent for AboutDialog { set_issue_url: "https://github.com/an-anime-team/an-anime-game-launcher/issues", set_license_type: gtk::License::Gpl30, - - set_version: &{ - // Debug build & build's version doesn't contain any suffix (-dev, -beta, etc) - if crate::APP_DEBUG && !APP_VERSION.contains('-') { - format!("{APP_VERSION}-dev") - } - - else { - APP_VERSION.to_string() - } - }, + set_version: &APP_VERSION, set_developers: &[ "Nikita Podvirnyy https://github.com/krypt0nn" @@ -79,7 +76,7 @@ impl SimpleComponent for AboutDialog { format!("cairo: {}", gtk::cairo::version_string()), ].join("\n"), - set_release_notes_version: APP_VERSION, + set_release_notes_version: &APP_VERSION, set_release_notes: &[ "

Added

",