Parity with original tutorial

This commit is contained in:
Timothy Warren 2020-02-28 13:43:29 -05:00
parent 1574dca648
commit 80c8f1a1a9

View File

@ -22,6 +22,35 @@ impl Default for AboutDialog {
}
}
impl Component for AboutDialog {
type Message = ();
type Properties = ();
fn view(&self) -> VNode<Self> {
gtk! {
<Dialog::new_with_buttons(
Some("About The Todo List"),
None as Option<&Window>,
DialogFlags::MODAL,
&[("Ok", ResponseType::Ok)]
)>
<Box spacing=10 orientation=Orientation::Vertical>
<Image pixbuf=Some(self.dog.clone()) />
<Label markup="<big><b>A Very Nice Todo List</b></big>" />
<Label markup=r#"made with <a href="http://vgtk.rs/">vgtk</a> by me"# />
</Box>
</Dialog>
}
}
}
impl AboutDialog {
#[allow(unused_must_use)]
fn run() {
vgtk::run_dialog::<AboutDialog>(vgtk::current_window().as_ref());
}
}
#[derive(Clone, Debug, Default)]
pub struct Radio {
pub labels: &'static [&'static str],
@ -203,7 +232,10 @@ impl Component for Model {
self.tasks.retain(|task| !task.done);
UpdateAction::Render
}
Message::About => UpdateAction::None,
Message::About => {
AboutDialog::run();
UpdateAction::None
}
}
}