chore(about): drop license dependency

Not needed since the application can already give URLs to their license
This commit is contained in:
Michael Aaron Murphy 2025-09-30 22:04:32 +02:00 committed by Michael Murphy
parent ee84ad958f
commit df9df40963
3 changed files with 12 additions and 25 deletions

View file

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

View file

@ -15,11 +15,11 @@ pub struct ContextDrawer<'a, Message: Clone + 'static> {
}
#[cfg(feature = "about")]
pub fn about<Message: Clone + 'static>(
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)
}

View file

@ -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<String> {
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()