The Adw.PreferencesWindow
inherits from GtkBuildable
but there seems to be no example of how to create it in a .ui
file in the documentation. I tried extending it using a template
element like in the code below but I keep getting this warning:
Adwaita-WARNING **: 18:51:32.879: Child name 'test_1' not found in AdwViewStack
Here are the .ui
contents. I have no idea what to do here.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.10" />
<requires lib="Adw" version="1.0" />
<template class="Gjs_MyPreferencesWindow" parent="AdwPreferencesWindow">
<property name="default_width">500</property>
<property name="default_height">500</property>
<property name="modal">true</property>
<property name="title">Preferences test</property>
<property name="visible_page_name">test_1</property>
<property name="destroy_with_parent">true</property>
<property name="content">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="AdwPreferencesPage" id="test_1">
<property name="name">test_1</property>
<property name="title">Test Page 1</property>
</object>
</child>
<child>
<object class="AdwPreferencesPage">
<property name="name">test_2</property>
<property name="title">Test Page 2</property>
</object>
</child>
<child>
<object class="AdwPreferencesPage">
<property name="name">test_3</property>
<property name="title">Test Page 3</property>
</object>
</child>
</object>
</property>
</template>
</interface>
The warning mentions AdwViewStack
. I wonder where it is coming from.
And I also wonder why it forced me to prepend the Gjs_
characters to the GtypeName so that I have Gjs_MyPreferencesWindow
. Without adding the Gjs_
characters to the template class, the template build fails.