revert Migrate to Blueprint and go back to xml-based UI since I don't quite understand GTK yet
This commit is contained in:
Late Night Defender 2024-10-24 08:55:40 +00:00
parent d02a7927f3
commit ff8890823d
5 changed files with 46 additions and 52 deletions

2
.gitignore vendored
View file

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

View file

@ -1,20 +1,11 @@
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()

View file

@ -1,33 +0,0 @@
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";
}
}
}

46
src/window.ui Normal file
View file

@ -0,0 +1,46 @@
<?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

@ -1,8 +0,0 @@
[wrap-git]
directory = blueprint-compiler
url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
revision = main
depth = 1
[provide]
program_names = blueprint-compiler