Show correct version in about dialog

This commit is contained in:
Avery
2023-11-18 21:31:12 -05:00
parent e686b5d974
commit e59ced9bfa
4 changed files with 18 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ config = configure_file(
'APP_ID': app_id,
'BUILDDIR': meson.project_build_root(),
'PKGDATADIR': pkgdatadir,
'VERSION': version,
},
)

View File

@@ -1,7 +1,7 @@
use gtk::prelude::*;
use relm4::{prelude::*, ComponentParts, SimpleComponent};
use crate::meson_config::APP_ID;
use crate::meson_config::{APP_ID, VERSION};
pub(crate) struct About;
@@ -18,7 +18,7 @@ impl SimpleComponent for About {
) {
set_modal: true,
set_visible: true,
set_version: "0.0",
set_version: VERSION,
}
}

View File

@@ -3,3 +3,4 @@
pub const APP_ID: &str = "@APP_ID@";
pub const BUILDDIR: &str = "@BUILDDIR@";
pub const RESOURCES_FILE: &str = concat!("@PKGDATADIR@", "/resources.gresource");
pub const VERSION: &str = "@VERSION@";

View File

@@ -4,6 +4,7 @@ project(
version: '0.1.0',
# bad hack to compile libvideo-player-mpv
subproject_dir: 'video_player_mpv',
meson_version: '>= 0.59',
)
dependency('gtk4', version: '>= 4.0.0')
@@ -18,6 +19,19 @@ else
app_id = base_id
endif
version = meson.project_version()
if get_option('profile') == 'dev'
vcs_tag = run_command(
'git', 'rev-parse', '--short', 'HEAD',
check: false,
).stdout().strip()
if vcs_tag == ''
version += '-devel'
else
version += f'-@vcs_tag@'
endif
endif
if get_option('flatpak')
meson.add_dist_script(
'build-aux/dist-vendor',