From 6b6bb616b2bac1550886be8b966f894b896321c3 Mon Sep 17 00:00:00 2001 From: Rachel Hestilow Date: Thu, 12 Sep 2002 20:25:29 +0000 Subject: [PATCH] 2002-09-12 Rachel Hestilow * 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 --- ChangeLog | 8 ++++++++ api/gtk-api.xml | 2 +- generator/Parameters.cs | 10 ++++++++-- sources/Gtk.metadata | 12 ++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad317ffd2..e915f8655 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-09-12 Rachel Hestilow + + * 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 * glib/Object.cs (DisposeNative): Call GC.SuppressFinalize, and diff --git a/api/gtk-api.xml b/api/gtk-api.xml index 51b6c07ab..59efa5c05 100644 --- a/api/gtk-api.xml +++ b/api/gtk-api.xml @@ -4374,7 +4374,7 @@ - + diff --git a/generator/Parameters.cs b/generator/Parameters.cs index a00073fc3..ec635d57e 100644 --- a/generator/Parameters.cs +++ b/generator/Parameters.cs @@ -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); } } } diff --git a/sources/Gtk.metadata b/sources/Gtk.metadata index 5706daf07..6498a2392 100644 --- a/sources/Gtk.metadata +++ b/sources/Gtk.metadata @@ -1839,6 +1839,18 @@ + + + Popup + + + + GtkMenuPositionFunc + null_ok + 1 + + +