From d02a7927f3f4e618f50cee73996a7a6abf18cdcb Mon Sep 17 00:00:00 2001 From: Late Night Defender Date: Thu, 24 Oct 2024 02:22:58 +0700 Subject: [PATCH] Migrate to Blueprint --- .gitignore | 2 ++ src/meson.build | 9 ++++++ src/window.blp | 33 +++++++++++++++++++++ src/window.ui | 46 ----------------------------- subprojects/blueprint-compiler.wrap | 8 +++++ 5 files changed, 52 insertions(+), 46 deletions(-) create mode 100644 .gitignore create mode 100644 src/window.blp delete mode 100644 src/window.ui create mode 100644 subprojects/blueprint-compiler.wrap diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8c9ff8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +/subprojects/blueprint-compiler diff --git a/src/meson.build b/src/meson.build index 5cd93cd..71ba490 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,11 +1,20 @@ pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() gnome = import('gnome') +blueprints = custom_target('blueprints', + input: files( + 'window.blp' + ), + output: '.', + command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], +) + gnome.compile_resources('boostcontroller', 'boostcontroller.gresource.xml', gresource_bundle: true, install: true, install_dir: pkgdatadir, + dependencies: blueprints, ) conf = configuration_data() diff --git a/src/window.blp b/src/window.blp new file mode 100644 index 0000000..ad2cb5a --- /dev/null +++ b/src/window.blp @@ -0,0 +1,33 @@ +using Gtk 4.0; +using Adw 1; + +template BoostcontrollerWindow : Adw.ApplicationWindow { + default-width: 600; + default-height: 300; + title: _("Boost Controller"); + + Adw.ToolbarView { + [top] + Adw.HeaderBar { + [end] + MenuButton button_menu { + menu-model: menu_app; + icon-name: "open-menu-symbolic"; + primary: true; + } + } + + content: Label label { + label: "Yay, blueprint is setup!"; + }; + } +} + +menu menu_app { + section { + item { + label: _("About My App"); + action: "app.about"; + } + } +} diff --git a/src/window.ui b/src/window.ui deleted file mode 100644 index c63d2ab..0000000 --- a/src/window.ui +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - -
- - _Keyboard Shortcuts - win.show-help-overlay - - - _About Boostcontroller - app.about - -
-
-
diff --git a/subprojects/blueprint-compiler.wrap b/subprojects/blueprint-compiler.wrap new file mode 100644 index 0000000..5c978d6 --- /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 = main +depth = 1 + +[provide] +program_names = blueprint-compiler