Add window with catalog of keyboard shortcuts#2172
Conversation
|
Did you see that there is a special adwaita shortcut window? https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/class.ShortcutsDialog.html |
|
ShortcutsDialog was introduced in Adw 1.8, but it looks like Pinta requires libadwaita 1.7+. Would it be OK to update the minimum version requirement of Adw to 1.8? |
|
Libadwaita 1.8 would prevent making . If we were to update Libadwaita, we might as well update Libgtk alongside it; if Debian 13 stops being supportable directly, it'd make sense to pin the requirements to match Ubuntu 26.04 instead which has Libadwaita 1.9 and GTK 4.22, other distributions are generally rolling release already or have a much faster release cycles in general (e.g., technically Pinta wouldn't support Fedora 43 either, but Flatpak exists and 43 will be EOL by November; Debian 13 is likely the only "real" loss). This assumes that Flatpak/Snap runtimes are updated with those libraries, Snap isn't quite ready yet, Flatpak I don't know directly but expect is probably fine, by the time Pinta 3.2 releases I wouldn't expect either to be lacking support. |
|
I'd be fine with bumping the required version as long as snap supports or will soon support it - snap & flatpak compatibility is the main mandatory requirement, although being able to build on Ubuntu and other recent distros is a nice bonus. The other option here would be using https://docs.gtk.org/gtk4/class.ShortcutsWindow.html which would work as-is (I assume its deprecation is because the Adw.ShortcutsDialog will replace it) |
cameronwhite
left a comment
There was a problem hiding this comment.
The dialog looks good! Just left a few comments with some suggestions
| return; | ||
|
|
||
| Adw.ShortcutsSection section = new (); | ||
| section.Title = Translations.GetString (title); |
There was a problem hiding this comment.
Translations.GetString() needs to be called with a string literal, e.g. Translations.GetString("File"), otherwise this won't be picked up by the tools which build the translation template (https://github.com/PintaProject/Pinta/wiki/Translations)
So here it's likely better to pass an already translated string into this function
| Translations.GetString ("About"), | ||
| null, | ||
| Resources.StandardIcons.HelpAbout); | ||
| Preferences = new Command ( |
There was a problem hiding this comment.
The labels for this dialog are fairly inconsistent ("Preferences" vs "Keyboard Shortcuts", and on macOS this also instead shows up under "Settings" in the app menu - that must be some GTK behaviour based on the action name?)
I'd propose just using "Keyboard Shortcuts" since this dialog only shows shortcuts and doesn't configure any preferences - leaving room for an actual preferences dialog is something we might want in the future
| "preferences", | ||
| Translations.GetString ("Keyboard Shortcuts"), | ||
| null, | ||
| "preferences-system-symbolic", |
There was a problem hiding this comment.
Icons should be added to the appropriate list of constants (e.g. StandardIcons) so they're easier to change in the future, although the icons are really only used for toolbar buttons currently
| { | ||
| app.AddCommands ([ | ||
| About, | ||
| Preferences, |
There was a problem hiding this comment.
For platforms other than macOS, I think you'll need to also register a menu item separately since there isn't a global application menu - see HelpActions.cs for how the About item is handled).
This addresses issue 1434 by adding a dialog with all keyboard shortcuts and their actions. This dialog can be accessed via
Pinta > Settingsor via keyboard shortcut withctrl + comma. The shortcuts are separated by category, such as tool shortcuts, layer shortcuts, and top bar menu items. The shortcuts are searchable by clicking the magnifying glass icon on top of the dialog.