Skip to content

Commit ede09bc

Browse files
committed
Generate AboutDialog from appdata
1 parent 5ef5e13 commit ede09bc

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
/target
1010
/subprojects/blueprint-compiler
1111
/data/gschemas.compiled
12-
/data/resources/gtk/help-overlay.ui
12+
/data/resources/gtk/help-overlay.ui
13+
/data/resources/de.k_bo.Televido.metainfo.xml

data/meson.build

+13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ appstream_file = i18n.merge_file(
2323
install_dir: get_option('datadir') / 'metainfo',
2424
)
2525

26+
# Setup a translated metainfo file in the resources dir as well
27+
# for use by the about dialog
28+
# based on https://github.com/bragefuglseth/fretboard/blob/cf9e72bf66dfc4fb0b24ba8cf04c7f794191dbc8/data/meson.build#L41-L50
29+
msgfmt = find_program('msgfmt', required: true)
30+
run_command(
31+
msgfmt,
32+
'--xml',
33+
'-d' + meson.project_source_root() / 'po',
34+
'--template=' + BASE_APP_ID + '.metainfo.xml.in',
35+
'--output-file=' + 'resources' / BASE_APP_ID + '.metainfo.xml',
36+
check: true,
37+
)
38+
2639
appstreamcli = find_program('appstreamcli', required: false, disabler: true)
2740
if appstreamcli.found()
2841
test(

meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if get_option('profile') == 'development'
2323
endif
2424
APP_ID = '@0@.@1@'.format(BASE_APP_ID, PROFILE)
2525
else
26-
PROFILE = ''
26+
PROFILE = 'Release'
2727
version_suffix = ''
2828
APP_ID = BASE_APP_ID
2929
endif

src/application.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use gettextrs::gettext;
1313
use smart_default::SmartDefault;
1414

1515
use crate::{
16-
config::{APP_ID, APP_NAME, AUTHOR, ISSUE_URL, PROJECT_URL, VERSION},
16+
config::{APP_ID, PROFILE, VERSION},
1717
launcher::{ExternalProgram, ExternalProgramType, ProgramSelector},
1818
player::{TvPlayer, VideoInfo},
1919
preferences::TvPreferencesDialog,
@@ -307,15 +307,12 @@ impl TvApplication {
307307
}
308308

309309
fn show_about(&self) {
310-
let about = adw::AboutDialog::builder()
311-
.application_name(APP_NAME)
312-
.application_icon(APP_ID)
313-
.developer_name(AUTHOR)
314-
.version(VERSION)
315-
.website(PROJECT_URL)
316-
.issue_url(ISSUE_URL)
317-
.license_type(gtk::License::Gpl30)
318-
.build();
310+
let about = adw::AboutDialog::from_appdata(
311+
"/de/k_bo/televido/de.k_bo.Televido.metainfo.xml",
312+
(PROFILE == "Release").then_some(VERSION),
313+
);
314+
315+
about.set_version(VERSION);
319316

320317
about.present(Some(&self.window()));
321318
}

0 commit comments

Comments
 (0)