use adw::prelude::*;
use adw::AboutDialog;
use gtk4::Widget;
use gtk4::License;
#[derive(Debug, Clone)]
pub struct AboutInfo {
pub app_icon: String,
pub app_name: String,
pub developer_name: String,
pub version: String,
pub release_notes_version: String,
pub release_notes: String,
pub comments: String,
pub website: String,
pub issue_url: String,
pub support_url: String,
pub copyright: String,
pub developers: Vec<String>,
pub artists: Vec<String>,
pub documentation_url: String,
pub font_usage: String,
pub special_thanks: Vec<String>,
pub translator_credits: String,
}
pub fn show_about_dialog(parent: &impl IsA<Widget>, info: AboutInfo) {
let about = AboutDialog::builder()
.application_icon(&info.app_icon)
.application_name(&info.app_name)
.developer_name(&info.developer_name)
.version(&info.version)
.release_notes_version(&info.release_notes_version)
.release_notes(&info.release_notes)
.comments(&info.comments)
.website(&info.website)
.issue_url(&info.issue_url)
.support_url(&info.support_url)
.copyright(&info.copyright)
.license_type(License::Gpl30)
.developers(info.developers)
.artists(info.artists)
.translator_credits(&info.translator_credits)
.build();
about.add_link("Documentation", &info.documentation_url);
about.add_legal_section(
"Fonts",
None,
License::Custom,
Some(&info.font_usage),
);
let thanks_refs: Vec<&str> = info.special_thanks.iter().map(|s| s.as_str()).collect();
about.add_acknowledgement_section(Some("Special thanks to"), &thanks_refs);
about.present(Some(parent));
}