diff --git a/.github/workflows/apply-translations.yml b/.github/workflows/apply-translations.yml index b8dfcc500..51e8666d9 100644 --- a/.github/workflows/apply-translations.yml +++ b/.github/workflows/apply-translations.yml @@ -65,7 +65,7 @@ jobs: echo >> po/POTFILES find quick-add -name "*.vala" | sort >> po/POTFILES echo >> po/POTFILES - echo "data/resources/ui/shortcuts.ui" >> po/POTFILES + echo "data/resources/ui/shortcuts.blp" >> po/POTFILES python3 scripts/update_translations.py diff --git a/.github/workflows/caldav-test.yml b/.github/workflows/caldav-test.yml index 26679fca5..af28a465d 100644 --- a/.github/workflows/caldav-test.yml +++ b/.github/workflows/caldav-test.yml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | apt-get update - apt-get install -y sudo pipx git apache2-utils valac meson ninja-build gettext desktop-file-utils libgtk-4-dev libadwaita-1-dev libgee-0.8-dev libgranite-7-dev libjson-glib-dev libecal2.0-dev libsoup-3.0-dev libwebkitgtk-6.0-dev libgtksourceview-5-dev libportal-dev libportal-gtk4-dev libspelling-1-dev dbus-x11 evolution-data-server + apt-get install -y sudo pipx git apache2-utils valac meson ninja-build gettext desktop-file-utils libgtk-4-dev libadwaita-1-dev libgee-0.8-dev libgranite-7-dev libjson-glib-dev libecal2.0-dev libsoup-3.0-dev libwebkitgtk-6.0-dev libgtksourceview-5-dev libportal-dev libportal-gtk4-dev libspelling-1-dev dbus-x11 evolution-data-server blueprint-compiler - name: Install Radicale with pipx run: | diff --git a/.github/workflows/check-translations.yml b/.github/workflows/check-translations.yml index 484a4c08b..c2ed0706f 100644 --- a/.github/workflows/check-translations.yml +++ b/.github/workflows/check-translations.yml @@ -48,7 +48,7 @@ jobs: echo >> po/POTFILES find quick-add -name "*.vala" | sort >> po/POTFILES echo >> po/POTFILES - echo "data/resources/ui/shortcuts.ui" >> po/POTFILES + echo "data/resources/ui/shortcuts.blp" >> po/POTFILES python3 ../main-repo/scripts/update_translations.py diff --git a/.gitignore b/.gitignore index bd58c1425..001ab8fa6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ subprojects/gxml**/ planify*txt .flatpak .buildconfig + +/subprojects/blueprint-compiler +/data/resources/ui/*.ui diff --git a/data/resources/ui/shortcuts.blp b/data/resources/ui/shortcuts.blp new file mode 100644 index 000000000..77609daa0 --- /dev/null +++ b/data/resources/ui/shortcuts.blp @@ -0,0 +1,95 @@ +using Gtk 4.0; +using Adw 1; + +Adw.ShortcutsDialog shortcuts_dialog { + Adw.ShortcutsSection { + title: C_("shortcut window", "Used Anywhere"); + + Adw.ShortcutsItem { + accelerator: "a"; + title: C_("shortcut window", "Create a New Task"); + } + + Adw.ShortcutsItem { + accelerator: "v"; + title: C_("shortcut window", "Paste Plain Text to Create New Task"); + } + + Adw.ShortcutsItem { + accelerator: "p"; + title: C_("shortcut window", "Create a New Project"); + } + + Adw.ShortcutsItem { + accelerator: "s"; + title: C_("shortcut window", "Create a New Section in a Project"); + } + } + + Adw.ShortcutsSection { + title: C_("shortcut window", "Search"); + + Adw.ShortcutsItem { + accelerator: "f"; + title: C_("shortcut window", "Open Quick Find"); + } + } + + Adw.ShortcutsSection { + title: C_("shortcut window", "Control Windows"); + + Adw.ShortcutsItem { + accelerator: "q"; + title: C_("shortcut window", "Quit"); + } + + Adw.ShortcutsItem { + accelerator: "comma"; + title: C_("shortcut window", "Open Preferences"); + } + + Adw.ShortcutsItem { + accelerator: "m"; + title: C_("shortcut window", "Toggle Sidebar"); + } + + Adw.ShortcutsItem { + accelerator: "F1"; + title: C_("shortcut window", "Open Keyboard Shortcuts"); + } + } + + Adw.ShortcutsSection { + title: C_("shortcut window", "Navigate"); + + Adw.ShortcutsItem { + accelerator: "h"; + title: C_("shortcut window", "Open Homepage"); + } + + Adw.ShortcutsItem { + accelerator: "i"; + title: C_("shortcut window", "Open Inbox"); + } + + Adw.ShortcutsItem { + accelerator: "t"; + title: C_("shortcut window", "Open Today"); + } + + Adw.ShortcutsItem { + accelerator: "u"; + title: C_("shortcut window", "Open Scheduled"); + } + + Adw.ShortcutsItem { + accelerator: "l"; + title: C_("shortcut window", "Open Labels"); + } + + Adw.ShortcutsItem { + accelerator: "p"; + title: C_("shortcut window", "Open Pinboard"); + } + } +} diff --git a/data/resources/ui/shortcuts.ui b/data/resources/ui/shortcuts.ui deleted file mode 100644 index 510d52c1a..000000000 --- a/data/resources/ui/shortcuts.ui +++ /dev/null @@ -1,137 +0,0 @@ - - - - - 1 - - - shortcuts - 12 - - - Used Anywhere - - - a - Create a New Task - - - - - - <ctrl>v - Paste Plain Text to Create New Task - - - - - - p - Create a New Project - - - - - - s - Create a New Section in a Project - - - - - - - - Search - - - <ctrl>f - Open Quick Find - - - - - - - - Control Windows - - - <ctrl>q - Quit - - - - - - <ctrl>comma - Open Preferences - - - - - - m - Toggle Sidebar - - - - - - F1 - Open Keyboard Shortcuts - - - - - - - - Navigate - - - <ctrl>h - Open Homepage - - - - - - <ctrl>i - Open Inbox - - - - - - <ctrl>t - Open Today - - - - - - <ctrl>u - Open Scheduled - - - - - - <ctrl>l - Open Labels - - - - - - <ctrl>p - Open Pinboard - - - - - - - - diff --git a/meson.build b/meson.build index 6118b4757..1c3d3c13c 100644 --- a/meson.build +++ b/meson.build @@ -60,12 +60,24 @@ endif # Resources # ############ + +blueprints = custom_target('blueprints', + input : files( + 'data/resources/ui/shortcuts.blp', + ), + output : 'shortcuts.ui', + command : [find_program('blueprint-compiler'), 'batch-compile', '@CURRENT_SOURCE_DIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], +) + + asresources = gnome.compile_resources ( 'as-resources', 'data/io.github.alainm23.planify.gresource.xml', + dependencies: blueprints, source_dir: 'data', c_name: 'as' ) + ########### # Profile # ########### diff --git a/scripts/update_translations.py b/scripts/update_translations.py index 48b1ba0b4..9b91873c7 100755 --- a/scripts/update_translations.py +++ b/scripts/update_translations.py @@ -69,7 +69,7 @@ def main(): subprocess.run([ 'xgettext', '--files-from=po/POTFILES', '--directory=.', '--output=po/io.github.alainm23.planify.pot', - '--from-code=UTF-8', '--keyword=_', '--keyword=N_', + '--from-code=UTF-8', '--keyword=_', '--keyword=N_', '--keyword=C_:1c,2' '--package-name=io.github.alainm23.planify' ], check=True) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 1216238cb..77b3b01d6 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -788,9 +788,8 @@ public class MainWindow : Adw.ApplicationWindow { var shortcuts_builder = new Gtk.Builder (); shortcuts_builder.add_from_resource ("/io/github/alainm23/planify/shortcuts.ui"); - var shortcuts_window = (Gtk.ShortcutsWindow) shortcuts_builder.get_object ("shortcuts-planify"); - shortcuts_window.set_transient_for (this); - shortcuts_window.show (); + var shortcuts_dialog = (Adw.ShortcutsDialog) shortcuts_builder.get_object ("shortcuts_dialog"); + shortcuts_dialog.present (this); } catch (Error e) { warning ("Failed to open shortcuts window: %s\n", e.message); }