[perl-Glib-Object-Introspection] Handle GType arguments



commit 587bafb68af67c1c0c3fd59d86828bee144ce05a
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Oct 16 15:11:38 2010 +0200

    Handle GType arguments

 GObjectIntrospection.xs |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index 30805ba..550717e 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -887,6 +887,13 @@ sv_to_arg (SV * sv,
 		arg->v_double = SvNV (sv);
 		break;
 
+	    case GI_TYPE_TAG_GTYPE:
+		/* GType == gsize */
+		arg->v_size = gperl_type_from_package (SvPV_nolen (sv));
+		if (!arg->v_size)
+			arg->v_size = g_type_from_name (SvPV_nolen (sv));
+		break;
+
 	    case GI_TYPE_TAG_ARRAY:
 		croak ("FIXME - GI_TYPE_TAG_ARRAY");
 		break;
@@ -977,6 +984,14 @@ arg_to_sv (GArgument * arg,
 	    case GI_TYPE_TAG_DOUBLE:
 		return newSVnv (arg->v_double);
 
+	    case GI_TYPE_TAG_GTYPE: {
+		/* GType == gsize */
+		const char *package = gperl_package_from_type (arg->v_size);
+		if (!package)
+			package = g_type_name (arg->v_size);
+		return newSVpv (package, PL_na);
+	    }
+
 	    case GI_TYPE_TAG_ARRAY:
 		return array_to_sv (info, arg->v_pointer, transfer);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]