From a307c7823275f6caf1cf2418b7fc6ccc59622d65 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 8 Jun 2005 16:53:12 +0000 Subject: [PATCH] 2005-06-08 Mike Kestner * generator/ReturnValue.cs : improved list to array marshaling. * glib/Marshaller.cs : added ListToArray (). * gnomevfs/Gnomevfs.metadata : mark element_type on Mime.GetAllApplications. [Fixes #71888] svn path=/trunk/gtk-sharp/; revision=45649 --- ChangeLog | 7 +++++++ doc/en/GLib/Marshaller.xml | 18 +++++++++++++++++ doc/en/Gnome.Vfs/Mime.xml | 37 +++++++++++++++++----------------- doc/en/Gnome/CanvasPathDef.xml | 27 +++++++++++++------------ generator/ReturnValue.cs | 11 ++++++++-- glib/Marshaller.cs | 7 +++++++ gnomevfs/Gnomevfs.metadata | 1 + 7 files changed, 75 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15e4681cf..9077050ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-08 Mike Kestner + + * generator/ReturnValue.cs : improved list to array marshaling. + * glib/Marshaller.cs : added ListToArray (). + * gnomevfs/Gnomevfs.metadata : mark element_type on + Mime.GetAllApplications. [Fixes #71888] + 2005-06-06 Mike Kestner * generator/ImportSignature.cs : fix native delegate namespacing hack. diff --git a/doc/en/GLib/Marshaller.xml b/doc/en/GLib/Marshaller.xml index 0150adfd3..410b04ddc 100644 --- a/doc/en/GLib/Marshaller.xml +++ b/doc/en/GLib/Marshaller.xml @@ -299,5 +299,23 @@ + + + Method + + System.Array + + + + + + + The list to be marshaled. + The type of the list elements. + Marshals a native list to a typed array. + An array of . + + + diff --git a/doc/en/Gnome.Vfs/Mime.xml b/doc/en/Gnome.Vfs/Mime.xml index e96b6fca7..cacff63c9 100644 --- a/doc/en/Gnome.Vfs/Mime.xml +++ b/doc/en/Gnome.Vfs/Mime.xml @@ -231,22 +231,7 @@ To be added. - - - Method - - GLib.List - - - - - - To be added. - To be added. - To be added. - To be added. - - + Method @@ -915,9 +900,25 @@ To be added. + + + Method + + Gnome.Vfs.MimeApplication[] + + + + + + A mime type to query, for example 'text/plain'. + Gets all the applications registered for a MIME type. + an array of . + + + - To be added. - To be added. + Mime related static methods. + diff --git a/doc/en/Gnome/CanvasPathDef.xml b/doc/en/Gnome/CanvasPathDef.xml index ea569681a..70e459172 100644 --- a/doc/en/Gnome/CanvasPathDef.xml +++ b/doc/en/Gnome/CanvasPathDef.xml @@ -160,19 +160,7 @@ To be added - - - Method - - GLib.SList - - - - To be added - To be added: an object of type 'GLib.SList' - To be added - - + Method @@ -520,5 +508,18 @@ To be added + + + Method + + Gnome.CanvasPathDef[] + + + + To be added. + To be added. + To be added. + + diff --git a/generator/ReturnValue.cs b/generator/ReturnValue.cs index 7f0db32e0..4a05c7642 100644 --- a/generator/ReturnValue.cs +++ b/generator/ReturnValue.cs @@ -43,6 +43,10 @@ namespace GtkSharp.Generation { get { if (IGen == null) return String.Empty; + + if (ElementType != String.Empty) + return ElementType + "[]"; + return IGen.QualifiedName + (IsArray ? "[]" : String.Empty); } } @@ -102,8 +106,10 @@ namespace GtkSharp.Generation { return String.Empty; if (Owned) var += ", true"; - else if (ElementType != String.Empty) - var += ", typeof (" + ElementType + ")"; + 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 IGen.FromNativeReturn (var); } @@ -113,6 +119,7 @@ namespace GtkSharp.Generation { Console.Write("rettype: " + CType); return false; } + return true; } } diff --git a/glib/Marshaller.cs b/glib/Marshaller.cs index f45eb3aec..e8dc9b0c8 100644 --- a/glib/Marshaller.cs +++ b/glib/Marshaller.cs @@ -278,6 +278,13 @@ namespace GLib { Marshal.StructureToPtr (o, result, false); return result; } + + public static Array ListToArray (ListBase list, System.Type type) + { + Array result = Array.CreateInstance (type, list.Count); + list.CopyTo (result, 0); + return result; + } } } diff --git a/gnomevfs/Gnomevfs.metadata b/gnomevfs/Gnomevfs.metadata index 7fe09df6c..1f2b9490d 100644 --- a/gnomevfs/Gnomevfs.metadata +++ b/gnomevfs/Gnomevfs.metadata @@ -16,6 +16,7 @@ + Gnome.Vfs.MimeApplication 1