Variant: Add Type property
This commit is contained in:
parent
dc0f50729a
commit
4158bc99f8
2 changed files with 15 additions and 1 deletions
|
@ -60,6 +60,18 @@ namespace GLib {
|
|||
this.handle = g_variant_ref_sink (handle);
|
||||
}
|
||||
|
||||
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_variant_get_type (IntPtr val);
|
||||
|
||||
VariantType type;
|
||||
public VariantType Type {
|
||||
get {
|
||||
if (type == null)
|
||||
type = new VariantType (g_variant_get_type (Handle));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (Global.GLibNativeDll, CallingConvention = CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_variant_new_variant (IntPtr val);
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace sample
|
|||
var asv = variant.ToAsv ();
|
||||
Console.WriteLine ("strv: " + asv["strv"].Print(true));
|
||||
Console.WriteLine ("unit: " + asv["unit"].Print(true));
|
||||
|
||||
Console.WriteLine ("type: " + variant.Type.ToString ());
|
||||
}
|
||||
|
||||
public static void Main (string[] args)
|
||||
|
@ -40,4 +42,4 @@ namespace sample
|
|||
new VariantDemo ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue