summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-11-09 19:17:23 +0100
committerTomeu Vizoso <tomeu@sugarlabs.org>2009-11-11 13:55:00 +0100
commitf8693bda3775f6339f38a17c037ac7bc4a4cc3f7 (patch)
tree89456982ed5b6e8e5850a7c05f55a50f3be0c5fa /tools
parent3715b02198c9efc34d70f489d4e55a39456d8f99 (diff)
Implement callbacks as part of struct fields. Fixes #557383
gir: embed <callback> inside <field> typelib: if a field contains a callback, store it just after the FieldBlob girepository API: no additions
Diffstat (limited to 'tools')
-rw-r--r--tools/generate.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/generate.c b/tools/generate.c
index a71f365..fcff5b6 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -340,6 +340,11 @@ write_constant_value (const gchar *namespace,
Xml *file);
static void
+write_callback_info (const gchar *namespace,
+ GICallbackInfo *info,
+ Xml *file);
+
+static void
write_field_info (const gchar *namespace,
GIFieldInfo *info,
GIConstantInfo *branch,
@@ -350,6 +355,7 @@ write_field_info (const gchar *namespace,
gint size;
gint offset;
GITypeInfo *type;
+ GIBaseInfo *interface;
GArgument value;
name = g_base_info_get_name ((GIBaseInfo *)info);
@@ -389,8 +395,16 @@ write_field_info (const gchar *namespace,
if (offset >= 0)
xml_printf (file, "offset=\"%d\"", offset);
}
-
- write_type_info (namespace, type, file);
+
+ interface = g_type_info_get_interface (type);
+ if (interface && g_base_info_get_type(interface) == GI_INFO_TYPE_CALLBACK)
+ write_callback_info (namespace, (GICallbackInfo *)interface, file);
+ else
+ write_type_info (namespace, type, file);
+
+ if (interface)
+ g_base_info_unref (interface);
+
g_base_info_unref ((GIBaseInfo *)type);
xml_end_element (file, "field");