From 894c68338ddd399e22985da84c6fc9ff98e9c2ef Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 2 Oct 2025 13:19:58 -0500 Subject: [PATCH] update formats --- src/core/model.rs | 8 ++++++-- src/main.rs | 38 ++++++++++++++++++++------------------ src/ui/library.rs | 1 - 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/core/model.rs b/src/core/model.rs index 2ebf1b4..2b0bd7c 100644 --- a/src/core/model.rs +++ b/src/core/model.rs @@ -1,4 +1,8 @@ -use std::{borrow::Cow, mem::replace, path::{Path, PathBuf}}; +use std::{ + borrow::Cow, + mem::replace, + path::{Path, PathBuf}, +}; use cosmic::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes}; use miette::{IntoDiagnostic, Result, miette}; @@ -44,7 +48,7 @@ impl TryFrom<(Vec, String)> for KindWrapper { "application/service-item" => { ron::de::from_bytes(&data).into_diagnostic() } - _ => Err(miette!("Wrong mime type: {mime}")) + _ => Err(miette!("Wrong mime type: {mime}")), } } } diff --git a/src/main.rs b/src/main.rs index 82cad1e..7858a52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -870,7 +870,9 @@ impl cosmic::Application for App { slide_index, ), ); - if let presenter::Action::Task(task) = action { + if let presenter::Action::Task(task) = + action + { tasks.push(task.map(|m| { cosmic::Action::App( Message::Present(m), @@ -891,14 +893,12 @@ impl cosmic::Application for App { { let action = self.presenter.update(presenter::Message::ActivateSlide(self.current_item.0, self.current_item.1)); if let presenter::Action::Task( - task, - ) = action { - tasks - .push(task.map(|m| { + task, + ) = action + { + tasks.push(task.map(|m| { cosmic::Action::App( - Message::Present( - m, - ), + Message::Present(m), ) })); } @@ -924,7 +924,9 @@ impl cosmic::Application for App { slide_index, ), ); - if let presenter::Action::Task(task) = action { + if let presenter::Action::Task(task) = + action + { tasks.push(task.map(|m| { cosmic::Action::App( Message::Present(m), @@ -960,14 +962,12 @@ impl cosmic::Application for App { { let action = self.presenter.update(presenter::Message::ActivateSlide(self.current_item.0, self.current_item.1)); if let presenter::Action::Task( - task, - ) = action { - tasks - .push(task.map(|m| { + task, + ) = action + { + tasks.push(task.map(|m| { cosmic::Action::App( - Message::Present( - m, - ), + Message::Present(m), ) })); } @@ -1056,7 +1056,8 @@ impl cosmic::Application for App { let (id, spawn_window) = window::open(window::Settings { position: Position::Centered, - exit_on_close_request: count.is_multiple_of(2), + exit_on_close_request: count + .is_multiple_of(2), decorations: false, ..Default::default() }); @@ -1797,6 +1798,7 @@ where vec!["application/service-item".into(), "text/uri-list".into(), "x-special/gnome-copied-files".into()], ) .on_finish(move |mime, data, _, _, _| { + match mime.as_str() { "application/service-item" => { let Ok(item) = @@ -1807,7 +1809,7 @@ where }; debug!(?item, index, "adding Service item"); Message::AddServiceItem(index, item) - } + } "text/uri-list" => { let Ok(text) = str::from_utf8(&data) else { return Message::None; diff --git a/src/ui/library.rs b/src/ui/library.rs index 462f8a7..9d0c2ed 100644 --- a/src/ui/library.rs +++ b/src/ui/library.rs @@ -555,7 +555,6 @@ impl<'a> Library { }; if items.contains(&(kind, index)) { - } else { items.push((kind, index)); }