chore: update dependencies

This commit is contained in:
Vukašin Vojinović 2026-01-24 16:49:12 +01:00
parent 1e25e7dd69
commit fcaf6c7e30
9 changed files with 136 additions and 165 deletions

View file

@ -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<Path>]) {
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 {

View file

@ -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,

View file

@ -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<PathBuf>,
target_dirs: std::collections::HashSet<PathBuf>,
) {
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::<Vec<_>>().await;
}))
.buffer_unordered(32)
.collect::<Vec<_>>()
.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::<Vec<_>>().await;
}))
.buffer_unordered(16)
.collect::<Vec<_>>()
.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)]

View file

@ -27,7 +27,7 @@ impl OpReader {
impl io::Read for OpReader {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
futures::executor::block_on(async {
cosmic::iced::futures::executor::block_on(async {
self.controller
.check()
.await

View file

@ -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)

View file

@ -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<String> {
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<String> {
}
};
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<String> {
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<String> {
}
};
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<String>, Option<String>) {
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),
)
}

View file

@ -1,6 +1,7 @@
// Copyright 2023 System76 <info@system76.com>
// 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()