revert r122505

svn path=/trunk/gtk-sharp/; revision=122553
This commit is contained in:
Andrés G. Aragoneses 2009-01-06 15:27:12 +00:00
parent 7c835c46c5
commit 8ffc1097fb
3 changed files with 18 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2009-01-05 Andrés G. Aragoneses <aaragoneses@novell.com>
* GType.cs:
* Value.cs: Revert r122505.
[Reasoning on #448009]
2009-01-06 Stephane Delcroix <sdelcroix@novell.com> 2009-01-06 Stephane Delcroix <sdelcroix@novell.com>
* gtk/Gtk.metadata: fix gtk_icon_theme_lookup_by_gicon return-type * gtk/Gtk.metadata: fix gtk_icon_theme_lookup_by_gicon return-type

View File

@ -334,14 +334,14 @@ namespace GLib {
return Marshal.ReadIntPtr (klass); return Marshal.ReadIntPtr (klass);
} }
internal bool IsA (IntPtr type) internal static bool Is (IntPtr type, GType is_a_type)
{ {
return g_type_is_a (type, Val); return g_type_is_a (type, is_a_type.Val);
} }
public bool IsInstance (IntPtr raw) public bool IsInstance (IntPtr raw)
{ {
return IsA (ValFromInstancePtr (raw)); return GType.Is (ValFromInstancePtr (raw), this);
} }
[DllImport("libgobject-2.0-0.dll")] [DllImport("libgobject-2.0-0.dll")]

View File

@ -351,8 +351,8 @@ namespace GLib {
return (long) this; return (long) this;
else if (type == GType.UInt64.Val) else if (type == GType.UInt64.Val)
return (ulong) this; return (ulong) this;
else if (GType.Enum.IsA (type) || else if (GType.Is (type, GType.Enum) ||
GType.Flags.IsA (type)) GType.Is (type, GType.Flags))
return (Enum) this; return (Enum) this;
else if (type == GType.Float.Val) else if (type == GType.Float.Val)
return (float) this; return (float) this;
@ -366,9 +366,9 @@ namespace GLib {
return g_value_get_param (ref this); return g_value_get_param (ref this);
else if (type == ManagedValue.GType.Val) else if (type == ManagedValue.GType.Val)
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this)); return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
else if (GType.Object.IsA (type)) else if (GType.Is (type, GType.Object))
return (GLib.Object) this; return (GLib.Object) this;
else if (GType.Boxed.IsA (type)) else if (GType.Is (type, GType.Boxed))
return ToBoxed (); return ToBoxed ();
else if (type == IntPtr.Zero) else if (type == IntPtr.Zero)
return null; return null;
@ -390,9 +390,9 @@ namespace GLib {
g_value_set_int64 (ref this, (long) value); g_value_set_int64 (ref this, (long) value);
else if (type == GType.UInt64.Val) else if (type == GType.UInt64.Val)
g_value_set_uint64 (ref this, (ulong) value); g_value_set_uint64 (ref this, (ulong) value);
else if (GType.Enum.IsA (type)) else if (GType.Is (type, GType.Enum))
g_value_set_enum (ref this, (int)value); g_value_set_enum (ref this, (int)value);
else if (GType.Flags.IsA (type)) else if (GType.Is (type, GType.Flags))
g_value_set_flags (ref this, (uint)(int)value); g_value_set_flags (ref this, (uint)(int)value);
else if (type == GType.Float.Val) else if (type == GType.Float.Val)
g_value_set_float (ref this, (float) value); g_value_set_float (ref this, (float) value);
@ -419,12 +419,12 @@ namespace GLib {
IntPtr wrapper = ManagedValue.WrapObject (value); IntPtr wrapper = ManagedValue.WrapObject (value);
g_value_set_boxed (ref this, wrapper); g_value_set_boxed (ref this, wrapper);
ManagedValue.ReleaseWrapper (wrapper); ManagedValue.ReleaseWrapper (wrapper);
} else if (GType.Object.IsA (type)) } else if (GType.Is (type, GType.Object))
if(value is GLib.Object) if(value is GLib.Object)
g_value_set_object (ref this, (value as GLib.Object).Handle); g_value_set_object (ref this, (value as GLib.Object).Handle);
else else
g_value_set_object (ref this, (value as GLib.GInterfaceAdapter).Handle); g_value_set_object (ref this, (value as GLib.GInterfaceAdapter).Handle);
else if (GType.Boxed.IsA (type)) { else if (GType.Is (type, GType.Boxed)) {
if (value is IWrapper) { if (value is IWrapper) {
g_value_set_boxed (ref this, ((IWrapper)value).Handle); g_value_set_boxed (ref this, ((IWrapper)value).Handle);
return; return;
@ -439,7 +439,7 @@ namespace GLib {
internal void Update (object val) internal void Update (object val)
{ {
if (GType.Boxed.IsA (type) && !(val is IWrapper)) if (GType.Is (type, GType.Boxed) && !(val is IWrapper))
Marshal.StructureToPtr (val, g_value_get_boxed (ref this), false); Marshal.StructureToPtr (val, g_value_get_boxed (ref this), false);
} }