use resources instead of direct ui-file loading

This commit is contained in:
Nikolay Brovko 2020-01-24 15:56:58 +03:00
parent 7e7c0a3ce5
commit 397f225fa8
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
5 changed files with 19 additions and 2 deletions

4
data/meson.build Normal file
View File

@ -0,0 +1,4 @@
yggtk_resources = gnome.compile_resources(
'yggtk-resources',
'org.yggtk.yggtk.gresource.xml'
)

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="org/yggtk/yggtk">
<file preprocess="xml-stripblanks">ui/main.ui</file>
</gresource>
</gresources>

View File

@ -22,7 +22,7 @@ int main (string[] args) {
try {
var builder = new Builder ();
builder.add_from_file ("main.ui");
builder.add_from_resource ("/org/yggtk/yggtk/ui/main.ui");
builder.connect_signals (null);
var window = builder.get_object ("window") as Window;
var browse = builder.get_object ("browse") as Button;

View File

@ -5,14 +5,21 @@ project(
)
pkg = import('pkgconfig')
gnome = import('gnome')
subdir('data')
yggtk = executable(
meson.project_name(),
[
'main.vala',
],
] + yggtk_resources,
dependencies: [
dependency('gtk+-3.0'),
dependency('json-glib-1.0'),
],
vala_args: [
'--gresources',
join_paths(meson.source_root(), 'data', 'org.yggtk.yggtk.gresource.xml'),
]
)