diff --git a/Cargo.toml b/Cargo.toml index 6ccf57d1..74195a21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ default = ["dbus-config", "multi-window", "a11y"] # Accessibility support a11y = ["iced/a11y", "iced_accessibility"] # Enable about widget -about = ["dep:license"] +about = [] # Builds support for animated images animated-image = ["dep:async-fs", "image/gif", "tokio?/io-util", "tokio?/fs"] # XXX autosize should not be used on winit windows unless dialogs @@ -122,7 +122,6 @@ image = { version = "0.25.8", default-features = false, features = [ "png", ] } libc = { version = "0.2.175", optional = true } -license = { version = "3.7.0", optional = true } mime = { version = "0.3.17", optional = true } palette = "0.7.6" raw-window-handle = "0.6" diff --git a/src/app/context_drawer.rs b/src/app/context_drawer.rs index 5d15d7b4..b33d2ba6 100644 --- a/src/app/context_drawer.rs +++ b/src/app/context_drawer.rs @@ -15,11 +15,11 @@ pub struct ContextDrawer<'a, Message: Clone + 'static> { } #[cfg(feature = "about")] -pub fn about( - about: &crate::widget::about::About, - on_url_press: impl Fn(String) -> Message, +pub fn about<'a, Message: Clone + 'static>( + about: &'a crate::widget::about::About, + on_url_press: impl Fn(&'a str) -> Message + 'a, on_close: Message, -) -> ContextDrawer<'_, Message> { +) -> ContextDrawer<'a, Message> { context_drawer(crate::widget::about(about, on_url_press), on_close) } diff --git a/src/widget/about.rs b/src/widget/about.rs index f1f84106..f1538d8f 100644 --- a/src/widget/about.rs +++ b/src/widget/about.rs @@ -1,10 +1,7 @@ -use { - crate::{ - Element, fl, - iced::{Alignment, Length}, - widget::{self, horizontal_space}, - }, - license::License, +use crate::{ + Element, fl, + iced::{Alignment, Length}, + widget::{self, horizontal_space}, }; #[derive(Debug, Default, Clone, derive_setters::Setters)] @@ -96,21 +93,12 @@ impl<'a> About { .collect(); self } - - fn get_license_url(&self) -> Option { - self.license_url.clone().or_else(|| { - self.license.as_ref().and_then(|license_str| { - let license: &dyn License = license_str.parse().ok()?; - Some(format!("https://spdx.org/licenses/{}.html", license.id())) - }) - }) - } } /// Constructs the widget for the about section. pub fn about<'a, Message: Clone + 'static>( about: &'a About, - on_url_press: impl Fn(String) -> Message, + on_url_press: impl Fn(&'a str) -> Message + 'a, ) -> Element<'a, Message> { let cosmic_theme::Spacing { space_xxs, space_m, .. @@ -131,7 +119,7 @@ pub fn about<'a, Message: Clone + 'static>( .align_y(Alignment::Center), ) .class(crate::theme::Button::Link) - .on_press(on_url_press(url.clone())) + .on_press(on_url_press(url)) .width(Length::Fill) .into() }) @@ -157,7 +145,7 @@ pub fn about<'a, Message: Clone + 'static>( let translators_section = section(&about.translators, fl!("translators")); let documenters_section = section(&about.documenters, fl!("documenters")); let license = about.license.as_ref().map(|license| { - let url = about.get_license_url(); + let url = about.license_url.as_deref(); widget::settings::section().title(fl!("license")).add( widget::button::custom( widget::row()