diff --git a/ChangeLog b/ChangeLog index b43d3cdd7..3f61d8fc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-06-08 Mike Kestner + + * generator/SimpleBase.cs : off-by-one in namespace join. + * glib/ListBase.cs : support IntPtr element_type. + * gnomevfs/FileInfo.cs : make it ManualGen friendly. + * gnomevfs/*.cs : rework for FileInfo api changes. + * gnomevfs/Gnomevfs.metadata : make FileInfo a manual symbol. + * gnomevfs/Uri.custom : rework for FileInfo api changes. + * gnome/Makefile.am : add gnomevfs dependency to pick up some more api + symbols. + * gnome/gnome-sharp-2.0.pc.in : advertise the vfs dep. + [Fixes #71060] + 2005-06-08 Mike Kestner * generator/ReturnValue.cs : don't write a sem in FromNative. diff --git a/doc/en/Gnome.Vfs/AsyncSetFileInfoCallback.xml b/doc/en/Gnome.Vfs/AsyncSetFileInfoCallback.xml index 4fae061fc..540349438 100644 --- a/doc/en/Gnome.Vfs/AsyncSetFileInfoCallback.xml +++ b/doc/en/Gnome.Vfs/AsyncSetFileInfoCallback.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,18 @@ System.Delegate - + + + + + System.Void + To be added. + To be added. + To be added. To be added. To be added. diff --git a/doc/en/Gnome.Vfs/DirectoryVisitFunc.xml b/doc/en/Gnome.Vfs/DirectoryVisitFunc.xml index 58d5fb9ff..2d774f046 100644 --- a/doc/en/Gnome.Vfs/DirectoryVisitFunc.xml +++ b/doc/en/Gnome.Vfs/DirectoryVisitFunc.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,22 @@ System.Delegate - + + + + + + + System.Boolean + To be added. + To be added. + To be added. + To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gnome.Vfs/FileInfo.xml b/doc/en/Gnome.Vfs/FileInfo.xml index 49453b1ed..c29f73852 100644 --- a/doc/en/Gnome.Vfs/FileInfo.xml +++ b/doc/en/Gnome.Vfs/FileInfo.xml @@ -378,5 +378,50 @@ To be added + + + Constructor + + + To be added. + To be added. + + + + + Constructor + + + + + To be added. + To be added. + To be added. + + + + + Method + + System.Void + + + + To be added. + To be added. + + + + + Property + + System.IntPtr + + + To be added. + To be added. + To be added. + + diff --git a/doc/en/Gnome.Vfs/Global.xml b/doc/en/Gnome.Vfs/Global.xml index b455bf038..f8947814a 100644 --- a/doc/en/Gnome.Vfs/Global.xml +++ b/doc/en/Gnome.Vfs/Global.xml @@ -456,6 +456,212 @@ To be added. + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + Method + + Gnome.Vfs.Result + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + To be added. diff --git a/doc/en/Gnome.Vfs/MethodGetFileInfoFromHandleFunc.xml b/doc/en/Gnome.Vfs/MethodGetFileInfoFromHandleFunc.xml index 2c62aef1d..0d2780de5 100644 --- a/doc/en/Gnome.Vfs/MethodGetFileInfoFromHandleFunc.xml +++ b/doc/en/Gnome.Vfs/MethodGetFileInfoFromHandleFunc.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,22 @@ System.Delegate - + + + + + + + Gnome.Vfs.Result + To be added. + To be added. + To be added. + To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gnome.Vfs/MethodGetFileInfoFunc.xml b/doc/en/Gnome.Vfs/MethodGetFileInfoFunc.xml index 1a89ac880..574150d41 100644 --- a/doc/en/Gnome.Vfs/MethodGetFileInfoFunc.xml +++ b/doc/en/Gnome.Vfs/MethodGetFileInfoFunc.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,22 @@ System.Delegate - + + + + + + + Gnome.Vfs.Result + To be added. + To be added. + To be added. + To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gnome.Vfs/MethodReadDirectoryFunc.xml b/doc/en/Gnome.Vfs/MethodReadDirectoryFunc.xml index 4a22e7b9c..6b168ddbf 100644 --- a/doc/en/Gnome.Vfs/MethodReadDirectoryFunc.xml +++ b/doc/en/Gnome.Vfs/MethodReadDirectoryFunc.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,20 @@ System.Delegate - + + + + + + Gnome.Vfs.Result + To be added. + To be added. + To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gnome.Vfs/MethodSetFileInfo.xml b/doc/en/Gnome.Vfs/MethodSetFileInfo.xml index f91c0e6a8..81a2e391d 100644 --- a/doc/en/Gnome.Vfs/MethodSetFileInfo.xml +++ b/doc/en/Gnome.Vfs/MethodSetFileInfo.xml @@ -1,5 +1,5 @@ - + gnome-vfs-sharp 2.0.0.0 @@ -7,11 +7,22 @@ System.Delegate - + + + + + + + Gnome.Vfs.Result + To be added. + To be added. + To be added. + To be added. + To be added. To be added. To be added. To be added. diff --git a/doc/en/Gnome/GdkPixbufLoadCallback.xml b/doc/en/Gnome/GdkPixbufLoadCallback.xml index af6680347..705af7a05 100644 --- a/doc/en/Gnome/GdkPixbufLoadCallback.xml +++ b/doc/en/Gnome/GdkPixbufLoadCallback.xml @@ -1,11 +1,14 @@ - + gnome-sharp 2.0.0.0 Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. + To be added. + To be added. + To be added. To be added To be added @@ -14,6 +17,9 @@ + + + System.Void diff --git a/doc/en/Gnome/Icon.xml b/doc/en/Gnome/Icon.xml index e7dd79df5..42eff4ace 100644 --- a/doc/en/Gnome/Icon.xml +++ b/doc/en/Gnome/Icon.xml @@ -52,5 +52,35 @@ To be added + + + Method + + System.String + + + + + + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + diff --git a/generator/SimpleBase.cs b/generator/SimpleBase.cs index b245fea32..1620237a1 100644 --- a/generator/SimpleBase.cs +++ b/generator/SimpleBase.cs @@ -35,7 +35,7 @@ namespace GtkSharp.Generation { this.ctype = ctype; this.type = toks[toks.Length - 1]; if (toks.Length > 2) - this.ns = String.Join (".", toks, 0, toks.Length - 2); + this.ns = String.Join (".", toks, 0, toks.Length - 1); else if (toks.Length == 2) this.ns = toks[0]; } diff --git a/glib/ListBase.cs b/glib/ListBase.cs index ba141f79d..3666f796e 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 == typeof (IntPtr)) + ret = data; else if (element_type.IsSubclassOf (typeof (GLib.Object))) ret = GLib.Object.GetObject (data, false); else if (element_type == typeof (int)) diff --git a/gnome/Makefile.am b/gnome/Makefile.am index 98159540a..006ab5a12 100644 --- a/gnome/Makefile.am +++ b/gnome/Makefile.am @@ -8,10 +8,10 @@ else pkg = endif -INCLUDE_API = ../pango/pango-api.xml ../atk/atk-api.xml ../gdk/gdk-api.xml ../gtk/gtk-api.xml ../art/art-api.xml +INCLUDE_API = ../pango/pango-api.xml ../atk/atk-api.xml ../gdk/gdk-api.xml ../gtk/gtk-api.xml ../art/art-api.xml ../gnomevfs/gnome-vfs-api.xml METADATA = Gnome.metadata SYMBOLS = -references = ../glib/glib-sharp.dll ../pango/pango-sharp.dll ../atk/atk-sharp.dll ../gdk/gdk-sharp.dll ../gtk/gtk-sharp.dll ../art/art-sharp.dll +references = ../glib/glib-sharp.dll ../pango/pango-sharp.dll ../atk/atk-sharp.dll ../gdk/gdk-sharp.dll ../gtk/gtk-sharp.dll ../art/art-sharp.dll ../gnomevfs/gnome-vfs-sharp.dll glue_includes = gnome.h,libgnomeprint/gnome-print.h,libgnomeprint/gnome-print-paper.h sources = \ diff --git a/gnome/gnome-sharp-2.0.pc.in b/gnome/gnome-sharp-2.0.pc.in index 45b5c987b..a3dfc9acb 100644 --- a/gnome/gnome-sharp-2.0.pc.in +++ b/gnome/gnome-sharp-2.0.pc.in @@ -7,6 +7,6 @@ gapidir=${prefix}/share/gapi-2.0 Name: Gnome# Description: Gnome# - GNOME .NET Binding Version: @VERSION@ -Requires: gtk-sharp-2.0 art-sharp-2.0 +Requires: gtk-sharp-2.0 art-sharp-2.0 gnome-vfs-sharp-2.0 Cflags: -I:${gapidir}/gnome-api.xml Libs: -r:${libdir}/mono/@PACKAGE_VERSION@/gnome-sharp.dll diff --git a/gnomevfs/AsyncDirectoryLoadCallbackNative.cs b/gnomevfs/AsyncDirectoryLoadCallbackNative.cs index 6434ca46d..7a218f542 100644 --- a/gnomevfs/AsyncDirectoryLoadCallbackNative.cs +++ b/gnomevfs/AsyncDirectoryLoadCallbackNative.cs @@ -29,10 +29,11 @@ namespace Gnome.Vfs { public void NativeCallback (IntPtr handle, Result result, IntPtr list, uint entries_read, IntPtr data) { - GLib.List infos = new GLib.List (list, typeof (FileInfo.FileInfoNative)); + GLib.List infos = new GLib.List (list, typeof (IntPtr)); FileInfo[] entries = new FileInfo [infos.Count]; - for (int i = 0; i < infos.Count; i++) - entries[i] = new FileInfo ((FileInfo.FileInfoNative) infos [i]); + int i = 0; + foreach (IntPtr info in infos) + entries[i++] = new FileInfo (info); _managed (result, entries, entries_read); } diff --git a/gnomevfs/Directory.cs b/gnomevfs/Directory.cs index ef7c04202..34b0fc9f0 100644 --- a/gnomevfs/Directory.cs +++ b/gnomevfs/Directory.cs @@ -44,20 +44,18 @@ namespace Gnome.Vfs { [DllImport ("gnomevfs-2")] private static extern Result gnome_vfs_directory_list_load (out IntPtr list, string uri, FileInfoOptions options); - [DllImport ("gnomevfs-2")] - private static extern void gnome_vfs_file_info_list_free (IntPtr list); - public static FileInfo[] GetEntries (string text_uri, FileInfoOptions options) { IntPtr raw_ret; Result result = gnome_vfs_directory_list_load (out raw_ret, text_uri, options); Vfs.ThrowException (text_uri, result); - GLib.List list = new GLib.List (raw_ret, typeof (FileInfo.FileInfoNative)); + GLib.List list = new GLib.List (raw_ret, typeof (IntPtr)); + list.Managed = true; FileInfo[] entries = new FileInfo [list.Count]; - for (int i = 0; i < list.Count; i++) - entries[i] = new FileInfo ((FileInfo.FileInfoNative) list [i]); - gnome_vfs_file_info_list_free (raw_ret); + int i = 0; + foreach (IntPtr info in list) + entries[i++] = new FileInfo (info); return entries; } diff --git a/gnomevfs/FileInfo.cs b/gnomevfs/FileInfo.cs index f24ab0090..4e71d544c 100644 --- a/gnomevfs/FileInfo.cs +++ b/gnomevfs/FileInfo.cs @@ -51,21 +51,30 @@ namespace Gnome.Vfs { public IntPtr reserved5; } - // This needs to be internal so other Gnome.Vfs code can use it for native calls. - internal FileInfoNative info; + IntPtr handle; + bool needs_dispose = false; [DllImport ("gnomevfs-2")] - private static extern FileInfoNative gnome_vfs_file_info_new (); + private static extern void gnome_vfs_file_info_unref (IntPtr handle); - [DllImport ("gnomevfs-2")] - private static extern void gnome_vfs_file_info_copy (ref FileInfoNative dest, ref FileInfoNative src); - - [DllImport ("gnomevfs-2")] - private static extern Result gnome_vfs_get_file_info_uri (IntPtr uri, ref FileInfoNative info, FileInfoOptions options); - - internal FileInfo (FileInfoNative info) + ~FileInfo () { - gnome_vfs_file_info_copy (ref this.info, ref info); + if (needs_dispose) + gnome_vfs_file_info_unref (Handle); + } + + [DllImport ("gnomevfs-2")] + private static extern IntPtr gnome_vfs_file_info_new (); + + public FileInfo () + { + needs_dispose = true; + handle = gnome_vfs_file_info_new (); + } + + public FileInfo (IntPtr handle) + { + this.handle = handle; } public FileInfo (string uri) : this (uri, FileInfoOptions.Default) {} @@ -74,24 +83,30 @@ namespace Gnome.Vfs { public FileInfo (Uri uri) : this (uri, FileInfoOptions.Default) {} - public FileInfo (Uri uri, FileInfoOptions options) - { - info = gnome_vfs_file_info_new (); + [DllImport ("gnomevfs-2")] + private static extern Result gnome_vfs_get_file_info_uri (IntPtr uri, IntPtr info, int options); - Result result = gnome_vfs_get_file_info_uri (uri.Handle, ref info, options); + public FileInfo (Uri uri, FileInfoOptions options) : this () + { + Result result = gnome_vfs_get_file_info_uri (uri.Handle, Handle, (int) options); Vfs.ThrowException (uri, result); } - [DllImport ("gnomevfs-2")] - private static extern void gnome_vfs_file_info_clear (ref FileInfoNative info); - - ~FileInfo () - { - gnome_vfs_file_info_clear (ref info); + FileInfoNative Native { + get { + return (FileInfoNative) Marshal.PtrToStructure (handle, typeof (FileInfoNative)); + } } - + + public IntPtr Handle { + get { + return handle; + } + } + public string Name { get { + FileInfoNative info = Native; if (info.name != IntPtr.Zero) return GLib.Marshaller.Utf8PtrToString (info.name); else @@ -101,14 +116,14 @@ namespace Gnome.Vfs { public FileInfoFields ValidFields { get { - return info.valid_fields; + return Native.valid_fields; } } public FileType Type { get { if ((ValidFields & FileInfoFields.Type) != 0) - return info.type; + return Native.type; else throw new ArgumentException ("Type is not set"); } @@ -117,7 +132,7 @@ namespace Gnome.Vfs { public FilePermissions Permissions { get { if ((ValidFields & FileInfoFields.Permissions) != 0) - return info.permissions; + return Native.permissions; else throw new ArgumentException ("Permissions is not set"); } @@ -126,7 +141,7 @@ namespace Gnome.Vfs { public FileFlags Flags { get { if ((ValidFields & FileInfoFields.Flags) != 0) - return info.flags; + return Native.flags; else throw new ArgumentException ("Flags is not set"); } @@ -135,7 +150,7 @@ namespace Gnome.Vfs { public long Device { get { if ((ValidFields & FileInfoFields.Device) != 0) - return info.dev_t; + return Native.dev_t; else throw new ArgumentException ("Device is not set"); } @@ -144,7 +159,7 @@ namespace Gnome.Vfs { public long Inode { get { if ((ValidFields & FileInfoFields.Inode) != 0) - return info.inode; + return Native.inode; else throw new ArgumentException ("Inode is not set"); } @@ -153,7 +168,7 @@ namespace Gnome.Vfs { public uint LinkCount { get { if ((ValidFields & FileInfoFields.LinkCount) != 0) - return info.link_count; + return Native.link_count; else throw new ArgumentException ("LinkCount is not set"); } @@ -161,20 +176,20 @@ namespace Gnome.Vfs { public uint Uid { get { - return info.uid; + return Native.uid; } } public uint Gid { get { - return info.gid; + return Native.gid; } } public long Size { get { if ((ValidFields & FileInfoFields.Size) != 0) - return info.size; + return Native.size; else throw new ArgumentException ("Size is not set"); } @@ -183,7 +198,7 @@ namespace Gnome.Vfs { public long BlockCount { get { if ((ValidFields & FileInfoFields.BlockCount) != 0) - return info.block_count; + return Native.block_count; else throw new ArgumentException ("BlockCount is not set"); } @@ -192,7 +207,7 @@ namespace Gnome.Vfs { public uint IoBlockSize { get { if ((ValidFields & FileInfoFields.IoBlockSize) != 0) - return info.io_block_size; + return Native.io_block_size; else throw new ArgumentException ("IoBlockSize is not set"); } @@ -201,7 +216,7 @@ namespace Gnome.Vfs { public System.DateTime Atime { get { if ((ValidFields & FileInfoFields.Atime) != 0) - return GLib.Marshaller.time_tToDateTime (info.atime); + return GLib.Marshaller.time_tToDateTime (Native.atime); else throw new ArgumentException ("Atime is not set"); } @@ -210,7 +225,7 @@ namespace Gnome.Vfs { public System.DateTime Mtime { get { if ((ValidFields & FileInfoFields.Mtime) != 0) - return GLib.Marshaller.time_tToDateTime (info.mtime); + return GLib.Marshaller.time_tToDateTime (Native.mtime); else throw new ArgumentException ("Mtime is not set"); } @@ -219,7 +234,7 @@ namespace Gnome.Vfs { public System.DateTime Ctime { get { if ((ValidFields & FileInfoFields.Ctime) != 0) - return GLib.Marshaller.time_tToDateTime (info.ctime); + return GLib.Marshaller.time_tToDateTime (Native.ctime); else throw new ArgumentException ("Ctime is not set"); } @@ -227,6 +242,7 @@ namespace Gnome.Vfs { public string SymlinkName { get { + FileInfoNative info = Native; if ((ValidFields & FileInfoFields.SymlinkName) != 0 && info.symlink_name != IntPtr.Zero) return GLib.Marshaller.Utf8PtrToString (info.symlink_name); @@ -237,6 +253,7 @@ namespace Gnome.Vfs { public string MimeType { get { + FileInfoNative info = Native; if ((ValidFields & FileInfoFields.MimeType) != 0 && info.mime_type != IntPtr.Zero) return GLib.Marshaller.Utf8PtrToString (info.mime_type); @@ -280,8 +297,17 @@ namespace Gnome.Vfs { } } + [DllImport ("gnomevfs-2")] + private static extern void gnome_vfs_file_info_clear (IntPtr info); + + public void Clear () + { + gnome_vfs_file_info_clear (Handle); + } + public override String ToString () { + FileInfoNative info = Native; string result = "Name = " + Name + "\n" + "ValidFields = " + info.valid_fields + "\n"; if ((ValidFields & FileInfoFields.Type) != 0) @@ -291,7 +317,7 @@ namespace Gnome.Vfs { if ((ValidFields & FileInfoFields.Flags) != 0) { result += "Flags = "; bool flag = false; - if ((Flags & FileFlags.None) != 0) { + if (Flags == FileFlags.None) { result += "None"; flag = true; } diff --git a/gnomevfs/Gnomevfs.metadata b/gnomevfs/Gnomevfs.metadata index 1f2b9490d..54b2dabfd 100644 --- a/gnomevfs/Gnomevfs.metadata +++ b/gnomevfs/Gnomevfs.metadata @@ -61,7 +61,7 @@ 1 1 1 - 1 + 1 1 1 @@ -110,4 +110,5 @@ 1 1 1 + diff --git a/gnomevfs/Uri.custom b/gnomevfs/Uri.custom index 3488c4a67..51b53e7d5 100644 --- a/gnomevfs/Uri.custom +++ b/gnomevfs/Uri.custom @@ -47,11 +47,11 @@ } [DllImport("gnomevfs-2")] - static extern Result gnome_vfs_set_file_info_uri (IntPtr raw, ref FileInfo.FileInfoNative info, SetFileInfoMask mask); + static extern Result gnome_vfs_set_file_info_uri (IntPtr raw, IntPtr info, SetFileInfoMask mask); public Result SetFileInfo (FileInfo info, SetFileInfoMask mask) { - return gnome_vfs_set_file_info_uri (Handle, ref info.info, mask); + return gnome_vfs_set_file_info_uri (Handle, info.Handle, mask); } [DllImport("gnomevfs-2")] diff --git a/gnomevfs/VfsStream.cs b/gnomevfs/VfsStream.cs index eca5c5219..6a7d26ceb 100644 --- a/gnomevfs/VfsStream.cs +++ b/gnomevfs/VfsStream.cs @@ -306,7 +306,6 @@ namespace Gnome.Vfs { } this.mode = mode; - this.access = access; this.canseek = true; this.async = async; }