fix: compile errors on windows

calendar.rs had some left over icon! macro_rules macros referencing now
deleted files.

bundle::get was defined twice on non-unix platforms.

A known remaining issue is that projects using libcosmic need to have
cosmic-icons in their project root, since the crabtime macro uses
crabtime::WORKSPACE_PATH rather than the path to wherever cargo puts
libcosmic's git submodule.

See: 639326fcc3
This commit is contained in:
Kyle Scheuing 2025-11-26 01:25:27 -05:00 committed by Ashley Wulber
parent 639326fcc3
commit 62f661e077
2 changed files with 13 additions and 15 deletions

View file

@ -117,19 +117,6 @@ where
Message: Clone + 'static,
{
fn from(this: Calendar<'a, Message>) -> Self {
macro_rules! icon {
($name:expr, $on_press:expr) => {{
#[cfg(target_os = "linux")]
let icon = { icon::from_name($name).apply(button::icon) };
#[cfg(not(target_os = "linux"))]
let icon = {
icon::from_svg_bytes(include_bytes!(concat!("../../res/icons/", $name, ".svg")))
.symbolic(true)
.apply(button::icon)
};
icon.padding([0, 12]).on_press($on_press)
}};
}
macro_rules! translate_month {
($month:expr, $year:expr) => {{
match $month {
@ -170,8 +157,18 @@ where
.size(18);
let month_controls = row::with_capacity(2)
.push(icon!("go-previous-symbolic", (this.on_prev)()))
.push(icon!("go-next-symbolic", (this.on_next)()));
.push(
icon::from_name("go-previous-symbolic")
.apply(button::icon)
.padding([0, 12])
.on_press((this.on_prev)()),
)
.push(
icon::from_name("go-next-symbolic")
.apply(button::icon)
.padding([0, 12])
.on_press((this.on_next)()),
);
// Calender
let mut calendar_grid: Grid<'_, Message> =

View file

@ -4,6 +4,7 @@
//! Embedded icons for platforms which do not support icon themes yet.
/// Icon bundling is not enabled on unix platforms.
#[cfg(unix)]
pub fn get(icon_name: &str) -> Option<super::Data> {
None
}