2002-09-12 Rachel Hestilow <hestilow@ximian.com>

* sources/Gtk.metadata: Set null_ok on the callback argument
	to Menu.Popup.

	* generator/Parameters.cs: Handle null_ok properly for callback
	arguments.

svn path=/trunk/gtk-sharp/; revision=7412
This commit is contained in:
Rachel Hestilow 2002-09-12 20:25:29 +00:00
parent c9434076c5
commit 6b6bb616b2
4 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2002-09-12 Rachel Hestilow <hestilow@ximian.com>
* sources/Gtk.metadata: Set null_ok on the callback argument
to Menu.Popup.
* generator/Parameters.cs: Handle null_ok properly for callback
arguments.
2002-09-11 Miguel de Icaza <miguel@ximian.com>
* glib/Object.cs (DisposeNative): Call GC.SuppressFinalize, and

View File

@ -4374,7 +4374,7 @@
<parameters>
<parameter type="GtkWidget*" name="parent_menu_shell" null_ok="1"/>
<parameter type="GtkWidget*" name="parent_menu_item" null_ok="1"/>
<parameter type="GtkMenuPositionFunc" name="func"/>
<parameter type="GtkMenuPositionFunc" name="func" null_ok="1"/>
<parameter type="gpointer" name="data"/>
<parameter type="guint" name="button"/>
<parameter type="guint32" name="activate_time"/>

View File

@ -209,7 +209,7 @@ namespace GtkSharp.Generation {
call_parm = SymbolTable.CallByName(type, call_parm_name);
if (p_elem.HasAttribute ("null_ok") && cs_type != "IntPtr" && cs_type != "System.IntPtr" && !SymbolTable.IsStruct (type))
call_parm = String.Format ("({0} != null) ? {1} : IntPtr.Zero", call_parm_name, call_parm);
call_parm = String.Format ("({0} != null) ? {1} : {2}", call_parm_name, call_parm, SymbolTable.IsCallback (type) ? "null" : "IntPtr.Zero");
if (p_elem.HasAttribute("array")) {
cs_type += "[]";
@ -335,7 +335,13 @@ namespace GtkSharp.Generation {
type = type.Replace (".", "");
type = "GtkSharp." + type + "Wrapper";
sw.WriteLine(indent + "\t\t\t{0} {1}_wrapper = new {0} ({1});", type, name);
sw.WriteLine (indent + "\t\t\t{0} {1}_wrapper = null;", type, name);
sw.Write (indent + "\t\t\t");
if (p_elem.HasAttribute ("null_ok"))
{
sw.Write ("if ({0} != null) ", name);
}
sw.WriteLine ("{1}_wrapper = new {0} ({1});", type, name);
}
}
}

View File

@ -1839,6 +1839,18 @@
</attribute>
</data>
</rule>
<rule>
<class name="GtkMenu">
<method>Popup</method>
</class>
<data>
<attribute target="param">
<filter level="type">GtkMenuPositionFunc</filter>
<name>null_ok</name>
<value>1</value>
</attribute>
</data>
</rule>
<!-- reference rules -->