Variant: Add wrapper for g_variant_new_strv()

This commit is contained in:
Xavier Claessens 2014-05-15 15:50:53 -04:00
parent c1fbe27b32
commit b357aaef84

View file

@ -114,6 +114,16 @@ namespace GLib {
Marshaller.Free (native_val); 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)] [DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
static extern bool g_variant_get_boolean (IntPtr handle); static extern bool g_variant_get_boolean (IntPtr handle);