static Type GetTypeOrParent(IntPtr obj) { IntPtr typeid = gstsharp_g_type_from_instance(obj); if (typeid == GType.Invalid.Val) { return(null); } Type result = GType.LookupType(typeid); while (result == null) { typeid = g_type_parent(typeid); if (typeid == IntPtr.Zero) { return(null); } result = GType.LookupType(typeid); } return(result); }