propertiesView: Use decoder format

Use the format that we actually used when decoding.
The mime type is usually derived from the file extension
which might not always be correct.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/132>
This commit is contained in:
Sophie Herold 2023-03-09 22:10:08 +01:00 • committed by Marge Bot
parent f8e64d9805
commit a2a9b4134b
6 changed files with 44 additions and 38 deletions

View file

@ -380,18 +380,6 @@ impl LpPropertiesView {
.unwrap_or_else(|| FALLBACK.to_owned()) // and if we get nothing, use `FALLBACK`
}
#[template_callback]
fn file_type(&self, info: Option<gio::FileInfo>) -> String {
info.and_then(|i| i.content_type())
.map(|t| t.to_string())
.map(|t| {
t.rsplit('/').collect::<Vec<&str>>()[0]
.to_owned()
.to_uppercase()
})
.unwrap_or_else(|| FALLBACK.to_owned())
}
#[template_callback]
fn file_size(&self, info: Option<gio::FileInfo>) -> String {
info.map(|info| {