diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-02 19:57:16 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-08 18:43:34 +0100 |
commit | 36dc8675f5757c81d3b78da19d6f7bb4f34a555c (patch) | |
tree | 5bd5a417fce1ab40198f72663ffb6ecaec8047a0 /src/gui/mod.rs | |
parent | 969de98ddad7311fbcd74f93910444af8fdb7882 (diff) |
Implement hello-world gui with iced
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/gui/mod.rs')
-rw-r--r-- | src/gui/mod.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/mod.rs b/src/gui/mod.rs new file mode 100644 index 0000000..a7cc4ff --- /dev/null +++ b/src/gui/mod.rs @@ -0,0 +1,32 @@ +use anyhow::Result; +use iced::Application; + +#[derive(Debug)] +struct DistroxGui; + +impl Application for DistroxGui { + type Executor = iced::executor::Default; // tokio + type Message = (); + type Flags = (); + + fn new(_flags: ()) -> (Self, iced::Command<Self::Message>) { + (DistroxGui, iced::Command::none()) + } + + fn title(&self) -> String { + String::from("distrox") + } + + fn update(&mut self, _message: Self::Message, _clipboard: &mut iced::Clipboard) -> iced::Command<Self::Message> { + iced::Command::none() + } + + fn view(&mut self) -> iced::Element<Self::Message> { + iced::Text::new("Hello, world!").into() + } + +} + +pub fn run() -> Result<()> { + DistroxGui::run(iced::Settings::default()).map_err(anyhow::Error::from) +} |