Parity with original tutorial
This commit is contained in:
parent
1574dca648
commit
80c8f1a1a9
34
src/main.rs
34
src/main.rs
@ -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)]
|
#[derive(Clone, Debug, Default)]
|
||||||
pub struct Radio {
|
pub struct Radio {
|
||||||
pub labels: &'static [&'static str],
|
pub labels: &'static [&'static str],
|
||||||
@ -203,7 +232,10 @@ impl Component for Model {
|
|||||||
self.tasks.retain(|task| !task.done);
|
self.tasks.retain(|task| !task.done);
|
||||||
UpdateAction::Render
|
UpdateAction::Render
|
||||||
}
|
}
|
||||||
Message::About => UpdateAction::None,
|
Message::About => {
|
||||||
|
AboutDialog::run();
|
||||||
|
UpdateAction::None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user