Migrate to Blueprint

This commit is contained in:
Late Night Defender 2024-10-24 02:22:58 +07:00
parent f023b5be11
commit d02a7927f3
5 changed files with 52 additions and 46 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
target
/subprojects/blueprint-compiler

View file

@ -1,11 +1,20 @@
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name() pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
gnome = import('gnome') 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', gnome.compile_resources('boostcontroller',
'boostcontroller.gresource.xml', 'boostcontroller.gresource.xml',
gresource_bundle: true, gresource_bundle: true,
install: true, install: true,
install_dir: pkgdatadir, install_dir: pkgdatadir,
dependencies: blueprints,
) )
conf = configuration_data() conf = configuration_data()

33
src/window.blp Normal file
View file

@ -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";
}
}
}

View file

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<requires lib="Adw" version="1.0"/>
<template class="BoostcontrollerWindow" parent="AdwApplicationWindow">
<property name="title" translatable="yes">Boost Controller</property>
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="content">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<child type="end">
<object class="GtkMenuButton">
<property name="primary">True</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="tooltip-text" translatable="yes">Main Menu</property>
<property name="menu-model">primary_menu</property>
</object>
</child>
</object>
</child>
<property name="content">
<object class="GtkLabel" id="label">
<property name="label" translatable="yes">Hello, World!</property>
<style>
<class name="title-1"/>
</style>
</object>
</property>
</object>
</property>
</template>
<menu id="primary_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Boostcontroller</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
</interface>

View file

@ -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