Skip to content

Commit b02f2cd

Browse files
committed
examples: further adjust README
1 parent 677364e commit b02f2cd

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

examples/virtual_methods/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
Example for how to create a base widget which exposes virtual methods that other widgets can override.
44
In this case, a `BaseButton` class is defined which is a gtk::Button with two additional methods:
55

6-
* `sync_method`: Synchronous method that updates the button label to `BaseButton sync`, or `BaseButton sync {}`
7-
where {} is replaced with the `extra_text` parameter, if it's `Some`. This showcases how arguments
8-
can be added to virtual methods. The `Option<String>` has to be boxed to be FFI-safe.
6+
* sync_method`: Synchronous method that updates the button label to `BaseButton sync`, or `BaseButton sync {extra_text}`. This showcases how arguments
7+
can be passed to virtual methods. The `Option<String>` has to be boxed to be FFI-safe.
98
* `async_method`: Asynchronous method that updates the button label to `BaseButton async`
109

1110
`DerivedButton` overrides the two methods. During construction `sync_method` is called in
1211
`BaseButton` which will set the label to `BaseButton sync` for `BaseButton` and to
13-
`DerivedButton sync` for `DerivedButton`. In the `VirtualMethodsWindow`, `connect_clicked` is
14-
called on both buttons. Each handler for `::clicked` will invoke the respective `async_method`.
15-
This updates the button's label accordingly when clicking it.
12+
`DerivedButton sync` for `DerivedButton`.

examples/virtual_methods/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ fn main() {
2121

2222
base_button.connect_clicked(|b| {
2323
let ctx = glib::MainContext::default();
24-
let b = b.clone();
2524
ctx.spawn_local(clone!(@weak b => async move {
2625
b.async_method().await.unwrap();
2726
}));

0 commit comments

Comments
 (0)