Please help me. I am trying to add an embedded resource for UI.
I catch an error.
Unknown template
TestView' in ui file
Resources/UI/TestView.ui’
Works.
[GtkTemplate(ui = "UI/TestView.ui")]
public class TestView : Gtk.ApplicationWindow
{
public TestView()
{
}
}
But not working.
namespace Test.MVP.View
{
[GtkTemplate(ui = "UI/TestView.ui")]
public class TestView : Gtk.ApplicationWindow
{
public TestView()
{
}
}
}
Build command
valac {sources} -o Build/Test --pkg gtk4 --gresources=Resources/Resources.xml
Resources/UI/TestView.ui.
<?xml version='1.0' encoding='UTF-8'?>
<interface>
<requires lib="gtk" version="4.6"/>
<template class="TestView" parent="GtkApplicationWindow"/>
</interface>
Resources/Resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="">
<file preprocess="xml-stripblanks">UI/TestView.ui</file>
</gresource>
</gresources>