mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-11 15:15:37 +00:00
2008-08-20 Mike Kestner <mkestner@novell.com>
Patch from Christian Hoff fixing bug #396195. * generator/Property.cs: handle interface adapter values. * generator/InterfaceGen.cs: register the gtype so mapping occurs automatically for interface adapters. New GetObject overload to handle already wrapped objects more efficiently. * glib/Value.cs: handle set_Val for interface adapter objects. svn path=/trunk/gtk-sharp/; revision=111154
This commit is contained in:
parent
70b8817f12
commit
b2e51e9989
|
@ -1,3 +1,12 @@
|
|||
2008-08-20 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
Patch from Christian Hoff fixing bug #396195.
|
||||
* generator/Property.cs: handle interface adapter values.
|
||||
* generator/InterfaceGen.cs: register the gtype so mapping occurs
|
||||
automatically for interface adapters. New GetObject overload to
|
||||
handle already wrapped objects more efficiently.
|
||||
* glib/Value.cs: handle set_Val for interface adapter objects.
|
||||
|
||||
2008-08-19 Brad Taylor <brad@getcoded.net>
|
||||
|
||||
* atk/Object.custom: Add method to allow emission of
|
||||
|
|
|
@ -125,6 +125,7 @@ namespace GtkSharp.Generation {
|
|||
{
|
||||
sw.WriteLine ("\t\tstatic " + Name + "Adapter ()");
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\tGLib.GType.Register (_gtype, typeof({0}Adapter));", Name);
|
||||
foreach (VirtualMethod vm in vms) {
|
||||
bool has_target = methods [vm.Name] != null;
|
||||
if (has_target && vm.IsValid)
|
||||
|
@ -183,9 +184,11 @@ namespace GtkSharp.Generation {
|
|||
{
|
||||
Method m = GetMethod ("GetType");
|
||||
m.GenerateImport (sw);
|
||||
sw.WriteLine ("\t\tprivate static GLib.GType _gtype = new GLib.GType ({0} ());", m.CName);
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tpublic override GLib.GType GType {");
|
||||
sw.WriteLine ("\t\t\tget {");
|
||||
sw.WriteLine ("\t\t\t\treturn new GLib.GType (" + m.CName + " ());");
|
||||
sw.WriteLine ("\t\t\t\treturn _gtype;");
|
||||
sw.WriteLine ("\t\t\t}");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
|
@ -209,8 +212,13 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\t\tpublic static " + Name + " GetObject (IntPtr handle, bool owned)");
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\tGLib.Object obj = GLib.Object.GetObject (handle, owned);");
|
||||
sw.WriteLine ("\t\t\tif (obj == null)");
|
||||
sw.WriteLine ("\t\t\t\treturn null;");
|
||||
sw.WriteLine ("\t\t\treturn GetObject (obj);");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tpublic static " + Name + " GetObject (GLib.Object obj)");
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\tif (obj == null)");
|
||||
sw.WriteLine ("\t\t\t\treturn null;");
|
||||
sw.WriteLine ("\t\t\telse if (obj is " + Name + "Implementor)");
|
||||
sw.WriteLine ("\t\t\t\treturn new {0}Adapter (obj as {0}Implementor);", Name);
|
||||
sw.WriteLine ("\t\t\telse if (obj as " + Name + " == null)");
|
||||
|
@ -259,7 +267,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
GenProperties (gen_info, null);
|
||||
|
||||
foreach (Signal sig in sigs.Values)
|
||||
foreach (Signal sig in sigs.Values)
|
||||
sig.GenEvent (sw, null, "GLib.Object.GetObject (Handle)");
|
||||
|
||||
Method temp = methods ["GetType"] as Method;
|
||||
|
|
|
@ -142,6 +142,9 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine(indent + "\tGLib.Value val = " + RawGetter (qpname) + ";");
|
||||
if (table.IsOpaque (CType) || table.IsBoxed (CType)) {
|
||||
sw.WriteLine(indent + "\t" + CSType + " ret = (" + CSType + ") val;");
|
||||
} else if (table.IsInterface (CType)) {
|
||||
// Do we have to dispose the GLib.Object from the GLib.Value?
|
||||
sw.WriteLine (indent + "\t{0} ret = {0}Adapter.GetObject ((GLib.Object) val);", CSType);
|
||||
} else {
|
||||
sw.Write(indent + "\t" + CSType + " ret = ");
|
||||
sw.Write ("(" + CSType + ") ");
|
||||
|
|
|
@ -427,7 +427,10 @@ namespace GLib {
|
|||
g_value_set_boxed (ref this, wrapper);
|
||||
ManagedValue.ReleaseWrapper (wrapper);
|
||||
} else if (g_type_is_a (type, GType.Object.Val))
|
||||
g_value_set_object (ref this, ((GLib.Object) value).Handle);
|
||||
if(value is GLib.Object)
|
||||
g_value_set_object (ref this, (value as GLib.Object).Handle);
|
||||
else
|
||||
g_value_set_object (ref this, (value as GLib.GInterfaceAdapter).Handle);
|
||||
else if (g_type_is_a (type, GType.Boxed.Val)) {
|
||||
if (value is IWrapper) {
|
||||
g_value_set_boxed (ref this, ((IWrapper)value).Handle);
|
||||
|
|
Loading…
Reference in a new issue