refactor(power): remove text from icons

This commit is contained in:
Ashley Wulber 2025-04-11 19:03:29 -04:00 committed by Michael Murphy
parent 82342ef3dc
commit b573cd7f58

View file

@ -181,7 +181,11 @@ impl cosmic::Application for Power {
} }
Task::none() Task::none()
} }
Message::Surface(surface_message) => unimplemented!(), Message::Surface(a) => {
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
}
} }
} }
@ -230,12 +234,18 @@ impl cosmic::Application for Power {
]; ];
let power = row![ let power = row![
power_buttons("system-suspend-symbolic", fl!("suspend")) power_buttons(
.on_press(Message::Action(PowerAction::Suspend)), "system-suspend-symbolic",
power_buttons("system-reboot-symbolic", fl!("restart")) Message::Action(PowerAction::Suspend)
.on_press(Message::Action(PowerAction::Restart)), ),
power_buttons("system-shutdown-symbolic", fl!("shutdown")) power_buttons(
.on_press(Message::Action(PowerAction::Shutdown)), "system-reboot-symbolic",
Message::Action(PowerAction::Restart)
),
power_buttons(
"system-shutdown-symbolic",
Message::Action(PowerAction::Shutdown)
)
] ]
.spacing(space_m) .spacing(space_m)
.padding([0, space_m]); .padding([0, space_m]);
@ -262,13 +272,13 @@ impl cosmic::Application for Power {
} }
} }
fn power_buttons(name: &str, msg: String) -> cosmic::widget::Button<Message> { fn power_buttons(name: &str, on_press: Message) -> button::Button<Message> {
button::custom( button::custom(
column![text_icon(name, 40), text::body(msg)] widget::container(text_icon(name, 40))
.spacing(4) .width(Length::Fill)
.align_x(Alignment::Center) .center(Length::Fill),
.width(Length::Fill),
) )
.on_press(on_press)
.width(Length::Fill) .width(Length::Fill)
.height(Length::Fixed(76.0)) .height(Length::Fixed(76.0))
.class(theme::Button::Text) .class(theme::Button::Text)