chore(examples): icon API update

This commit is contained in:
Michael Aaron Murphy 2023-09-13 16:01:04 +02:00 committed by Michael Murphy
parent 9dbc1be269
commit 0eba498708
5 changed files with 12 additions and 19 deletions

View file

@ -72,6 +72,7 @@ impl cosmic::Application for App {
/// Message type specific to our [`App`].
type Message = Message;
/// The unique application ID to supply to the window manager.
const APP_ID: &'static str = "org.cosmic.AppDemo";
fn core(&self) -> &Core {

View file

@ -225,7 +225,7 @@ impl Window {
self.nav_bar
.insert()
.text(page.title())
.icon(icon::handle::from_name(page.icon_name()).icon())
.icon(icon::from_name(page.icon_name()).icon())
.secondary(&mut self.nav_id_to_page, page)
}
@ -248,7 +248,7 @@ impl Window {
) -> Element<Message> {
let page = sub_page.parent_page();
column!(
button::icon(icon::handle::from_name("go-previous-symbolic").size(16))
button::icon(icon::from_name("go-previous-symbolic").size(16))
.label(page.title())
.padding(0)
.on_press(Message::from(page)),
@ -273,10 +273,7 @@ impl Window {
iced::widget::Button::new(
container(
settings::item_row(vec![
icon::handle::from_name(sub_page.icon_name())
.size(20)
.icon()
.into(),
icon::from_name(sub_page.icon_name()).size(20).icon().into(),
column!(
text(sub_page.title()).size(14),
text(sub_page.description()).size(10),
@ -284,10 +281,7 @@ impl Window {
.spacing(2)
.into(),
horizontal_space(iced::Length::Fill).into(),
icon::handle::from_name("go-next-symbolic")
.size(20)
.icon()
.into(),
icon::from_name("go-next-symbolic").size(20).icon().into(),
])
.spacing(16),
)
@ -295,7 +289,7 @@ impl Window {
.style(theme::Container::custom(list::column::style)),
)
.padding(0)
.style(theme::IcedButton::Transparent)
.style(theme::iced::Button::Transparent)
.on_press(Message::from(sub_page.into_page()))
// .id(BTN.clone())
.into()
@ -427,7 +421,7 @@ impl Application for Window {
.destructive(Rgb::new(0.890, 0.145, 0.420))
.build(),
)),
demo::ThemeVariant::System => cosmic::theme::theme(),
demo::ThemeVariant::System => cosmic::theme::system_preference(),
};
}
Some(demo::Output::ToggleWarning) => self.toggle_warning(),

View file

@ -257,9 +257,7 @@ impl State {
))
.add(settings::item_row(vec![
cosmic::widget::button::destructive("Do not Touch")
.trailing_icon(
icon::handle::from_name("dialog-warning-symbolic").size(16),
)
.trailing_icon(icon::from_name("dialog-warning-symbolic").size(16))
.on_press(Message::ToggleWarning)
.into(),
]))
@ -422,10 +420,10 @@ impl State {
"Primary container with some text and a couple icons testing default fallbacks"
)
.size(24),
icon::handle::from_name("microphone-sensitivity-high-symbolic-test")
icon::from_name("microphone-sensitivity-high-symbolic-test")
.size(24)
.icon(),
icon::handle::from_name("microphone-sensitivity-high-symbolic-test")
icon::from_name("microphone-sensitivity-high-symbolic-test")
.size(24)
.fallback(false)
.icon(),

View file

@ -66,7 +66,7 @@ impl State {
.on_close(Message::Close)
.width(Length::Shrink);
let new_tab_button = icon::handle::from_name("tab-new-symbolic")
let new_tab_button = icon::from_name("tab-new-symbolic")
.size(20)
.apply(button::icon)
.on_press(Message::AddNew);

View file

@ -62,7 +62,7 @@ impl State {
window.parent_page_button(SystemAndAccountsPage::About),
row!(
horizontal_space(Length::Fill),
icon::handle::from_name("distributor-logo").size(78).icon(),
icon::from_name("distributor-logo").size(78).icon(),
horizontal_space(Length::Fill),
)
.into(),