Add version numbers to installation page

This commit is contained in:
Victor Fuentes 2023-04-02 18:37:52 -04:00
parent 9862e7f9fe
commit 8df50cf670
No known key found for this signature in database
GPG Key ID: 0A88B68D6A9ACAE0
2 changed files with 21 additions and 1 deletions

View File

@ -43,6 +43,7 @@ pub struct PkgModel {
summary: Option<String>,
description: Option<String>,
icon: Option<String>,
version: Option<String>,
homepage: Option<String>,
licenses: Vec<License>,
@ -126,6 +127,7 @@ pub struct PkgInitModel {
pub pname: String,
pub summary: Option<String>,
pub description: Option<String>,
pub version: Option<String>,
pub icon: Option<String>,
pub screenshots: Vec<String>,
pub homepage: Option<String>,
@ -297,6 +299,15 @@ impl Component for PkgModel {
#[watch]
set_label: &model.pkg,
},
gtk::Label {
add_css_class: "dim-label",
set_halign: gtk::Align::Start,
set_wrap: true,
set_wrap_mode: pango::WrapMode::WordChar,
set_natural_wrap_mode: gtk::NaturalWrapMode::Word,
#[watch]
set_label: &model.version.clone().unwrap_or_else(|| "Unknown".to_string()),
},
},
},
@ -1011,6 +1022,7 @@ impl Component for PkgModel {
pname: String::default(),
summary: None,
description: None,
version: None,
icon: None,
homepage: None,
licenses: vec![],
@ -1127,6 +1139,7 @@ impl Component for PkgModel {
self.set_pkg(pkgmodel.pkg);
self.set_name(pkgmodel.name);
self.set_icon(pkgmodel.icon);
self.set_version(pkgmodel.version);
self.set_platforms(pkgmodel.platforms);
self.set_maintainers(pkgmodel.maintainers);
self.set_licenses(pkgmodel.licenses);

View File

@ -902,11 +902,12 @@ impl Component for AppModel {
String,
String,
String,
String,
),
_,
> = sqlx::query_as(
r#"
SELECT pname, system, description, longdescription, homepage, license, platforms, maintainers
SELECT pname, version, system, description, longdescription, homepage, license, platforms, maintainers
FROM pkgs JOIN meta ON (pkgs.attribute = meta.attribute) WHERE pkgs.attribute = $1
"#,
)
@ -916,6 +917,7 @@ FROM pkgs JOIN meta ON (pkgs.attribute = meta.attribute) WHERE pkgs.attribute =
if let Ok((
pname,
version,
system,
description,
longdescription,
@ -1154,6 +1156,11 @@ FROM pkgs JOIN meta ON (pkgs.attribute = meta.attribute) WHERE pkgs.attribute =
let out = PkgInitModel {
name,
version: if version.is_empty() {
None
} else {
Some(version.to_string())
},
pname,
summary,
description,