diff --git a/ChangeLog b/ChangeLog index 9e52bf3de..0c6eb5a60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-05-17 Mike Kestner + + * generator/SignalHandler.cs : fix some broken/redundant generation in + the Object/Struct wrapping for sig params. + * glib/Object.cs : internalize/protect lots of API that shouldn't need + to be used by non-subclass/non-glib code. Return GType.Object as GType. + * glib/Value.cs : use internal GLib.Object.NativeType prop. + * sample/TestDnd.cs : use ToString instead of TypeName. + 2004-05-14 Todd Berman * glib/Object.cs: make static GLib.Object.LookupGType protected for now. diff --git a/generator/SignalHandler.cs b/generator/SignalHandler.cs index cb36523da..58c5eef9a 100644 --- a/generator/SignalHandler.cs +++ b/generator/SignalHandler.cs @@ -146,14 +146,7 @@ namespace GtkSharp.Generation { sw.WriteLine("\t\t\tif (arg{0} == IntPtr.Zero)", idx); sw.WriteLine("\t\t\t\targs.Args[{0}] = null;", idx - 1); sw.WriteLine("\t\t\telse {"); - if (wrapper != null && wrapper is ObjectGen) - sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = GLib.Object.GetObject(arg" + idx + ", false);"); - else - sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";"); - if ((wrapper != null && (wrapper is OpaqueGen)) || table.IsManuallyWrapped (ctype)) { - sw.WriteLine("\t\t\t\tif (args.Args[" + (idx-1) + "] == null)"); - sw.WriteLine("\t\t\t\t\targs.Args[{0}] = new {1}(arg{2});", idx-1, table.GetCSType (ctype), idx); - } + sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";"); sw.WriteLine("\t\t\t}"); } else { sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";"); diff --git a/glib/Object.cs b/glib/Object.cs index 5fa4aa011..ede5150bc 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -125,7 +125,7 @@ namespace GLib { [DllImport("glibsharpglue")] static extern IntPtr gtksharp_register_type (string name, IntPtr parent_type); - public static GType RegisterGType (System.Type t) + protected static GType RegisterGType (System.Type t) { GType parent_gtype = LookupGType (t.BaseType); string name = t.FullName.Replace(".", "_"); @@ -139,7 +139,7 @@ namespace GLib { static Hashtable g_types = new Hashtable (); - public GType LookupGType () + protected GType LookupGType () { return LookupGType (GetType ()); } @@ -156,7 +156,7 @@ namespace GLib { return RegisterGType (t); } - public Object (IntPtr raw) + protected Object (IntPtr raw) { Raw = raw; } @@ -190,22 +190,22 @@ namespace GLib { [DllImport("glibsharpglue")] private static extern IntPtr gtksharp_get_type_id (IntPtr obj); - public static GLib.GType GType { + protected static GLib.GType GType { get { - return GType.Invalid; + return GType.Object; } } [DllImport("glibsharpglue")] static extern IntPtr gtksharp_get_type_name (IntPtr raw); - public string TypeName { + protected string TypeName { get { return Marshal.PtrToStringAnsi (gtksharp_get_type_name (Raw)); } } - public GLib.GType NativeType { + internal GLib.GType NativeType { get { if (_obj == IntPtr.Zero) return GType.Invalid; @@ -310,7 +310,7 @@ namespace GLib { [DllImport("glibsharpglue")] static extern int gtksharp_object_get_ref_count (IntPtr obj); - public int RefCount { + protected int RefCount { get { return gtksharp_object_get_ref_count (Handle); } diff --git a/glib/Value.cs b/glib/Value.cs index 0043f1bb4..4d6bd8dc6 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -162,7 +162,7 @@ namespace GLib { { type = IntPtr.Zero; pad_1 = pad_2 = 0; - gtksharp_value_create_from_type_and_property (ref this, obj.LookupGType ().Val, prop_name); + gtksharp_value_create_from_type_and_property (ref this, obj.NativeType.Val, prop_name); if (wrap.flags) g_value_set_flags (ref this, (uint) (int) wrap); else diff --git a/sample/TestDnd.cs b/sample/TestDnd.cs index a545448ec..07bce5797 100644 --- a/sample/TestDnd.cs +++ b/sample/TestDnd.cs @@ -302,7 +302,7 @@ public class TestDnd { } Widget source_widget = Gtk.Drag.GetSourceWidget (args.Context); - Console.WriteLine ("motion, source {0}", source_widget == null ? "null" : source_widget.TypeName); + Console.WriteLine ("motion, source {0}", source_widget == null ? "null" : source_widget.ToString ()); Atom [] targets = args.Context.Targets; foreach (Atom a in targets)