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

View File

@ -260,7 +260,7 @@ namespace GtkSharp.Generation {
} else } else
call_parm = table.CallByName(type, call_parm_name); 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"); call_parm = String.Format ("({0} != null) ? {1} : {2}", call_parm_name, call_parm, table.IsCallback (type) ? "null" : "IntPtr.Zero");
if (this [i].IsArray) if (this [i].IsArray)
@ -294,6 +294,11 @@ namespace GtkSharp.Generation {
if (table.IsEnum (type)) if (table.IsEnum (type))
call_parm = name + "_as_int"; 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**") { } else if (type == "GError**") {
call_string += "out "; call_string += "out ";
import_sig += "out "; import_sig += "out ";
@ -339,11 +344,14 @@ namespace GtkSharp.Generation {
if (is_set) if (is_set)
name = "value"; name = "value";
if (is_get) if (is_get) {
sw.WriteLine (indent + "\t\t\t" + p.CSType + " " + name + ";"); 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")) 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) if (p.PassAs == "out" && gen is EnumGen)
sw.WriteLine(indent + "\t\t\tint " + name + "_as_int;"); sw.WriteLine(indent + "\t\t\tint " + name + "_as_int;");
@ -365,11 +373,21 @@ namespace GtkSharp.Generation {
public void Finish (StreamWriter sw, string indent) public void Finish (StreamWriter sw, string indent)
{ {
bool ref_owned_needed = true;
foreach (Parameter p in param_list) { foreach (Parameter p in param_list) {
if (p.PassAs == "out" && p.Generatable is EnumGen) { if (p.PassAs == "out" && p.Generatable is EnumGen) {
sw.WriteLine(indent + "\t\t\t" + p.Name + " = (" + p.CSType + ") " + p.Name + "_as_int;"); 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) { public object GetValue(Gtk.TreeIter iter, int column) {
GLib.Value val; GLib.Value val = new GLib.Value ();
GetValue (iter, column, out val); GetValue (iter, column, val);
object ret = val.Val; object ret = val.Val;
val.Dispose (); val.Dispose ();
return ret; return ret;

View File

@ -194,8 +194,8 @@
} }
public object GetValue (Gtk.TreeIter iter, int column) { public object GetValue (Gtk.TreeIter iter, int column) {
GLib.Value val; GLib.Value val = new GLib.Value ();
GetValue (iter, column, out val); GetValue (iter, column, val);
object ret = val.Val; object ret = val.Val;
val.Dispose (); val.Dispose ();
return ret; return ret;

View File

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

View File

@ -140,18 +140,6 @@
</attribute> </attribute>
</data> </data>
</rule> </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> <rule>
<class name="GtkTreeModelSort"> <class name="GtkTreeModelSort">
<method>ConvertIterToChildIter</method> <method>ConvertIterToChildIter</method>
@ -357,18 +345,6 @@
</attribute> </attribute>
</data> </data>
</rule> </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> <rule>
<class name="GtkWidget"> <class name="GtkWidget">
<method>Intersect</method> <method>Intersect</method>