Skip to content

Conversation

@Hofer-Julian
Copy link
Collaborator

Also update dependencies

<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
<attribute name="action">app.shortcuts</attribute>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Mention that change in the book

<interface>
<object class="GtkShortcutsWindow" id="help_overlay">
<property name="modal">True</property>
<object class="AdwShortcutsDialog" id="shortcuts_dialog">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Mention the changed id in the book

<gresources>
<gresource prefix="/org/gtk_rs/Todo6/">
<file compressed="true" preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">shortcuts.ui</file>
<file compressed="true" preprocess="xml-stripblanks" alias="shortcuts-dialog.ui">shortcuts.ui</file>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Mention that change in the book

Comment on lines +158 to +165
Now that we are using Libadwaita, we should also update our keyboard shortcuts window to use [`adw::ShortcutsDialog`](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.ShortcutsDialog.html).
This widget is the Libadwaita equivalent of [`gtk::ShortcutsWindow`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ShortcutsWindow.html) and provides better integration with the Adwaita style.

The main differences are:

- [`adw::ShortcutsDialog`](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.ShortcutsDialog.html) extends [`adw::Dialog`](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.Dialog.html) rather than [`gtk::Window`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.Window.html)
- It uses [`adw::ShortcutsSection`](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.ShortcutsSection.html) and [`adw::ShortcutsItem`](https://world.pages.gitlab.gnome.org/Rust/libadwaita-rs/stable/latest/docs/libadwaita/struct.ShortcutsItem.html) instead of [`gtk::ShortcutsSection`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ShortcutsSection.html), [`gtk::ShortcutsGroup`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ShortcutsGroup.html), and [`gtk::ShortcutsShortcut`](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/struct.ShortcutsShortcut.html)
- The structure is simpler, with sections directly containing items
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify this and add diff of changed parts

```xml
{{#rustdoc_include ../listings/todo/6/resources/shortcuts.ui}}
```

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants