Skip to content

Commit

Permalink
Merge pull request #74 from Relm4/update_examples
Browse files Browse the repository at this point in the history
update examples in book
  • Loading branch information
tronta authored Oct 15, 2024
2 parents 3b1c557 + 54117db commit 7dc5cb8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ members = [

[dev-dependencies]
rand = "0.8.5"
relm4 = "0.8.0"
relm4-components = "0.8.0"
tokio = { version = "1.36", features = ["rt", "macros", "time", "rt-multi-thread", "sync"] }
tracker = "0.2.1"
relm4 = "0.9.1"
relm4-components = "0.9.1"
tokio = { version = "1.40.0", features = ["rt", "macros", "time", "rt-multi-thread", "sync"] }
tracker = "0.2.2"
clap = { version = "4.5.7", features = ["derive"] }
20 changes: 14 additions & 6 deletions examples/simple_manual.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,21 @@ impl SimpleComponent for AppModel {
vbox.append(&dec_button);
vbox.append(&label);

inc_button.connect_clicked(clone!(@strong sender => move |_| {
sender.input(AppInput::Increment);
}));
inc_button.connect_clicked(clone!(
#[strong]
sender,
move |_| {
sender.input(Msg::Increment);
}
));

dec_button.connect_clicked(clone!(@strong sender => move |_| {
sender.input(AppInput::Decrement);
}));
dec_button.connect_clicked(clone!(
#[strong]
sender,
move |_| {
sender.input(Msg::Decrement);
}
));

let widgets = AppWidgets { label };

Expand Down
4 changes: 2 additions & 2 deletions src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ I also recommend reading the [gtk4-rs book](https://gtk-rs.org/gtk4-rs/git/book/
Add the packages you need to your `Cargo.toml`:

```toml
relm4 = "0.8.0"
relm4-components = "0.8.0"
relm4 = "0.9.1"
relm4-components = "0.9.1"
```

## Issues and feedback
Expand Down

0 comments on commit 7dc5cb8

Please sign in to comment.