diff --git a/.gitignore b/.gitignore index 1df8ad2..66fd66d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode .cache -.test \ No newline at end of file +.test +/subprojects/blueprint-compiler diff --git a/po/POTFILES.in b/po/POTFILES.in index 9cf71aa..43d0f77 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -5,4 +5,4 @@ data/io.gitlab.nekocwd.pipetap.metainfo.xml.in data/io.gitlab.nekocwd.pipetap.gschema.xml src/main.vala src/window.vala -src/window.ui +src/window.blp diff --git a/src/gtk/help-overlay.blp b/src/gtk/help-overlay.blp new file mode 100644 index 0000000..90ee78f --- /dev/null +++ b/src/gtk/help-overlay.blp @@ -0,0 +1,24 @@ +using Gtk 4.0; + +ShortcutsWindow help_overlay { + modal: true; + + ShortcutsSection { + section-name: "shortcuts"; + max-height: 10; + + ShortcutsGroup { + title: C_("shortcut window", "General"); + + ShortcutsShortcut { + title: C_("shortcut window", "Show Shortcuts"); + action-name: "win.show-help-overlay"; + } + + ShortcutsShortcut { + title: C_("shortcut window", "Quit"); + action-name: "app.quit"; + } + } + } +} diff --git a/src/gtk/help-overlay.ui b/src/gtk/help-overlay.ui deleted file mode 100644 index ef12f02..0000000 --- a/src/gtk/help-overlay.ui +++ /dev/null @@ -1,29 +0,0 @@ - - - - True - - - shortcuts - 10 - - - General - - - Show Shortcuts - win.show-help-overlay - - - - - Quit - app.quit - - - - - - - - diff --git a/src/meson.build b/src/meson.build index 5bda3a2..eeb41bf 100644 --- a/src/meson.build +++ b/src/meson.build @@ -10,7 +10,28 @@ pipetap_deps = [ dependency('libadwaita-1', version: '>= 1.4'), ] -pipetap_sources += gnome.compile_resources('pipetap-resources', 'pipetap.gresource.xml', c_name: 'pipetap') +blueprints = custom_target( + 'blueprints', + input: files( + 'gtk/help-overlay.blp', + 'window.blp', + ), + output: '.', + command: [ + find_program('blueprint-compiler'), + 'batch-compile', + '@OUTPUT@', + '@CURRENT_SOURCE_DIR@', + '@INPUT@', + ], +) + +pipetap_sources += gnome.compile_resources( + 'pipetap-resources', + 'pipetap.gresource.xml', + c_name: 'pipetap', + dependencies: blueprints, +) executable( 'pipetap', diff --git a/src/window.blp b/src/window.blp new file mode 100644 index 0000000..ea5dedc --- /dev/null +++ b/src/window.blp @@ -0,0 +1,48 @@ +using Gtk 4.0; +using Adw 1; + +template $PipeTapWindow: Adw.ApplicationWindow { + title: _("PipeTap"); + default-width: 800; + default-height: 600; + + content: Adw.ToolbarView { + [top] + Adw.HeaderBar { + [end] + MenuButton { + primary: true; + icon-name: "open-menu-symbolic"; + tooltip-text: _("Main Menu"); + menu-model: primary_menu; + } + } + + content: Label label { + label: _("Hello, World!"); + + styles [ + "title-1", + ] + }; + }; +} + +menu primary_menu { + section { + item { + label: _("_Preferences"); + action: "app.preferences"; + } + + item { + label: _("_Keyboard Shortcuts"); + action: "win.show-help-overlay"; + } + + item { + label: _("_About PipeTap"); + action: "app.about"; + } + } +} diff --git a/src/window.ui b/src/window.ui deleted file mode 100644 index 7067a6e..0000000 --- a/src/window.ui +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - -
- - _Preferences - app.preferences - - - _Keyboard Shortcuts - win.show-help-overlay - - - _About PipeTap - app.about - -
-
-
\ No newline at end of file diff --git a/subprojects/blueprint-compiler.wrap b/subprojects/blueprint-compiler.wrap new file mode 100644 index 0000000..2665f2c --- /dev/null +++ b/subprojects/blueprint-compiler.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory = blueprint-compiler +url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git +revision = v0.16.0 +depth = 1 + +[provide] +program_names = blueprint-compiler \ No newline at end of file