2004-05-17 Mike Kestner <mkestner@ximian.com>

* 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.

svn path=/trunk/gtk-sharp/; revision=27530
This commit is contained in:
Mike Kestner 2004-05-17 17:52:00 +00:00
parent bcb922a320
commit ffe268c415
5 changed files with 20 additions and 18 deletions

View File

@ -1,3 +1,12 @@
2004-05-17 Mike Kestner <mkestner@ximian.com>
* 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 <tberman@sevenl.net> 2004-05-14 Todd Berman <tberman@sevenl.net>
* glib/Object.cs: make static GLib.Object.LookupGType protected for now. * glib/Object.cs: make static GLib.Object.LookupGType protected for now.

View File

@ -146,14 +146,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t\tif (arg{0} == IntPtr.Zero)", idx); 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\t\targs.Args[{0}] = null;", idx - 1);
sw.WriteLine("\t\t\telse {"); sw.WriteLine("\t\t\telse {");
if (wrapper != null && wrapper is ObjectGen) sw.WriteLine("\t\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";");
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}"); sw.WriteLine("\t\t\t}");
} else { } else {
sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";"); sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = " + table.FromNative (ctype, "arg" + idx) + ";");

View File

@ -125,7 +125,7 @@ namespace GLib {
[DllImport("glibsharpglue")] [DllImport("glibsharpglue")]
static extern IntPtr gtksharp_register_type (string name, IntPtr parent_type); 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); GType parent_gtype = LookupGType (t.BaseType);
string name = t.FullName.Replace(".", "_"); string name = t.FullName.Replace(".", "_");
@ -139,7 +139,7 @@ namespace GLib {
static Hashtable g_types = new Hashtable (); static Hashtable g_types = new Hashtable ();
public GType LookupGType () protected GType LookupGType ()
{ {
return LookupGType (GetType ()); return LookupGType (GetType ());
} }
@ -156,7 +156,7 @@ namespace GLib {
return RegisterGType (t); return RegisterGType (t);
} }
public Object (IntPtr raw) protected Object (IntPtr raw)
{ {
Raw = raw; Raw = raw;
} }
@ -190,22 +190,22 @@ namespace GLib {
[DllImport("glibsharpglue")] [DllImport("glibsharpglue")]
private static extern IntPtr gtksharp_get_type_id (IntPtr obj); private static extern IntPtr gtksharp_get_type_id (IntPtr obj);
public static GLib.GType GType { protected static GLib.GType GType {
get { get {
return GType.Invalid; return GType.Object;
} }
} }
[DllImport("glibsharpglue")] [DllImport("glibsharpglue")]
static extern IntPtr gtksharp_get_type_name (IntPtr raw); static extern IntPtr gtksharp_get_type_name (IntPtr raw);
public string TypeName { protected string TypeName {
get { get {
return Marshal.PtrToStringAnsi (gtksharp_get_type_name (Raw)); return Marshal.PtrToStringAnsi (gtksharp_get_type_name (Raw));
} }
} }
public GLib.GType NativeType { internal GLib.GType NativeType {
get { get {
if (_obj == IntPtr.Zero) if (_obj == IntPtr.Zero)
return GType.Invalid; return GType.Invalid;
@ -310,7 +310,7 @@ namespace GLib {
[DllImport("glibsharpglue")] [DllImport("glibsharpglue")]
static extern int gtksharp_object_get_ref_count (IntPtr obj); static extern int gtksharp_object_get_ref_count (IntPtr obj);
public int RefCount { protected int RefCount {
get { get {
return gtksharp_object_get_ref_count (Handle); return gtksharp_object_get_ref_count (Handle);
} }

View File

@ -162,7 +162,7 @@ namespace GLib {
{ {
type = IntPtr.Zero; type = IntPtr.Zero;
pad_1 = pad_2 = 0; 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) if (wrap.flags)
g_value_set_flags (ref this, (uint) (int) wrap); g_value_set_flags (ref this, (uint) (int) wrap);
else else

View File

@ -302,7 +302,7 @@ public class TestDnd {
} }
Widget source_widget = Gtk.Drag.GetSourceWidget (args.Context); 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; Atom [] targets = args.Context.Targets;
foreach (Atom a in targets) foreach (Atom a in targets)