Add mime types to desktop entry data
This commit is contained in:
parent
8a86f1857f
commit
0a7327c91a
2 changed files with 13 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
pub use freedesktop_desktop_entry::DesktopEntry;
|
||||
pub use mime::Mime;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
ffi::OsStr,
|
||||
|
|
@ -57,6 +58,7 @@ pub struct DesktopEntryData {
|
|||
pub path: Option<PathBuf>,
|
||||
pub categories: String,
|
||||
pub desktop_actions: Vec<DesktopAction>,
|
||||
pub mime_types: Vec<Mime>,
|
||||
pub prefers_dgpu: bool,
|
||||
}
|
||||
|
||||
|
|
@ -182,6 +184,15 @@ impl DesktopEntryData {
|
|||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
mime_types: de
|
||||
.mime_type()
|
||||
.map(|mime_types| {
|
||||
mime_types
|
||||
.split_terminator(';')
|
||||
.filter_map(|mime_type| mime_type.parse::<Mime>().ok())
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
prefers_dgpu: de.prefers_non_default_gpu(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue