chore: update freedesktop-desktop-entry to 0.7.5

This commit is contained in:
wiiznokes 2024-09-09 14:34:36 +02:00 committed by GitHub
parent cf06e14545
commit adc2c7e871
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 22 deletions

8
Cargo.lock generated
View file

@ -929,7 +929,7 @@ dependencies = [
"cosmic-app-list-config",
"cosmic-client-toolkit",
"cosmic-protocols",
"freedesktop-desktop-entry 0.6.2",
"freedesktop-desktop-entry 0.7.5",
"futures",
"i18n-embed 0.14.1",
"i18n-embed-fl 0.8.0",
@ -1313,7 +1313,7 @@ name = "cosmic-panel-button"
version = "0.1.0"
dependencies = [
"cosmic-config",
"freedesktop-desktop-entry 0.6.2",
"freedesktop-desktop-entry 0.7.5",
"libcosmic",
"serde",
"tracing",
@ -2268,9 +2268,9 @@ dependencies = [
[[package]]
name = "freedesktop-desktop-entry"
version = "0.6.2"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33809936d2fa9ac78750c5c04696a7aabdb09f928454957c77a2c8247f5ff98"
checksum = "d83c9c25bc7e0ff18c6fee324db310497622be235fd45c0f7347ab81981a941e"
dependencies = [
"dirs 5.0.1",
"gettext-rs",

View file

@ -58,7 +58,7 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tracing-log = "0.2.0"
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
serde = { version = "1.0.152", features = ["derive"] }
freedesktop-desktop-entry = "0.6.1"
freedesktop-desktop-entry = "0.7.5"
[profile.release]
lto = "fat"

View file

@ -588,24 +588,15 @@ where
I: AsRef<str>,
L: AsRef<str>,
{
let srcs = fde::Iter::new(fde::default_paths())
.filter_map(|p| fs::read_to_string(&p).ok().and_then(|e| Some((p, e))))
.collect::<Vec<_>>();
let entries = srcs
.iter()
.filter_map(|(p, data)| DesktopEntry::from_str(p, data, locales).ok())
let entries = fde::Iter::new(fde::default_paths())
.entries(Some(locales))
.collect::<Vec<_>>();
ids.iter()
.map(|id| {
fde::matching::get_best_match(
&[id],
&entries,
fde::matching::MatchAppIdOptions::default(),
)
.unwrap_or(&fde::DesktopEntry::from_appid(id.as_ref()))
.to_owned()
fde::matching::find_entry_from_appid(entries.iter(), id.as_ref())
.unwrap_or(&fde::DesktopEntry::from_appid(id.as_ref()))
.to_owned()
})
.collect_vec()
}
@ -1006,7 +997,7 @@ impl cosmic::Application for CosmicAppList {
}
Message::DndData(file_path) => {
if let Some(DndOffer { dock_item, .. }) = self.dnd_offer.as_mut() {
if let Ok(de) = fde::DesktopEntry::from_path(file_path, &self.locales) {
if let Ok(de) = fde::DesktopEntry::from_path(file_path, Some(&self.locales)) {
self.item_ctr += 1;
*dock_item = Some(DockItem {
id: self.item_ctr,

View file

@ -5,7 +5,7 @@ edition = "2021"
license = "GPL-3.0"
[dependencies]
freedesktop-desktop-entry = "0.6.2"
freedesktop-desktop-entry.workspace = true
libcosmic.workspace = true
tracing-log.workspace = true
tracing-subscriber.workspace = true

View file

@ -154,10 +154,11 @@ pub fn main() -> iced::Result {
let filename = format!("{id}.desktop");
let mut desktop = None;
let locales = get_languages_from_env();
for mut path in freedesktop_desktop_entry::default_paths() {
path.push(&filename);
if let Ok(bytes) = fs::read_to_string(&path) {
if let Ok(entry) = DesktopEntry::from_str(&path, &bytes, &locales) {
if let Ok(entry) = DesktopEntry::from_str(&path, &bytes, Some(&locales)) {
desktop = Some(Desktop {
name: entry
.name(&locales)