widget/icon: Bundle icons on macOS, not just Windows

This commit is contained in:
Ian Douglas Scott 2026-04-14 11:53:33 -07:00 committed by Michael Murphy
parent 0d69cd9183
commit 46d9f0c344
4 changed files with 10 additions and 8 deletions

View file

@ -4,12 +4,12 @@
//! Embedded icons for platforms which do not support icon themes yet.
/// Icon bundling is not enabled on unix platforms.
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "macos")))]
pub fn get(icon_name: &str) -> Option<super::Data> {
None
}
#[cfg(not(unix))]
#[cfg(any(not(unix), target_os = "macos"))]
/// Get a bundled icon on non-unix platforms.
pub fn get(icon_name: &str) -> Option<super::Data> {
ICONS
@ -17,5 +17,5 @@ pub fn get(icon_name: &str) -> Option<super::Data> {
.map(|bytes| super::Data::Svg(crate::iced::widget::svg::Handle::from_memory(*bytes)))
}
#[cfg(not(unix))]
#[cfg(any(not(unix), target_os = "macos"))]
include!(concat!(env!("OUT_DIR"), "/bundled_icons.rs"));

View file

@ -52,7 +52,7 @@ impl Named {
}
}
#[cfg(not(windows))]
#[cfg(all(unix, not(target_os = "macos")))]
#[must_use]
pub fn path(self) -> Option<PathBuf> {
let name = &*self.name;
@ -107,7 +107,7 @@ impl Named {
result
}
#[cfg(windows)]
#[cfg(any(not(unix), target_os = "macos"))]
#[must_use]
pub fn path(self) -> Option<PathBuf> {
//TODO: implement icon lookup for Windows