[vala/staging] girwriter: Output default handler of signals
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girwriter: Output default handler of signals
- Date: Sat, 20 Feb 2021 19:09:05 +0000 (UTC)
commit 31c2d6afdad13bab5fc307542f245c9cfde989d3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Feb 20 20:04:08 2021 +0100
girwriter: Output default handler of signals
codegen/valagirwriter.vala | 6 +++++-
tests/girwriter/GirTest-1.0.gir-expected | 13 +++++++++++++
tests/girwriter/girtest.vapigen-expected | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 6ba2a0e5c..480a99247 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1276,7 +1276,7 @@ public class Vala.GIRWriter : CodeVisitor {
tag_name = "function";
}
- if (!get_ccode_no_wrapper (m)) {
+ if (!get_ccode_no_wrapper (m) && m.signal_reference == null) {
write_signature (m, tag_name, true);
}
@@ -1482,6 +1482,10 @@ public class Vala.GIRWriter : CodeVisitor {
sig.emitter.accept (this);
}
+ if (sig.default_handler != null) {
+ sig.default_handler.accept (this);
+ }
+
write_indent ();
buffer.append_printf ("<glib:signal name=\"%s\"", get_ccode_name (sig));
write_symbol_attributes (sig);
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 6be6fd561..18502ffc8 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -968,6 +968,19 @@
</parameter>
</parameters>
</glib:signal>
+ <virtual-method name="signal_with_default_handlder" invoker="signal_with_default_handlder">
+ <return-value transfer-ownership="full">
+ <type name="none" c:type="void"/>
+ </return-value>
+ <parameters>
+ <instance-parameter name="self" transfer-ownership="none">
+ <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
+ </instance-parameter>
+ <parameter name="i1" transfer-ownership="none">
+ <type name="gint" c:type="gint"/>
+ </parameter>
+ </parameters>
+ </virtual-method>
<glib:signal name="signal-with-default-handlder">
<return-value transfer-ownership="full">
<type name="none" c:type="void"/>
diff --git a/tests/girwriter/girtest.vapigen-expected b/tests/girwriter/girtest.vapigen-expected
index af3c73862..1bb13d94d 100644
--- a/tests/girwriter/girtest.vapigen-expected
+++ b/tests/girwriter/girtest.vapigen-expected
@@ -130,7 +130,7 @@ namespace GirTest {
public string construct_only_property { construct; }
public string some_property { get; set construct; }
public string write_only_property { set; }
- public signal void signal_with_default_handlder (int i1);
+ public virtual signal void signal_with_default_handlder (int i1);
public signal void some_signal (int param);
}
[CCode (cheader_filename = "girtest.h", type_id = "gir_test_sub_type_test_get_type ()")]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]