[template-glib] gi: handle unmarshalling from gi call
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [template-glib] gi: handle unmarshalling from gi call
- Date: Tue, 24 Oct 2017 06:43:11 +0000 (UTC)
commit 40a8f29082c5490c1778055db487f21b65684677
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 23 23:41:43 2017 -0700
gi: handle unmarshalling from gi call
We need to handle object/interface from return types to
support iterating GListModel better.
src/tmpl-gi.c | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/src/tmpl-gi.c b/src/tmpl-gi.c
index ac59dba..4a5c95a 100644
--- a/src/tmpl-gi.c
+++ b/src/tmpl-gi.c
@@ -326,11 +326,6 @@ tmpl_gi_argument_to_g_value (GValue *value,
tag = g_type_info_get_tag (type_info);
- if (tag == GI_TYPE_TAG_INTERFACE)
- {
- g_warning ("TODO: proper return marshaling");
- }
-
switch (tag)
{
case GI_TYPE_TAG_VOID:
@@ -403,8 +398,46 @@ tmpl_gi_argument_to_g_value (GValue *value,
g_value_set_string (value, arg->v_string);
return TRUE;
- case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_INTERFACE:
+ {
+ g_autoptr(GIBaseInfo) info = g_type_info_get_interface (type_info);
+ GIInfoType info_type = g_base_info_get_type (info);
+
+ switch (info_type)
+ {
+ case GI_INFO_TYPE_INTERFACE:
+ case GI_INFO_TYPE_OBJECT:
+ g_value_init (value, G_TYPE_OBJECT);
+ g_value_set_object (value, arg->v_pointer);
+ return TRUE;
+
+ case GI_INFO_TYPE_FLAGS:
+ case GI_INFO_TYPE_ENUM:
+ case GI_INFO_TYPE_BOXED:
+ case GI_INFO_TYPE_STRUCT:
+ case GI_INFO_TYPE_UNION:
+ case GI_INFO_TYPE_INVALID:
+ case GI_INFO_TYPE_INVALID_0:
+ case GI_INFO_TYPE_FUNCTION:
+ case GI_INFO_TYPE_CONSTANT:
+ case GI_INFO_TYPE_CALLBACK:
+ case GI_INFO_TYPE_VALUE:
+ case GI_INFO_TYPE_SIGNAL:
+ case GI_INFO_TYPE_VFUNC:
+ case GI_INFO_TYPE_PROPERTY:
+ case GI_INFO_TYPE_FIELD:
+ case GI_INFO_TYPE_ARG:
+ case GI_INFO_TYPE_TYPE:
+ case GI_INFO_TYPE_UNRESOLVED:
+ default:
+ g_warning ("TODO: proper return marshaling");
+ /* TODO: more marshalling of return types */
+ break;
+ }
+ }
+ break;
+
+ case GI_TYPE_TAG_ARRAY:
case GI_TYPE_TAG_GLIST:
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]