Skip to content

Commit 25988d6

Browse files
committed
book: Add missing snippet for new_task
Fixes #1460
1 parent ec5099e commit 25988d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

book/src/todo_1.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
156156
{{#rustdoc_include ../listings/todo/1/window/mod.rs:tasks}}
157157
```
158158

159+
We also create a method `new_task` which takes the content of the entry, clears the entry and uses the content to create a new task.
160+
161+
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/todo/1/window/mod.rs">listings/todo/1/window/mod.rs</a>
162+
163+
```rust ,no_run,noplayground
164+
{{#rustdoc_include ../listings/todo/1/window/mod.rs:new_task}}
165+
```
166+
159167
In `Window::setup_callbacks` we connect to the "activate" signal of the entry.
160168
This signal is triggered when we press the enter key in the entry.
161169
Then a new `TaskObject` with the content will be created and appended to the model.

0 commit comments

Comments
 (0)