GtkDialog action-widgets not working
Trying to create a GtkDialog with action widgets using this syntax:
using Gtk 4.0;
using Adw 1;
template NewProfileDialog : Gtk.Dialog {
default-width: 480;
default-height: 240;
title: _("Add Profile");
modal: true;
[action response=ok default]
Gtk.Button ok_response {
label: _("Start");
use-underline: true;
sensitive: true;
styles ["suggested-action"]
}
[action response=cancel]
Gtk.Button cancel_response {
label: _("Cancel");
action-name: "window.close";
}
}
The [action response=ok default]
should generate the <action-widgets>
tag in the .ui
files.
The output is like this though:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<template class="NewProfileDialog" parent="GtkDialog">
<property name="default-width">480</property>
<property name="default-height">240</property>
<property name="title" translatable="true">Add Profile</property>
<property name="modal">true</property>
<child type="action">
<object class="GtkButton" id="ok_response">
<property name="label" translatable="true">Start</property>
<property name="use-underline">true</property>
<property name="sensitive">true</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
<child type="action">
<object class="GtkButton" id="cancel_response">
<property name="label" translatable="true">Cancel</property>
<property name="action-name">window.close</property>
</object>
</child>
</template>
</interface>
Edited by Stefan Rupertsberger