Skip to content

Commit

Permalink
chore: update freedesktop-desktop-entry to 0.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes authored Sep 9, 2024
1 parent cf06e14 commit adc2c7e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 6 additions & 15 deletions cosmic-app-list/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion cosmic-panel-button/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cosmic-panel-button/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit adc2c7e

Please sign in to comment.