libcosmic/examples/cosmic/window/input_devices.rs
Hugo Osvaldo Barrera 6ce9f4fc7a Make example runnable as example
Trying to run examples as usual (and as described in the README) fails:

    > cargo run --release --example cosmic
    error: no example target named `cosmic`.

The examples themselves are written as separate crates, and are
therefore not usable as examples (they also won't build via `cargo build
--examples`).

This commit makes the example fit the style that cargo can understand.
That is:

- Don't declare the example as a separate crate.
- Remove the nested `src` inside the example directory.
- Put example-only dependencies in dev-dependencies

No rust code was modified, files were only moved.
2023-03-12 11:24:49 +01:00

47 lines
1.2 KiB
Rust

use super::{Page, SubPage};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum InputDevicesPage {
Keyboard,
Touchpad,
Mouse,
}
impl SubPage for InputDevicesPage {
//TODO: translate
fn title(&self) -> &'static str {
use InputDevicesPage::*;
match self {
Keyboard => "Keyboard",
Touchpad => "Touchpad",
Mouse => "Mouse",
}
}
//TODO: translate
fn description(&self) -> &'static str {
use InputDevicesPage::*;
match self {
Keyboard => "Input sources, switching, special character entry, shortcuts.",
Touchpad => "Touchpad speed, click options, gestures.",
Mouse => "Mouse speed, acceleration, natural scrolling.",
}
}
fn icon_name(&self) -> &'static str {
use InputDevicesPage::*;
match self {
Keyboard => "input-keyboard-symbolic",
Touchpad => "input-touchpad-symbolic",
Mouse => "input-mouse-symbolic",
}
}
fn parent_page(&self) -> Page {
Page::InputDevices(None)
}
fn into_page(self) -> Page {
Page::InputDevices(Some(self))
}
}