diff --git a/ChangeLog b/ChangeLog index 9077050ee..b43d3cdd7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-06-08 Mike Kestner + + * generator/ReturnValue.cs : don't write a sem in FromNative. + * glib/ListBase.cs : handle GLib.Object explicit element types. + * glib/Marshaler.cs : only copy lists if Count > 0. + * gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element + type for automatic list to array marshaling. + * gtk/Window.custom : kill manual ListToplevels impl. + 2005-06-08 Mike Kestner * generator/ReturnValue.cs : improved list to array marshaling. diff --git a/generator/ReturnValue.cs b/generator/ReturnValue.cs index 4a05c7642..5fd0d4737 100644 --- a/generator/ReturnValue.cs +++ b/generator/ReturnValue.cs @@ -108,7 +108,7 @@ namespace GtkSharp.Generation { var += ", true"; else if (ElementType != String.Empty) { string type_str = "typeof (" + ElementType + ")"; - return String.Format ("({0}[]) GLib.Marshaller.ListToArray ({1}, {2});", ElementType, IGen.FromNativeReturn (var + ", " + type_str), type_str); + return String.Format ("({0}[]) GLib.Marshaller.ListToArray ({1}, {2})", ElementType, IGen.FromNativeReturn (var + ", " + type_str), type_str); } return IGen.FromNativeReturn (var); } diff --git a/glib/ListBase.cs b/glib/ListBase.cs index 303c5466b..ba141f79d 100644 --- a/glib/ListBase.cs +++ b/glib/ListBase.cs @@ -147,6 +147,8 @@ namespace GLib { ret = Marshaller.Utf8PtrToString (data); else if (element_type == typeof (FilenameString)) ret = Marshaller.FilenamePtrToString (data); + else if (element_type.IsSubclassOf (typeof (GLib.Object))) + ret = GLib.Object.GetObject (data, false); else if (element_type == typeof (int)) ret = (int) data; else if (element_type.IsValueType) diff --git a/glib/Marshaller.cs b/glib/Marshaller.cs index e8dc9b0c8..c19af5d5e 100644 --- a/glib/Marshaller.cs +++ b/glib/Marshaller.cs @@ -282,7 +282,8 @@ namespace GLib { public static Array ListToArray (ListBase list, System.Type type) { Array result = Array.CreateInstance (type, list.Count); - list.CopyTo (result, 0); + if (list.Count > 0) + list.CopyTo (result, 0); return result; } } diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index 488aca0e4..a6b98827f 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -549,7 +549,7 @@ out 1 1 - 1 + Gtk.Window 1 1 1 diff --git a/gtk/Window.custom b/gtk/Window.custom index 95774dd10..93ef67761 100755 --- a/gtk/Window.custom +++ b/gtk/Window.custom @@ -76,22 +76,6 @@ } } - [DllImport("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_window_list_toplevels(); - - public static Window[] ListToplevels () - { - IntPtr raw_ret = gtk_window_list_toplevels(); - if (raw_ret == IntPtr.Zero) - return new Window [0]; - - GLib.List list = new GLib.List(raw_ret); - Window[] result = new Window [list.Count]; - for (int i = 0; i < list.Count; i++) - result [i] = list [i] as Window; - return result; - } - public Gdk.Size DefaultSize { get { return new Gdk.Size (DefaultWidth, DefaultHeight);