[template-glib] gi: locate GTypes from GIRegisteredTypeInfo
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [template-glib] gi: locate GTypes from GIRegisteredTypeInfo
- Date: Mon, 23 Oct 2017 23:36:18 +0000 (UTC)
commit 740490e16e918adfbf991a5e46d4a137d7b6703a
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 23 16:33:38 2017 -0700
gi: locate GTypes from GIRegisteredTypeInfo
This allows you to convert something like GObject.Object into a
GType when the GI parameter is expected a GType.
src/tmpl-gi.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/tmpl-gi.c b/src/tmpl-gi.c
index 092fff1..2c04c54 100644
--- a/src/tmpl-gi.c
+++ b/src/tmpl-gi.c
@@ -142,6 +142,10 @@ tmpl_gi_argument_from_g_value (const GValue *value,
case GI_TYPE_TAG_GTYPE:
if (G_VALUE_HOLDS (value, G_TYPE_GTYPE))
arg->v_long = g_value_get_gtype (value);
+ else if (G_VALUE_HOLDS (value, TMPL_TYPE_BASE_INFO) &&
+ g_value_get_pointer (value) != NULL &&
+ GI_IS_REGISTERED_TYPE_INFO (g_value_get_pointer (value)))
+ arg->v_long = g_registered_type_info_get_g_type (g_value_get_pointer (value));
else
return_type_mismatch (value, G_TYPE_GTYPE);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]