input: Use existing message to open keyboard shortcuts
This commit is contained in:
parent
154c67ee6a
commit
750cd299b2
3 changed files with 14 additions and 16 deletions
|
|
@ -272,11 +272,6 @@ impl Application for SettingsApp {
|
|||
page::update!(self.pages, message, desktop::wallpaper::Page);
|
||||
}
|
||||
crate::pages::Message::Input(message) => {
|
||||
if matches!(message, input::Message::OpenKeyboardShortcuts) {
|
||||
if let Some(id) = self.pages.page_id::<input::keyboard::shortcuts::Page>() {
|
||||
return self.activate_page(id);
|
||||
}
|
||||
}
|
||||
if let Some(page) = self.pages.page_mut::<input::Page>() {
|
||||
return page.update(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,20 +291,25 @@ fn keyboard_shortcuts() -> Section<crate::pages::Message> {
|
|||
Section::default()
|
||||
.title(fl!("keyboard-shortcuts"))
|
||||
.descriptions(vec![fl!("keyboard-shortcuts", "desc")])
|
||||
.view::<Page>(|_binder, _page, section| {
|
||||
.view::<Page>(|binder, _page, section| {
|
||||
let descriptions = §ion.descriptions;
|
||||
|
||||
settings::view_section(§ion.title)
|
||||
.add(go_next_item(
|
||||
let mut section = settings::view_section(§ion.title);
|
||||
if let Some((shortcuts_entity, _)) = binder
|
||||
.info
|
||||
.iter()
|
||||
.find(|(_, v)| v.id == "keyboard-shortcuts")
|
||||
{
|
||||
section = section.add(go_next_item(
|
||||
&descriptions[0],
|
||||
Message::OpenKeyboardShortcuts,
|
||||
))
|
||||
.apply(cosmic::Element::from)
|
||||
.map(crate::pages::Message::Input)
|
||||
crate::pages::Message::Page(shortcuts_entity),
|
||||
));
|
||||
}
|
||||
section.apply(cosmic::Element::from)
|
||||
})
|
||||
}
|
||||
|
||||
fn go_next_control() -> cosmic::Element<'static, Message> {
|
||||
fn go_next_control<Msg: Clone + 'static>() -> cosmic::Element<'static, Msg> {
|
||||
widget::row!(
|
||||
horizontal_space(Length::Fill),
|
||||
cosmic::widget::icon("go-next-symbolic", 20).style(cosmic::theme::Svg::Symbolic)
|
||||
|
|
@ -312,7 +317,7 @@ fn go_next_control() -> cosmic::Element<'static, Message> {
|
|||
.into()
|
||||
}
|
||||
|
||||
fn go_next_item(description: &str, msg: Message) -> cosmic::Element<'_, Message> {
|
||||
fn go_next_item<Msg: Clone + 'static>(description: &str, msg: Msg) -> cosmic::Element<'_, Msg> {
|
||||
settings::item(description, go_next_control())
|
||||
.apply(widget::container)
|
||||
.style(cosmic::theme::Container::custom(
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ pub enum Message {
|
|||
PrimaryButtonSelected(cosmic::widget::segmented_button::Entity),
|
||||
// seperate close message, to make sure another isn't closed?
|
||||
ExpandInputSourcePopover(Option<String>),
|
||||
OpenKeyboardShortcuts,
|
||||
OpenSpecialCharacterDialog(keyboard::SpecialKey),
|
||||
CloseSpecialCharacterDialog,
|
||||
SpecialCharacterSelect(Option<&'static str>),
|
||||
|
|
@ -146,7 +145,6 @@ impl Page {
|
|||
}
|
||||
}
|
||||
}
|
||||
Message::OpenKeyboardShortcuts => {}
|
||||
}
|
||||
iced::Command::none()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue