Skip to content

Commit eabd494

Browse files
authored
book: Check links with lychee (#1499)
* book: Check links with lychee * Update book.yml * Update book.yml
1 parent e7ca908 commit eabd494

File tree

13 files changed

+62
-56
lines changed

13 files changed

+62
-56
lines changed

.github/workflows/book.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ jobs:
2727

2828
- run: mdbook build -d public
2929
working-directory: book
30+
31+
- name: Link Checker
32+
uses: lycheeverse/[email protected]
33+
with:
34+
args: book/public
35+
fail: true
3036

3137
- name: Deploy to stable
3238
uses: peaceiris/actions-gh-pages@v3

book/src/actions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
2323
```
2424

2525
One of the most popular reasons to use actions are keyboard accelerators, so we added one here.
26-
With [`set_accels_for_action`](../docs/gtk4/prelude/trait.GtkApplicationExt.html#tymethod.set_accels_for_action) one can assign one or more accelerators to a certain action.
27-
Check the documentation of [`accelerator_parse`](../docs/gtk4/functions/fn.accelerator_parse.html) in order to learn more about its syntax.
26+
With [`set_accels_for_action`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.GtkApplicationExt.html#tymethod.set_accels_for_action) one can assign one or more accelerators to a certain action.
27+
Check the documentation of [`accelerator_parse`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/functions/fn.accelerator_parse.html) in order to learn more about its syntax.
2828

2929
Before we move on to other aspects of actions, let's appreciate a few things that are curious here.
3030
The "win" part of "win.close" is the group of the action.
@@ -47,7 +47,7 @@ However, that also means that we actually define one action per window instance.
4747
If we want to have a single globally accessible action instead, we call `add_action` on our application instead.
4848

4949
> Adding "win.close" was useful as a simple example.
50-
> However, in the future we will use the pre-defined ["window.close"](../docs/gtk4/struct.Window.html#actions) action which does exactly the same thing.
50+
> However, in the future we will use the pre-defined ["window.close"](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Window.html#actions) action which does exactly the same thing.
5151
5252
## Parameter and State
5353

@@ -76,10 +76,10 @@ This is how our app works:
7676

7777
## Actionable
7878

79-
Connecting actions to the "clicked" signal of buttons is a typical use case, which is why all buttons implement the [`Actionable`](../docs/gtk4/struct.Actionable.html) interface.
79+
Connecting actions to the "clicked" signal of buttons is a typical use case, which is why all buttons implement the [`Actionable`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Actionable.html) interface.
8080
This way, the action can be specified by setting the "action-name" property.
8181
If the action accepts a parameter, it can be set via the "action-target" property.
82-
With [`ButtonBuilder`](../docs/gtk4/builders/struct.ButtonBuilder.html), we can set everything up by calling its methods.
82+
With [`ButtonBuilder`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/builders/struct.ButtonBuilder.html), we can set everything up by calling its methods.
8383

8484
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/actions/4/main.rs">listings/actions/4/main.rs</a>
8585

@@ -206,8 +206,8 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
206206
<property name="orientation">vertical</property>
207207
```
208208

209-
Since we connect the menu to the [`gtk::MenuButton`](../docs/gtk4/struct.MenuButton.html) via the [menu-model](../docs/gtk4/struct.MenuButton.html#menu-model) property, the `Menu` is expected to be a [`gtk::PopoverMenu`](../docs/gtk4/struct.PopoverMenu.html).
210-
The [documentation](../docs/gtk4/struct.PopoverMenu.html) for `PopoverMenu` also explains its `xml` syntax for the interface builder.
209+
Since we connect the menu to the [`gtk::MenuButton`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.MenuButton.html) via the [menu-model](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.MenuButton.html#menu-model) property, the `Menu` is expected to be a [`gtk::PopoverMenu`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.PopoverMenu.html).
210+
The [documentation](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.PopoverMenu.html) for `PopoverMenu` also explains its `xml` syntax for the interface builder.
211211

212212
Also note how we specified the target:
213213

@@ -234,7 +234,7 @@ This is how the app looks in action:
234234
</div>
235235

236236
>We changed the icon of the `MenuButton` by setting its property "icon-name" to "open-menu-symbolic".
237-
>You can find more icons with the [Icon Library](https://apps.gnome.org/app/org.gnome.design.IconLibrary/).
237+
>You can find more icons with the [Icon Library](https://flathub.org/apps/org.gnome.design.IconLibrary).
238238
>They can be embedded with [`gio::Resource`](https://gtk-rs.org/gtk-rs-core/stable/latest/docs/gio/struct.Resource.html) and then be referenced within the composite templates (or other places).
239239
240240
## Settings

book/src/composite_templates.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
2626

2727
The most outer tag always has to be the `<interface>`.
2828
Then you start listing the elements you want to describe.
29-
In order to define a composite template, we specify the name `MyGtkAppWindow` of the custom widget we want to create and the parent [`gtk::ApplicationWindow`](../docs/gtk4/struct.ApplicationWindow.html) it derives of.
29+
In order to define a composite template, we specify the name `MyGtkAppWindow` of the custom widget we want to create and the parent [`gtk::ApplicationWindow`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ApplicationWindow.html) it derives of.
3030
These `xml` files are independent of the programming language, which is why the classes have the original names.
3131
Luckily, they all convert like this: `gtk::ApplicationWindow``GtkApplicationWindow`.
32-
Then we can specify properties which are listed [here](../docs/gtk4/struct.ApplicationWindow.html#properties) for `ApplicationWindow`.
32+
Then we can specify properties which are listed [here](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ApplicationWindow.html#properties) for `ApplicationWindow`.
3333
Since `ApplicationWindow` can contain other widgets we use the `<child>` tag to add a `gtk::Button`.
3434
We want to be able to refer to the button later on so we also set its `id`.
3535

@@ -81,12 +81,12 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
8181
{{#rustdoc_include ../listings/composite_templates/1/window/mod.rs}}
8282
```
8383

84-
In the implementation struct, we then add the derive macro [`gtk::CompositeTemplate`](../docs/gtk4_macros/derive.CompositeTemplate.html).
84+
In the implementation struct, we then add the derive macro [`gtk::CompositeTemplate`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4_macros/derive.CompositeTemplate.html).
8585
We also specify that the template information comes from a resource of prefix `/org/gtk-rs/example` containing a file `window.ui`.
8686

8787
One very convenient feature of templates is the template child.
8888
You use it by adding a struct member with the same name as one `id` attribute in the template.
89-
[`TemplateChild`](../docs/gtk4/subclass/widget/struct.TemplateChild.html) then stores a reference to the widget for later use.
89+
[`TemplateChild`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/subclass/widget/struct.TemplateChild.html) then stores a reference to the widget for later use.
9090
This will be useful later, when we want to add a callback to our button.
9191

9292
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/composite_templates/1/window/imp.rs">listings/composite_templates/1/window/imp.rs</a>
@@ -154,9 +154,9 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
154154
{{#rustdoc_include ../listings/composite_templates/3/resources/window.ui}}
155155
```
156156

157-
Then we define the `handle_button_clicked` with the [`template_callbacks`](../docs/gtk4_macros/attr.template_callbacks.html) macro applied to it.
157+
Then we define the `handle_button_clicked` with the [`template_callbacks`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4_macros/attr.template_callbacks.html) macro applied to it.
158158
We can determine the function signature by having a look at the `connect_*` method of the signal we want to handle.
159-
In our case that would be [`connect_clicked`](../docs/gtk4/prelude/trait.ButtonExt.html#tymethod.connect_clicked).
159+
In our case that would be [`connect_clicked`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.ButtonExt.html#tymethod.connect_clicked).
160160
It takes a function of type `Fn(&Self)`.
161161
`Self` refers to our button.
162162
This means that `handle_button_clicked` has a single parameter of type `&CustomButton`.
@@ -166,7 +166,7 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
166166
{{#rustdoc_include ../listings/composite_templates/3/window/imp.rs:template_callbacks}}
167167
```
168168

169-
Then we have to bind the template callbacks with [`bind_template_callbacks`](../docs/gtk4/subclass/widget/trait.CompositeTemplateCallbacksClass.html#tymethod.bind_template_callbacks).
169+
Then we have to bind the template callbacks with [`bind_template_callbacks`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/subclass/widget/trait.CompositeTemplateCallbacksClass.html#tymethod.bind_template_callbacks).
170170
We also need to remove the `button.connect_clicked` callback implemented in `window/imp.rs`.
171171

172172
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/composite_templates/3/window/imp.rs">listings/composite_templates/3/window/imp.rs</a>
@@ -240,7 +240,7 @@ Thanks to composite templates we can
240240
- specify handler functions for signals.
241241

242242
The API involved here is extensive so especially at the beginning you will want to check out the documentation.
243-
The basic syntax of the `ui` files is explained within [`Builder`](../docs/gtk4/struct.Builder.html#gtkbuilder-ui-definitions), syntax specific to widgets within [`Widget`](../docs/gtk4/struct.Widget.html#gtkwidget-as-gtkbuildable).
243+
The basic syntax of the `ui` files is explained within [`Builder`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Builder.html#gtkbuilder-ui-definitions), syntax specific to widgets within [`Widget`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Widget.html#gtkwidget-as-gtkbuildable).
244244
If a certain widget accepts additional element, then they are typically explained in the docs of the widget.
245245

246246
In the following chapter, we will see how composite templates help us to create slightly bigger apps such as a To-Do app.

book/src/css.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ We did not specify for which button the rule should apply, so it was applied to
4747
4848
[Class selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Class_selectors) are one way to choose which specific elements a CSS rule applies to.
4949
GTK adds style classes to many of its widgets, often depending on their content.
50-
A [`gtk::Button`](../docs/gtk4/struct.Button.html#css-nodes), for example, will get the `text-button` style class when its content is a label.
50+
A [`gtk::Button`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Button.html#css-nodes), for example, will get the `text-button` style class when its content is a label.
5151
That is why we create a new CSS rule which only applies to `button` nodes with the style class `text_button`.
5252
5353
@@ -63,7 +63,7 @@ Now only the font of our button becomes magenta.
6363

6464
## Adding Your Own Style Class
6565

66-
With [`add_css_class`](../docs/gtk4/prelude/trait.WidgetExt.html#tymethod.add_css_class) we can also add our own style classes to widgets.
66+
With [`add_css_class`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.WidgetExt.html#tymethod.add_css_class) we can also add our own style classes to widgets.
6767
One use-case for this is when you want a rule to apply to a hand-picked set of widgets.
6868
For example if we have two buttons, but want only one of them to have magenta font.
6969
Relying on one of the style classes which GTK adds will not help since both will get the same ones.
@@ -96,7 +96,7 @@ Ideally however, you would give the widget a name and match with that name inste
9696
This way your intentions are more clear, compared to matching with style classes that can apply to multiple widgets.
9797

9898
Again, we have two buttons but want to color only one of them magenta.
99-
We set the name of the first one with [`set_widget_name`](../docs/gtk4/prelude/trait.WidgetExt.html#tymethod.set_widget_name).
99+
We set the name of the first one with [`set_widget_name`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.WidgetExt.html#tymethod.set_widget_name).
100100

101101
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/css/4/main.rs">listings/css/4/main.rs</a>
102102

@@ -123,7 +123,7 @@ Again, the style rule only applies to the first button.
123123
Certain styles are common enough that GTK provides CSS rules for them.
124124
For example, if you want to indicate that your button leads to a destructive or suggested action you don't have to provide your own CSS rules.
125125
All you have to do is to add "destructive-action" or "suggested-action" style class to your button.
126-
Most widgets will document these rules in their documentation under [CSS nodes](../docs/gtk4/struct.Button.html#css-nodes).
126+
Most widgets will document these rules in their documentation under [CSS nodes](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Button.html#css-nodes).
127127

128128
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/css/5/main.rs">listings/css/5/main.rs</a>
129129

@@ -137,7 +137,7 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
137137

138138
We can also add style classes with the interface builder.
139139
Just add the `<style>` element to your widget.
140-
The `<style>` element is documented together with [`gtk::Widget`](../docs/gtk4/struct.Widget.html#gtkwidget-as-gtkbuildable).
140+
The `<style>` element is documented together with [`gtk::Widget`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Widget.html#gtkwidget-as-gtkbuildable).
141141
Adding again destructive and suggested buttons, would then look like this:
142142

143143
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/css/6/window/window.ui">listings/css/6/window/window.ui</a>
@@ -181,7 +181,7 @@ After we removed the cursor, the button returns to its original state.
181181

182182
In the previous examples, a widget always corresponded to a single CSS node.
183183
This is not always the case.
184-
For example, [`gtk::MenuButton`](../docs/gtk4/struct.MenuButton.html) has multiple CSS nodes.
184+
For example, [`gtk::MenuButton`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.MenuButton.html) has multiple CSS nodes.
185185
Let's see how that works.
186186

187187
First, we create a single `MenuButton`.
@@ -195,7 +195,7 @@ Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master
195195
You can make a `MenuButton` show an icon or a label.
196196
If you choose to do neither of those, as we currently do, it shows an image displaying an arrow.
197197

198-
An inheritance tree of [CSS nodes](../docs/gtk4/struct.MenuButton.html#css-nodes) displays this situation:
198+
An inheritance tree of [CSS nodes](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.MenuButton.html#css-nodes) displays this situation:
199199

200200
```
201201
menubutton
@@ -227,7 +227,7 @@ Let's see how to deal with this situation by messing with our To-Do app once mor
227227
The class `TaskRow` inherits from `gtk::Box`, so we could just match for the node `box`.
228228
However, in that case we would also match with other instance of `gtk::Box`.
229229
What we will want to do instead is to give `TaskRow` its own CSS name.
230-
When calling [`set_css_name` ](../docs/gtk4/subclass/widget/trait.WidgetClassSubclassExt.html#method.set_css_name), we change the name of the CSS node of the widget class.
230+
When calling [`set_css_name` ](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/subclass/widget/trait.WidgetClassExt.html#method.set_css_name), we change the name of the CSS node of the widget class.
231231
In our case, the widget `TaskRow` then corresponds to the node `task-row`.
232232

233233
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/todo/3/task_row/imp.rs">listings/todo/3/task_row/imp.rs</a>

book/src/g_object_properties.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Properties provide a public API for accessing state of GObjects.
44

55
Let's see how this is done by experimenting with the [`Switch`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Switch.html) widget.
6-
One of its properties is called [active](../docs/gtk4/struct.Switch.html#active).
6+
One of its properties is called [active](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Switch.html#active).
77
According to the GTK docs, it can be read and be written to.
8-
That is why `gtk-rs` provides corresponding [`is_active`](../docs/gtk4/struct.Switch.html#method.is_active) and [`set_active`](../docs/gtk4/struct.Switch.html#method.set_active) methods.
8+
That is why `gtk-rs` provides corresponding [`is_active`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Switch.html#method.is_active) and [`set_active`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Switch.html#method.set_active) methods.
99

1010
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/g_object_properties/1/main.rs">listings/g_object_properties/1/main.rs</a>
1111

book/src/g_object_signals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ For example, if we press on a button, the "clicked" signal will be emitted.
55
The signal then takes care that all the registered callbacks will be executed.
66

77
`gtk-rs` provides convenience methods for registering callbacks.
8-
In our "Hello World" example we [connected](../docs/gtk4/prelude/trait.ButtonExt.html#tymethod.connect_clicked) the "clicked" signal to a closure which sets the label of the button to "Hello World" as soon as it gets called.
8+
In our "Hello World" example we [connected](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/prelude/trait.ButtonExt.html#tymethod.connect_clicked) the "clicked" signal to a closure which sets the label of the button to "Hello World" as soon as it gets called.
99

1010
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/hello_world/3/main.rs">listings/hello_world/3/main.rs</a>
1111

book/src/hello_world.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Now that we've got a working installation, let's get right into it!
44

5-
At the very least, we need to create a [`gtk::Application`](../docs/gtk4/struct.Application.html) instance with an [application id](https://developer.gnome.org/documentation/tutorials/application-id.html).
5+
At the very least, we need to create a [`gtk::Application`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Application.html) instance with an [application id](https://developer.gnome.org/documentation/tutorials/application-id.html).
66
For that we use the [builder pattern](https://rust-unofficial.github.io/patterns/patterns/creational/builder.html) which many `gtk-rs` objects support.
77
Note that we also import the prelude to bring the necessary traits into scope.
88

@@ -20,7 +20,7 @@ and has no handlers connected to the 'activate' signal. It should do one of thes
2020
```
2121

2222
GTK tells us that something should be called in its `activate` step.
23-
So let's create a [`gtk::ApplicationWindow`](../docs/gtk4/struct.ApplicationWindow.html) there.
23+
So let's create a [`gtk::ApplicationWindow`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ApplicationWindow.html) there.
2424

2525
Filename: <a class=file-link href="https://github.com/gtk-rs/gtk4-rs/blob/master/book/listings/hello_world/2/main.rs">listings/hello_world/2/main.rs</a>
2626

0 commit comments

Comments
 (0)