Add dialog actions

This commit is contained in:
James Westman 2022-02-02 15:39:55 -06:00
parent bac008296a
commit 8ba898e354
10 changed files with 115 additions and 3 deletions

View file

@ -0,0 +1,6 @@
using Gtk 4.0;
Box {
[action response=ok]
Label {}
}

View file

@ -0,0 +1 @@
4,4,6,Parent type Gtk.Box does not have action widgets

View file

@ -0,0 +1,6 @@
using Gtk 4.0;
Dialog {
[action response=foo]
Button {}
}

View file

@ -0,0 +1 @@
4,20,3,foo is not a member of Gtk.ResponseType

View file

@ -0,0 +1,8 @@
using Gtk 4.0;
Gtk.Dialog {
[action response=1]
Button {}
[action response=cancel]
Button cancel {}
}

16
tests/samples/actions.ui Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkDialog">
<child type="action">
<object class="GtkButton" id="__1"></object>
</child>
<child type="action">
<object class="GtkButton" id="cancel"></object>
</child>
<action-widgets>
<action-widget response="1">__1</action-widget>
<action-widget response="cancel">cancel</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -111,6 +111,7 @@ class TestSamples(unittest.TestCase):
def test_samples(self):
self.assert_sample("accessibility")
self.assert_sample("actions")
self.assert_sample("binding")
self.assert_sample("child_type")
self.assert_sample("combo_box_text")
@ -141,6 +142,8 @@ class TestSamples(unittest.TestCase):
self.assert_sample_error("a11y_prop_dne")
self.assert_sample_error("a11y_prop_obj_dne")
self.assert_sample_error("a11y_prop_type")
self.assert_sample_error("action_parent")
self.assert_sample_error("action_response")
self.assert_sample_error("class_assign")
self.assert_sample_error("class_dne")
self.assert_sample_error("consecutive_unexpected_tokens")