From fcaf6c7e30b48f4d1857f9303a78f9a87b402336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Vojinovi=C4=87?= <150025636+git-f0x@users.noreply.github.com> Date: Sat, 24 Jan 2026 16:49:12 +0100 Subject: [PATCH] chore: update dependencies --- Cargo.lock | 190 +++++++++++++++---------------------- Cargo.toml | 21 ++-- src/app.rs | 16 ++-- src/archive.rs | 1 + src/operation/mod.rs | 24 ++--- src/operation/reader.rs | 2 +- src/operation/recursive.rs | 2 +- src/tab.rs | 30 +++--- src/thumbnailer.rs | 15 ++- 9 files changed, 136 insertions(+), 165 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index affa134..385b532 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -976,9 +976,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.54" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "jobserver", @@ -1457,8 +1457,6 @@ dependencies = [ "fastrand 2.3.0", "flate2", "fork", - "freedesktop_entry_parser", - "futures", "gio", "glib", "glob", @@ -1575,8 +1573,8 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.16.0" -source = "git+https://github.com/pop-os/cosmic-text.git#ee702e50901d90cd842dbd88154687bd2512b52c" +version = "0.17.0" +source = "git+https://github.com/pop-os/cosmic-text.git#bdd6657fd7268dc8882214f540a6150eb78cfae0" dependencies = [ "bitflags 2.10.0", "fontdb 0.23.0", @@ -1584,10 +1582,10 @@ dependencies = [ "linebender_resource_handle", "log", "rangemap", - "rustc-hash 1.1.0", + "rustc-hash 2.1.1", "self_cell", - "skrifa 0.39.0", - "smol_str", + "skrifa 0.36.0", + "smol_str 0.3.5", "swash", "sys-locale", "unicode-bidi", @@ -1736,38 +1734,14 @@ dependencies = [ "winapi", ] -[[package]] -name = "darling" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" -dependencies = [ - "darling_core 0.20.11", - "darling_macro 0.20.11", -] - [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core 0.21.3", - "darling_macro 0.21.3", -] - -[[package]] -name = "darling_core" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.114", + "darling_core", + "darling_macro", ] [[package]] @@ -1784,24 +1758,13 @@ dependencies = [ "syn 2.0.114", ] -[[package]] -name = "darling_macro" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" -dependencies = [ - "darling_core 0.20.11", - "quote", - "syn 2.0.114", -] - [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core 0.21.3", + "darling_core", "quote", "syn 2.0.114", ] @@ -1841,11 +1804,11 @@ dependencies = [ [[package]] name = "derive_setters" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae5c625eda104c228c06ecaf988d1c60e542176bd7a490e60eeda3493244c0c9" +checksum = "b7e6f6fa1f03c14ae082120b84b3c7fbd7b8588d924cf2d7c3daf9afd49df8b9" dependencies = [ - "darling 0.20.11", + "darling", "proc-macro2", "quote", "syn 2.0.114", @@ -2302,9 +2265,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixed_decimal" @@ -2406,6 +2369,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "font-types" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02a596f5713680923a2080d86de50fe472fb290693cf0f701187a1c8b36996b7" +dependencies = [ + "bytemuck", +] + [[package]] name = "font-types" version = "0.10.1" @@ -2527,16 +2499,6 @@ dependencies = [ "xdg", ] -[[package]] -name = "freedesktop_entry_parser" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db9c27b72f19a99a895f8ca89e2d26e4ef31013376e56fdafef697627306c3e4" -dependencies = [ - "nom 7.1.3", - "thiserror 1.0.69", -] - [[package]] name = "fsevent-sys" version = "4.1.0" @@ -2972,14 +2934,14 @@ dependencies = [ [[package]] name = "harfrust" -version = "0.4.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0caaee032384c10dd597af4579c67dee16650d862a9ccbe1233ff1a379abc07" +checksum = "75a4c970f1a00edc1626f1e3cc039492b15b73df28b9fff70f95404a571b4fae" dependencies = [ "bitflags 2.10.0", "bytemuck", "core_maths", - "read-fonts 0.36.0", + "read-fonts 0.34.0", "smallvec", ] @@ -3200,7 +3162,7 @@ dependencies = [ "raw-window-handle", "rustc-hash 2.1.1", "serde", - "smol_str", + "smol_str 0.2.2", "thiserror 1.0.69", "web-time", "window_clipboard", @@ -3835,7 +3797,7 @@ dependencies = [ "rgb", "tiff", "zune-core 0.5.1", - "zune-jpeg 0.5.11", + "zune-jpeg 0.5.12", ] [[package]] @@ -4947,9 +4909,9 @@ dependencies = [ [[package]] name = "notify-debouncer-full" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375bd3a138be7bfeff3480e4a623df4cbfb55b79df617c055cd810ba466fa078" +checksum = "c02b49179cfebc9932238d04d6079912d26de0379328872846118a0fa0dbb302" dependencies = [ "file-id", "log", @@ -5002,9 +4964,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-derive" @@ -6155,6 +6117,17 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "read-fonts" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8941f8e9d5f8ad3aebea330d01ac68c0167600eb31a86ecd86e97be4d13b51f5" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.9.0", +] + [[package]] name = "read-fonts" version = "0.35.0" @@ -6162,18 +6135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358" dependencies = [ "bytemuck", - "font-types", -] - -[[package]] -name = "read-fonts" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eaa2941a4c05443ee3a7b26ab076a553c343ad5995230cc2b1d3e993bdc6345" -dependencies = [ - "bytemuck", - "core_maths", - "font-types", + "font-types 0.10.1", ] [[package]] @@ -6638,7 +6600,7 @@ version = "3.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" dependencies = [ - "darling 0.21.3", + "darling", "proc-macro2", "quote", "syn 2.0.114", @@ -6721,6 +6683,16 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" +[[package]] +name = "skrifa" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37004372610e83ee2a4c69c7d896b41f33da6a3dc1a4fe07dd9b2629a549b1dc" +dependencies = [ + "bytemuck", + "read-fonts 0.34.0", +] + [[package]] name = "skrifa" version = "0.37.0" @@ -6731,16 +6703,6 @@ dependencies = [ "read-fonts 0.35.0", ] -[[package]] -name = "skrifa" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9eb0b904a04d09bd68c65d946617b8ff733009999050f3b851c32fb3cfb60e" -dependencies = [ - "bytemuck", - "read-fonts 0.36.0", -] - [[package]] name = "slab" version = "0.4.11" @@ -6837,6 +6799,12 @@ dependencies = [ "serde", ] +[[package]] +name = "smol_str" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f7a918bd2a9951d18ee6e48f076843e8e73a9a5d22cf05bcd4b7a81bdd04e17" + [[package]] name = "socket2" version = "0.4.10" @@ -7211,9 +7179,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" dependencies = [ "deranged", "itoa", @@ -7227,15 +7195,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" dependencies = [ "num-conv", "time-core", @@ -7791,9 +7759,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ "wit-bindgen", ] @@ -8811,7 +8779,7 @@ dependencies = [ "rustix 0.38.44", "sctk-adwaita", "smithay-client-toolkit 0.19.2", - "smol_str", + "smol_str 0.2.2", "tracing", "unicode-segmentation", "wasm-bindgen", @@ -8848,9 +8816,9 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" [[package]] name = "write16" @@ -9245,18 +9213,18 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" [[package]] name = "zerocopy" -version = "0.8.35" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.35" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" dependencies = [ "proc-macro2", "quote", @@ -9450,9 +9418,9 @@ dependencies = [ [[package]] name = "zune-jpeg" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2959ca473aae96a14ecedf501d20b3608d2825ba280d5adb57d651721885b0c2" +checksum = "410e9ecef634c709e3831c2cfdb8d9c32164fae1c67496d5b68fff728eec37fe" dependencies = [ "zune-core 0.5.1", ] diff --git a/Cargo.toml b/Cargo.toml index 89e2156..6c6e6ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "1.0.4" authors = ["Jeremy Soller "] edition = "2024" license = "GPL-3.0-only" -rust-version = "1.85" +rust-version = "1.90" [dependencies] anyhow = "1" @@ -14,8 +14,6 @@ cctk = { git = "https://github.com/pop-os/cosmic-protocols", package = "cosmic-c cosmic-mime-apps = { git = "https://github.com/pop-os/cosmic-mime-apps.git", optional = true } dirs = "6.0.0" env_logger = "0.11" -freedesktop_entry_parser = "1.3" -futures = "0.3.31" gio = { version = "0.21", optional = true } glib = { version = "0.21", optional = true } glob = "0.3" @@ -24,9 +22,9 @@ image = "0.25" libc = "0.2" log = "0.4" mime_guess = "2" -notify-debouncer-full = "0.6" +notify-debouncer-full = "0.7" notify-rust = { version = "4", optional = true } -open = "5.3.2" +open = "5.3.3" paste = "1.0" regex = "1" rustc-hash = "2.1" @@ -38,15 +36,15 @@ tokio = { version = "1", features = ["process", "sync"] } trash = { git = "https://github.com/jackpot51/trash-rs.git", branch = "cosmic" } url = "2.5" walkdir = "2.5.0" -wayland-client = { version = "0.31.11", optional = true } +wayland-client = { version = "0.31.12", optional = true } xdg = { version = "3.0", optional = true } xdg-mime = { git = "https://github.com/ebassi/xdg-mime-rs" } # Compression bzip2 = { version = "0.6", optional = true } #TODO: replace with pure Rust crate flate2 = "1.1" tar = "0.4.44" -lzma-rust2 = { version = "0.15.4", optional = true } -ordermap = { version = "1.0.0", features = ["serde"] } +lzma-rust2 = { version = "0.15.7", optional = true } +ordermap = { version = "1.1.0", features = ["serde"] } # Internationalization i18n-embed = { version = "0.16", features = [ "fluent-system", @@ -54,10 +52,10 @@ i18n-embed = { version = "0.16", features = [ ] } i18n-embed-fl = "0.10" rust-embed = "8" -slotmap = "1.0.7" +slotmap = "1.1.1" recently-used-xbel = { git = "https://github.com/pop-os/recently-used-xbel.git" } zip = "7" -uzers = "0.12.1" +uzers = "0.12.2" md-5 = "0.10.6" png = "0.18" jxl-oxide = { version = "0.12.5", features = ["image"] } @@ -76,6 +74,7 @@ default-features = false features = [ "about", "autosize", + "desktop", "multi-window", "tokio", "winit", @@ -107,7 +106,7 @@ default = [ "wayland", ] dbus-config = ["libcosmic/dbus-config"] -desktop = ["libcosmic/desktop", "dep:cosmic-mime-apps", "dep:xdg"] +desktop = ["dep:cosmic-mime-apps", "dep:xdg"] desktop-applet = [] gvfs = ["dep:gio", "dep:glib"] io-uring = ["compio/io-uring"] diff --git a/src/app.rs b/src/app.rs index a85b098..52eddca 100644 --- a/src/app.rs +++ b/src/app.rs @@ -18,7 +18,9 @@ use cosmic::{ Application, ApplicationExt, Element, app::{self, Core, Task, context_drawer}, cosmic_config::{self, ConfigSet}, - cosmic_theme, executor, + cosmic_theme, + desktop::fde::DesktopEntry, + executor, iced::{ self, Alignment, Event, Length, Rectangle, Size, Subscription, clipboard::dnd::DndAction, @@ -72,10 +74,10 @@ use crate::{ FxOrderMap, clipboard::{ClipboardCopy, ClipboardKind, ClipboardPaste}, config::{ - AppTheme, Config, DesktopConfig, Favorite, IconSizes, TIME_CONFIG_ID, TabConfig, + AppTheme, Config, DesktopConfig, Favorite, IconSizes, State, TIME_CONFIG_ID, TabConfig, TimeConfig, TypeToSearch, }, - dialog::{Dialog, DialogKind, DialogMessage, DialogResult}, + dialog::{Dialog, DialogKind, DialogMessage, DialogResult, DialogSettings}, fl, home_dir, key_bind::key_binds, localize::LANGUAGE_SORTER, @@ -91,10 +93,6 @@ use crate::{ tab::{ self, HOVER_DURATION, HeadingOptions, ItemMetadata, Location, SORT_OPTION_FALLBACK, Tab, }, -}; -use crate::{ - config::State, - dialog::DialogSettings, zoom::{zoom_in_view, zoom_out_view, zoom_to_default}, }; @@ -846,8 +844,8 @@ impl App { fn launch_desktop_entries(paths: &[impl AsRef]) { for path in paths.iter().map(AsRef::as_ref) { - match freedesktop_entry_parser::parse_entry(path) { - Ok(entry) => match entry.section("Desktop Entry").attr("Exec") { + match DesktopEntry::from_path::<&str>(path, None) { + Ok(entry) => match entry.exec() { Some(exec) => match mime_app::exec_to_command(exec, &[] as &[&str; 0]) { Some(commands) => { for mut command in commands { diff --git a/src/archive.rs b/src/archive.rs index 8684bb8..7374941 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -2,6 +2,7 @@ use crate::{ mime_icon::mime_for_path, operation::{Controller, OpReader, OperationError, OperationErrorType, sync_to_disk}, }; +use cosmic::iced::futures; use std::{ collections::HashSet, fs, diff --git a/src/operation/mod.rs b/src/operation/mod.rs index 208d09a..d17ef5d 100644 --- a/src/operation/mod.rs +++ b/src/operation/mod.rs @@ -5,7 +5,7 @@ use crate::{ spawn_detached::spawn_detached, tab, }; -use cosmic::iced::futures::{SinkExt, channel::mpsc::Sender}; +use cosmic::iced::futures::{self, SinkExt, StreamExt, channel::mpsc::Sender, stream}; use std::{ borrow::Cow, fmt::Formatter, @@ -200,23 +200,25 @@ pub async fn sync_to_disk( written_files: Vec, target_dirs: std::collections::HashSet, ) { - use futures::{StreamExt, stream}; - // Sync files to disk - let file_stream = stream::iter(written_files.into_iter().map(|path| async move { + stream::iter(written_files.into_iter().map(|path| async move { if let Ok(file) = compio::fs::OpenOptions::new().write(true).open(&path).await { let _ = file.sync_all().await; } - })); - file_stream.buffer_unordered(32).collect::>().await; + })) + .buffer_unordered(32) + .collect::>() + .await; // Sync directories to disk - let dir_stream = stream::iter(target_dirs.into_iter().map(|path| async move { + stream::iter(target_dirs.into_iter().map(|path| async move { if let Ok(dir) = compio::fs::OpenOptions::new().read(true).open(&path).await { let _ = dir.sync_all().await; } - })); - dir_stream.buffer_unordered(16).collect::>().await; + })) + .buffer_unordered(16) + .collect::>() + .await; } fn copy_unique_path(from: &Path, to: &Path) -> PathBuf { @@ -1208,7 +1210,7 @@ mod tests { path::PathBuf, }; - use cosmic::iced::futures::{StreamExt, channel::mpsc}; + use cosmic::iced::futures::{StreamExt, channel::mpsc, future}; use log::debug; use test_log::test; use tokio::sync; @@ -1262,7 +1264,7 @@ mod tests { } }; - futures::future::join(handle_messages, handle_copy).await.1 + future::join(handle_messages, handle_copy).await.1 } #[test(compio::test)] diff --git a/src/operation/reader.rs b/src/operation/reader.rs index 6447a1e..75088df 100644 --- a/src/operation/reader.rs +++ b/src/operation/reader.rs @@ -27,7 +27,7 @@ impl OpReader { impl io::Read for OpReader { fn read(&mut self, buf: &mut [u8]) -> io::Result { - futures::executor::block_on(async { + cosmic::iced::futures::executor::block_on(async { self.controller .check() .await diff --git a/src/operation/recursive.rs b/src/operation/recursive.rs index 953a874..076a4b2 100644 --- a/src/operation/recursive.rs +++ b/src/operation/recursive.rs @@ -322,7 +322,7 @@ impl Op { } } - let (from_file, metadata, mut to_file) = futures::try_join!( + let (from_file, metadata, mut to_file) = cosmic::iced::futures::try_join!( async { compio::fs::OpenOptions::new() .read(true) diff --git a/src/tab.rs b/src/tab.rs index 430176a..8b6faa7 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -1,5 +1,8 @@ +use chrono::{Datelike, Timelike, Utc}; use cosmic::{ - Apply, Element, cosmic_theme, font, + Apply, Element, cosmic_theme, + desktop::fde::{DesktopEntry, get_languages_from_env}, + font, iced::{ Alignment, Border, @@ -37,8 +40,6 @@ use cosmic::{ menu::{action::MenuAction, key_bind::KeyBind}, }, }; - -use chrono::{Datelike, Timelike, Utc}; use i18n_embed::LanguageLoader; use icu::{ datetime::{ @@ -615,7 +616,8 @@ pub fn fs_kind(_metadata: &Metadata) -> FsKind { } fn get_desktop_file_display_name(path: &Path) -> Option { - let entry = match freedesktop_entry_parser::parse_entry(path) { + let locales = get_languages_from_env(); + let entry = match DesktopEntry::from_path(path, Some(&locales)) { Ok(ok) => ok, Err(err) => { log::warn!("failed to parse {}: {}", path.display(), err); @@ -623,14 +625,11 @@ fn get_desktop_file_display_name(path: &Path) -> Option { } }; - entry - .section("Desktop Entry") - .attr("Name") - .map(str::to_string) + entry.name(&locales).map(|s| s.into_owned()) } fn get_desktop_file_icon(path: &Path) -> Option { - let entry = match freedesktop_entry_parser::parse_entry(path) { + let entry = match DesktopEntry::from_path::<&str>(path, None) { Ok(ok) => ok, Err(err) => { log::warn!("failed to parse {}: {}", path.display(), err); @@ -638,10 +637,7 @@ fn get_desktop_file_icon(path: &Path) -> Option { } }; - entry - .section("Desktop Entry") - .attr("Icon") - .map(str::to_string) + entry.icon().map(str::to_string) } /// Creates an icon handle from a desktop file's Icon field value. @@ -656,17 +652,17 @@ fn desktop_icon_handle(icon: &str, size: u16) -> widget::icon::Handle { } pub fn parse_desktop_file(path: &Path) -> (Option, Option) { - let entry = match freedesktop_entry_parser::parse_entry(path) { + let locales = get_languages_from_env(); + let entry = match DesktopEntry::from_path(path, Some(&locales)) { Ok(ok) => ok, Err(err) => { log::warn!("failed to parse {}: {}", path.display(), err); return (None, None); } }; - let section = entry.section("Desktop Entry"); ( - section.attr("Name").map(str::to_string), - section.attr("Icon").map(str::to_string), + entry.name(&locales).map(|s| s.into_owned()), + entry.icon().map(str::to_string), ) } diff --git a/src/thumbnailer.rs b/src/thumbnailer.rs index 8a22ba9..f996f03 100644 --- a/src/thumbnailer.rs +++ b/src/thumbnailer.rs @@ -1,6 +1,7 @@ // Copyright 2023 System76 // SPDX-License-Identifier: GPL-3.0-only +use cosmic::desktop::fde::GenericEntry; use mime_guess::Mime; use rustc_hash::FxHashMap; use std::{ @@ -115,7 +116,7 @@ impl ThumbnailerCache { //TODO: handle directory specific behavior for path in thumbnailer_paths { - let entry = match freedesktop_entry_parser::parse_entry(&path) { + let entry = match GenericEntry::from_path(&path) { Ok(ok) => ok, Err(err) => { log::warn!("failed to parse {}: {}", path.display(), err); @@ -124,12 +125,18 @@ impl ThumbnailerCache { }; //TODO: use TryExec? - let section = entry.section("Thumbnailer Entry"); - let Some(exec) = section.attr("Exec") else { + let Some(section) = entry.group("Thumbnailer Entry") else { + log::warn!( + "missing Thumbnailer Entry section for thumbnailer {}", + path.display() + ); + continue; + }; + let Some(exec) = section.entry("Exec") else { log::warn!("missing Exec attribute for thumbnailer {}", path.display()); continue; }; - let Some(mime_types) = section.attr("MimeType") else { + let Some(mime_types) = section.entry("MimeType") else { log::warn!( "missing MimeType attribute for thumbnailer {}", path.display()