Commit 21a2a70a authored by Rico Tzschichholz's avatar Rico Tzschichholz

girwriter: Write glib-type attributes for Enums/Structs with type_id

parent c0f3b2aa
......@@ -474,6 +474,11 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<record name=\"%s\"", get_gir_name (st));
if (get_ccode_has_type_id (st)) {
write_gtype_attributes (st);
} else {
write_ctype_attributes (st);
}
write_symbol_attributes (st);
buffer.append_printf (">\n");
indent++;
......@@ -664,7 +669,11 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<%s name=\"%s\"", element_name, get_gir_name (en));
write_gtype_attributes (en);
if (get_ccode_has_type_id (en)) {
write_gtype_attributes (en);
} else {
write_ctype_attributes (en);
}
write_symbol_attributes (en);
buffer.append_printf (">\n");
indent++;
......
......@@ -16,6 +16,11 @@
<member name="value2" c:identifier="GIR_TEST_FLAGS_TEST_VALUE2" value="2"/>
<member name="value3" c:identifier="GIR_TEST_FLAGS_TEST_VALUE3" value="4"/>
</bitfield>
<enumeration name="PlainEnumTest" c:type="GirTestPlainEnumTest">
<member name="value1" c:identifier="GIR_TEST_PLAIN_ENUM_TEST_VALUE1" value="0"/>
<member name="value2" c:identifier="GIR_TEST_PLAIN_ENUM_TEST_VALUE2" value="1"/>
<member name="value3" c:identifier="GIR_TEST_PLAIN_ENUM_TEST_VALUE3" value="4711"/>
</enumeration>
<enumeration name="SkippedEnum" c:type="GirTestSkippedEnum" glib:type-name="GirTestSkippedEnum" glib:get-type="gir_test_skipped_enum_get_type" introspectable="0">
<member name="value1" c:identifier="GIR_TEST_SKIPPED_ENUM_VALUE1" value="0"/>
</enumeration>
......@@ -928,7 +933,7 @@
<type name="GObject.TypeInterface" c:type="GTypeInterface"/>
</field>
</record>
<record name="BoxedStruct">
<record name="BoxedStruct" c:type="GirTestBoxedStruct" glib:type-name="GirTestBoxedStruct" glib:get-type="gir_test_boxed_struct_get_type">
<field name="field_name">
<type name="gint" c:type="gint"/>
</field>
......@@ -948,6 +953,26 @@
</return-value>
</method>
</record>
<record name="Struct" c:type="GirTestStruct">
<field name="field_name">
<type name="gint" c:type="gint"/>
</field>
<function name="init" c:identifier="gir_test_struct_init">
<return-value transfer-ownership="none">
<type name="none"/>
</return-value>
<parameters>
<parameter name="result" direction="out" transfer-ownership="full" caller-allocates="1">
<type name="GirTest.Struct" c:type="GirTestStruct*"/>
</parameter>
</parameters>
</function>
<method name="inv" c:identifier="gir_test_struct_inv">
<return-value transfer-ownership="full">
<type name="none"/>
</return-value>
</method>
</record>
<callback name="DelegateTest" c:type="GirTestDelegateTest">
<return-value transfer-ownership="full">
<type name="gboolean" c:type="gboolean"/>
......
......@@ -10,6 +10,17 @@ namespace GirTest {
}
}
[CCode (has_type_id = false)]
public struct Struct {
public int field_name;
public Struct () {
}
public void inv () {
}
}
[GIR (visible = false)]
public class SkippedStruct {
}
......@@ -30,6 +41,13 @@ namespace GirTest {
VALUE3
}
[CCode (has_type_id = false)]
public enum PlainEnumTest {
VALUE1,
VALUE2,
VALUE3 = 4711
}
[GIR (visible = false)]
public enum SkippedEnum {
VALUE1
......
......@@ -93,6 +93,12 @@ namespace GirTest {
public BoxedStruct ();
public void inv ();
}
[CCode (cheader_filename = "girtest.h", has_type_id = false)]
public struct Struct {
public int field_name;
public Struct ();
public void inv ();
}
[CCode (cheader_filename = "girtest.h")]
public enum EnumTest {
VALUE1,
......@@ -106,6 +112,12 @@ namespace GirTest {
VALUE2,
VALUE3
}
[CCode (cheader_filename = "girtest.h", has_type_id = false)]
public enum PlainEnumTest {
VALUE1,
VALUE2,
VALUE3
}
[CCode (cheader_filename = "girtest.h")]
[GIR (visible = false)]
public enum SkippedEnum {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment