diff --git a/ChangeLog b/ChangeLog index e8009a6a4..e55f4484b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-10-11 Mike Kestner + + * generator/Parameters.cs : Properly handle out params for + Object and Opaque types. + * gtk/ListStore.custom: remove out on GetValue overload + * gtk/TreeStore.custom: remove out on GetValue overload + * gtk/gtk-api.xml : regenerated + * sources/Gtk.metadata : remove some incorrect out tags + 2003-10-10 Mike Kestner * gtk/gtk-api.xml : regenerated diff --git a/generator/Parameters.cs b/generator/Parameters.cs index 19612bf08..52aad8600 100644 --- a/generator/Parameters.cs +++ b/generator/Parameters.cs @@ -260,7 +260,7 @@ namespace GtkSharp.Generation { } else call_parm = table.CallByName(type, call_parm_name); - if (this [i].NullOk && cs_type != "IntPtr" && cs_type != "System.IntPtr" && !table.IsStruct (type)) + if (this [i].NullOk && !cs_type.EndsWith ("IntPtr") && !table.IsStruct (type)) call_parm = String.Format ("({0} != null) ? {1} : {2}", call_parm_name, call_parm, table.IsCallback (type) ? "null" : "IntPtr.Zero"); if (this [i].IsArray) @@ -294,6 +294,11 @@ namespace GtkSharp.Generation { if (table.IsEnum (type)) call_parm = name + "_as_int"; + else if (table.IsObject (type) || table.IsOpaque (type) || cs_type == "GLib.Value") { + call_parm = this [i].PassAs + " " + call_parm.Replace (".Handle", "_handle"); + import_sig += this [i].PassAs + " "; + } + } else if (type == "GError**") { call_string += "out "; import_sig += "out "; @@ -339,11 +344,14 @@ namespace GtkSharp.Generation { if (is_set) name = "value"; - if (is_get) + if (is_get) { sw.WriteLine (indent + "\t\t\t" + p.CSType + " " + name + ";"); + if (gen is ObjectGen || gen is OpaqueGen || p.CSType == "GLib.Value") + sw.WriteLine(indent + "\t\t\t" + name + " = new " + p.CSType + "();"); + } if ((is_get || p.PassAs == "out") && (gen is ObjectGen || gen is OpaqueGen || p.CSType == "GLib.Value")) - sw.WriteLine(indent + "\t\t\t" + name + " = new " + p.CSType + "();"); + sw.WriteLine(indent + "\t\t\tIntPtr " + name + "_handle;"); if (p.PassAs == "out" && gen is EnumGen) sw.WriteLine(indent + "\t\t\tint " + name + "_as_int;"); @@ -365,11 +373,21 @@ namespace GtkSharp.Generation { public void Finish (StreamWriter sw, string indent) { + bool ref_owned_needed = true; foreach (Parameter p in param_list) { if (p.PassAs == "out" && p.Generatable is EnumGen) { sw.WriteLine(indent + "\t\t\t" + p.Name + " = (" + p.CSType + ") " + p.Name + "_as_int;"); } + + IGeneratable gen = p.Generatable; + if (ref_owned_needed && gen is ObjectGen && p.PassAs == "out") { + ref_owned_needed = false; + sw.WriteLine(indent + "\t\t\tbool ref_owned = false;"); + } + + if (p.PassAs == "out" && (gen is ObjectGen || gen is OpaqueGen || p.CSType == "GLib.Value")) + sw.WriteLine(indent + "\t\t\t" + p.Name + " = " + gen.FromNativeReturn (p.Name + "_handle") + ";"); } } diff --git a/gtk/ListStore.custom b/gtk/ListStore.custom index 9992e6607..41859ca05 100644 --- a/gtk/ListStore.custom +++ b/gtk/ListStore.custom @@ -106,8 +106,8 @@ } public object GetValue(Gtk.TreeIter iter, int column) { - GLib.Value val; - GetValue (iter, column, out val); + GLib.Value val = new GLib.Value (); + GetValue (iter, column, val); object ret = val.Val; val.Dispose (); return ret; diff --git a/gtk/TreeStore.custom b/gtk/TreeStore.custom index 3a00fdf1a..f040c5c68 100644 --- a/gtk/TreeStore.custom +++ b/gtk/TreeStore.custom @@ -194,8 +194,8 @@ } public object GetValue (Gtk.TreeIter iter, int column) { - GLib.Value val; - GetValue (iter, column, out val); + GLib.Value val = new GLib.Value (); + GetValue (iter, column, val); object ret = val.Val; val.Dispose (); return ret; diff --git a/gtk/gtk-api.xml b/gtk/gtk-api.xml index 07334dae2..5cc1e75a5 100644 --- a/gtk/gtk-api.xml +++ b/gtk/gtk-api.xml @@ -1106,7 +1106,7 @@ - + @@ -10106,7 +10106,7 @@ - + diff --git a/sources/Gtk.metadata b/sources/Gtk.metadata index 4b8448d0b..b3c675d38 100644 --- a/sources/Gtk.metadata +++ b/sources/Gtk.metadata @@ -140,18 +140,6 @@ - - - GetValue - - - - value - pass_as - out - - - ConvertIterToChildIter @@ -357,18 +345,6 @@ - - - StyleGetProperty - - - - value - pass_as - out - - - Intersect