From b357aaef842a164fef235ec5fe8d7a363547abca Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 15 May 2014 15:50:53 -0400 Subject: [PATCH] Variant: Add wrapper for g_variant_new_strv() --- glib/Variant.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/glib/Variant.cs b/glib/Variant.cs index 6da8ca838..9ff39f670 100644 --- a/glib/Variant.cs +++ b/glib/Variant.cs @@ -114,6 +114,16 @@ namespace GLib { Marshaller.Free (native_val); } + [DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr g_variant_new_strv (IntPtr[] strv, IntPtr length); + + public Variant (string[] strv) + { + IntPtr[] native = Marshaller.StringArrayToNullTermPointer (strv); + handle = g_variant_ref_sink (g_variant_new_strv (native, new IntPtr ((long) strv.Length))); + Marshaller.Free (native); + } + [DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)] static extern bool g_variant_get_boolean (IntPtr handle);