2003-10-11 Mike Kestner <mkestner@ximian.com>

* 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

svn path=/trunk/gtk-sharp/; revision=18891
This commit is contained in:
Mike Kestner 2003-10-11 20:53:10 +00:00
parent e72ae71073
commit 71e9414883
6 changed files with 36 additions and 33 deletions

View file

@ -1,3 +1,12 @@
2003-10-11 Mike Kestner <mkestner@ximian.com>
* 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 <mkestner@ximian.com>
* gtk/gtk-api.xml : regenerated

View file

@ -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") + ";");
}
}

View file

@ -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;

View file

@ -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;

View file

@ -1106,7 +1106,7 @@
<parameters>
<parameter type="GtkTreeIter*" name="iter"/>
<parameter type="gint" name="column"/>
<parameter type="GValue*" name="value" pass_as="out"/>
<parameter type="GValue*" name="value"/>
</parameters>
</method>
<method name="IterChildren" cname="gtk_tree_model_iter_children">
@ -10106,7 +10106,7 @@
<return-type type="void"/>
<parameters>
<parameter type="const-gchar*" name="property_name"/>
<parameter type="GValue*" name="value" pass_as="out"/>
<parameter type="GValue*" name="value"/>
</parameters>
</method>
<method name="StyleGetValist" cname="gtk_widget_style_get_valist">

View file

@ -140,18 +140,6 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkTreeModel">
<method>GetValue</method>
</class>
<data>
<attribute target="param">
<filter level="name">value</filter>
<name>pass_as</name>
<value>out</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkTreeModelSort">
<method>ConvertIterToChildIter</method>
@ -357,18 +345,6 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<method>StyleGetProperty</method>
</class>
<data>
<attribute target="param">
<filter level="name">value</filter>
<name>pass_as</name>
<value>out</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<method>Intersect</method>