Missing support for `menu` elements in ui files
The [GtkChild]
attribute does not work for MenuModel objects defined using <menu>
in GtkBuilder XML. It gives an error that the child could not be found.
menu.vala
:
using Gtk;
[GtkTemplate(ui="/net/jwestman/Test/menu.ui")]
public class Test.Window : Gtk.Window {
[GtkChild] unowned GLib.MenuModel my_menu;
}
public static void main() {
}
menu.ui
:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="TestWindow" parent="GtkWindow"></template>
<menu id="my_menu"></menu>
</interface>
menu.gresource.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/net/jwestman/Test">
<file>menu.ui</file>
</gresource>
</gresources>
Compile with: valac --pkg=gtk+-3.0 --gresources=menu.gresource.xml menu.vala
Result:
menu.vala:5.16-5.45: error: could not find child `my_menu'
[GtkChild] unowned GLib.MenuModel my_menu;
I'm using valac version 0.54.7.
Edited by Rico Tzschichholz