From f3b891e758f708092205fc8ed22a70598baeb13d Mon Sep 17 00:00:00 2001 From: Jeroen Zwartepoorte Date: Mon, 27 Dec 2004 20:02:33 +0000 Subject: [PATCH] 2004-12-27 Jeroen Zwartepoorte * gnomevfs/Directory.cs: s/uint/FilePermissions/. * gnomevfs/Gnomevfs.metadata: Make a bunch of API more user-friendly & C# like. * gnomevfs/Monitor.cs: Add internal MonitorEventType enum. * gnomevfs/Uri.custom: Move a bunch of API from Vfs.cs to Uri. * gnomevfs/Vfs.cs: Only put initialize & shutdown methods in here (plus some debug API). * gnomevfs/VfsStream.cs: Use new Uri API. * sample/gnomevfs/TestUnlink.cs: Fix sample. svn path=/trunk/gtk-sharp/; revision=38112 --- ChangeLog | 12 + doc/ChangeLog | 5 + doc/en/Gnome.Vfs/Async.xml | 16 +- doc/en/Gnome.Vfs/AsyncCallback.xml | 2 +- .../Gnome.Vfs/AsyncDirectoryLoadCallback.xml | 2 +- doc/en/Gnome.Vfs/AsyncReadCallback.xml | 2 +- doc/en/Gnome.Vfs/AsyncWriteCallback.xml | 2 +- doc/en/Gnome.Vfs/AuthenticationType.xml | 6 +- doc/en/Gnome.Vfs/DeviceType.xml | 2 +- doc/en/Gnome.Vfs/Directory.xml | 199 +++++++---- doc/en/Gnome.Vfs/Drive.xml | 2 +- doc/en/Gnome.Vfs/FileFlags.xml | 8 +- doc/en/Gnome.Vfs/FileInfo.xml | 72 ++-- doc/en/Gnome.Vfs/FileInfoFields.xml | 48 ++- doc/en/Gnome.Vfs/FileInfoOptions.xml | 14 +- doc/en/Gnome.Vfs/FilePermissions.xml | 32 +- doc/en/Gnome.Vfs/Handle.xml | 2 +- doc/en/Gnome.Vfs/MimeType.xml | 44 +-- doc/en/Gnome.Vfs/ModuleCallback.xml | 123 ++++++- doc/en/Gnome.Vfs/Monitor.xml | 21 +- doc/en/Gnome.Vfs/MonitorEventType.xml | 123 ------- doc/en/Gnome.Vfs/MonitorHandler.xml | 2 +- doc/en/Gnome.Vfs/MonitorType.xml | 6 +- doc/en/Gnome.Vfs/OpenMode.xml | 4 +- doc/en/Gnome.Vfs/Priority.xml | 8 +- doc/en/Gnome.Vfs/Result.xml | 96 ++--- doc/en/Gnome.Vfs/SeekPosition.xml | 8 +- doc/en/Gnome.Vfs/Sync.xml | 166 ++++++--- doc/en/Gnome.Vfs/Uri.xml | 329 +++++++----------- doc/en/Gnome.Vfs/UriHideOptions.xml | 16 +- doc/en/Gnome.Vfs/Vfs.xml | 159 +++------ doc/en/Gnome.Vfs/VfsException.xml | 9 +- doc/en/Gnome.Vfs/VfsStream.xml | 48 ++- gnomevfs/Directory.cs | 6 +- gnomevfs/Gnomevfs.metadata | 13 +- gnomevfs/Monitor.cs | 9 + gnomevfs/Uri.custom | 49 +++ gnomevfs/Vfs.cs | 39 +-- gnomevfs/VfsStream.cs | 6 +- sample/gnomevfs/TestUnlink.cs | 2 +- 40 files changed, 880 insertions(+), 832 deletions(-) delete mode 100644 doc/en/Gnome.Vfs/MonitorEventType.xml diff --git a/ChangeLog b/ChangeLog index 41ce58f15..3763c509d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-12-27 Jeroen Zwartepoorte + + * gnomevfs/Directory.cs: s/uint/FilePermissions/. + * gnomevfs/Gnomevfs.metadata: Make a bunch of API more user-friendly & + C# like. + * gnomevfs/Monitor.cs: Add internal MonitorEventType enum. + * gnomevfs/Uri.custom: Move a bunch of API from Vfs.cs to Uri. + * gnomevfs/Vfs.cs: Only put initialize & shutdown methods in here (plus + some debug API). + * gnomevfs/VfsStream.cs: Use new Uri API. + * sample/gnomevfs/TestUnlink.cs: Fix sample. + 2004-12-27 Mike Kestner * generator/EnumGen.cs : rework for a single pass thru ChildNodes. diff --git a/doc/ChangeLog b/doc/ChangeLog index 39e6f472a..5558d71c7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2004-12-27 Jeroen Zwartepoorte + + * en/Gnome.Vfs.xml: + * en/Gnome.Vfs/*.xml: major doc commit (more to follow). + 2004-12-23 Mike Kestner * en/GLib/ClassInitializerAttribute.xml : doc new attr. diff --git a/doc/en/Gnome.Vfs/Async.xml b/doc/en/Gnome.Vfs/Async.xml index 2882303a5..64ae92e83 100644 --- a/doc/en/Gnome.Vfs/Async.xml +++ b/doc/en/Gnome.Vfs/Async.xml @@ -9,9 +9,17 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - Asynchronous File Operations; POSIX-style file operations that run outside your main loop. + Asynchronous File Operations; POSIX-style file operations that run outside your main loop. + The members of this class are all static methods and use the class to reference asynchronous operations in progress. +using GLib; +using Gnome.Vfs; +using System; +using System.Text; +using System.Threading; + +namespace Test.Gnome.Vfs { public class TestAsync { private static MainLoop loop; private static Handle handle; @@ -76,9 +84,9 @@ loop.Quit (); } } - - - The members of this class are all static methods and use the class to reference asynchronous operations in progress. +} + + System.Object diff --git a/doc/en/Gnome.Vfs/AsyncCallback.xml b/doc/en/Gnome.Vfs/AsyncCallback.xml index fc0a283e4..496873b2c 100644 --- a/doc/en/Gnome.Vfs/AsyncCallback.xml +++ b/doc/en/Gnome.Vfs/AsyncCallback.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Delegate used for notifying when an asynchronous operation has finished. See for examples. To be added diff --git a/doc/en/Gnome.Vfs/AsyncDirectoryLoadCallback.xml b/doc/en/Gnome.Vfs/AsyncDirectoryLoadCallback.xml index fee77f098..8ae3ed0c9 100644 --- a/doc/en/Gnome.Vfs/AsyncDirectoryLoadCallback.xml +++ b/doc/en/Gnome.Vfs/AsyncDirectoryLoadCallback.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Delegate used for notifying when a specified number of entries have been read from a directory. Used in . To be added diff --git a/doc/en/Gnome.Vfs/AsyncReadCallback.xml b/doc/en/Gnome.Vfs/AsyncReadCallback.xml index 3b32e8132..584844237 100644 --- a/doc/en/Gnome.Vfs/AsyncReadCallback.xml +++ b/doc/en/Gnome.Vfs/AsyncReadCallback.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Delegate used for notifying when an asynchronous operation has finished. To be added diff --git a/doc/en/Gnome.Vfs/AsyncWriteCallback.xml b/doc/en/Gnome.Vfs/AsyncWriteCallback.xml index 0d6de06f4..34d440b53 100644 --- a/doc/en/Gnome.Vfs/AsyncWriteCallback.xml +++ b/doc/en/Gnome.Vfs/AsyncWriteCallback.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Delegate used for notifying when an asynchronous operation has finished. To be added diff --git a/doc/en/Gnome.Vfs/AuthenticationType.xml b/doc/en/Gnome.Vfs/AuthenticationType.xml index 31a2c1bd5..8d06717a0 100644 --- a/doc/en/Gnome.Vfs/AuthenticationType.xml +++ b/doc/en/Gnome.Vfs/AuthenticationType.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Enumeration used in to indicate how the password needs to be transmitted. To be added @@ -37,7 +37,7 @@ - To be added + Password will be transmitted unencrypted. To be added @@ -50,7 +50,7 @@ - To be added + Digest is transferred, not plaintext credentials. To be added diff --git a/doc/en/Gnome.Vfs/DeviceType.xml b/doc/en/Gnome.Vfs/DeviceType.xml index c0d843b39..4c6ce4af7 100644 --- a/doc/en/Gnome.Vfs/DeviceType.xml +++ b/doc/en/Gnome.Vfs/DeviceType.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Enumeration used in and to represent the device type. To be added diff --git a/doc/en/Gnome.Vfs/Directory.xml b/doc/en/Gnome.Vfs/Directory.xml index 43ddee139..665bc0519 100644 --- a/doc/en/Gnome.Vfs/Directory.xml +++ b/doc/en/Gnome.Vfs/Directory.xml @@ -9,8 +9,66 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + Basic directory operations: creating, reading and removing directories. + + + +using GLib; +using Gnome.Vfs; +using System; +using System.Text; + +namespace Test.Gnome.Vfs { + public class TestInfo { + private static MainLoop loop; + + static void Main (string[] args) + { + if (args.Length != 1) { + Console.WriteLine ("Usage: TestDirectory <uri>"); + return; + } + + Gnome.Vfs.Vfs.Initialize (); + + FileInfo[] entries = Gnome.Vfs.Directory.GetEntries (args[0]); + + Console.WriteLine ("Directory {0} contains {1} entries:", args[0], entries.Length); + foreach (FileInfo info in entries) { + Console.WriteLine (info.Name); + } + + Gnome.Vfs.Directory.GetEntries (args[0], FileInfoOptions.Default, + 20, (int)Gnome.Vfs.Async.Priority.Default, + new AsyncDirectoryLoadCallback (OnDirectoryLoad)); + + loop = new MainLoop (); + loop.Run (); + + Gnome.Vfs.Vfs.Shutdown (); + } + + private static void OnDirectoryLoad (Result result, FileInfo[] entries, uint entries_read) + { + Console.WriteLine ("DirectoryLoad: {0}", result); + if (result != Result.Ok && result != Result.ErrorEof) { + loop.Quit (); + return; + } + + Console.WriteLine ("read {0} entries", entries_read); + foreach (FileInfo info in entries) { + Console.WriteLine (info.Name); + } + + if (result == Result.ErrorEof) + loop.Quit (); + } + } +} + + + System.Object @@ -28,9 +86,9 @@ - To be added + Load a directory from . a - a + a containing the files in the directory. To be added @@ -45,10 +103,11 @@ - To be added + Load a directory from with the specified . a - a - a + + for loading the directory. + a containing the files in the directory. To be added @@ -62,9 +121,10 @@ - To be added - a - a + Load a directory from uri. + + representing the URI of the directory to be loaded. + a containing the files in the directory. To be added @@ -79,10 +139,12 @@ - To be added - a - a - a + Load a directory from uri with the specified . + + representing the URI of the directory to be loaded. + + for loading the directory. + a containing the files in the directory. To be added @@ -100,12 +162,13 @@ - To be added + Asynchronously load a directory from with the specified . a - a - a - a - a + + for loading the directory. + the number of entries to read in the directory per notification. + a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. + a to be called when the specified number of entries have been read or the operation is complete. To be added @@ -123,48 +186,14 @@ - To be added - a - a - a - a - a - To be added - - - - - Method - - Gnome.Vfs.Result - - - - - - - To be added - a - a - a - To be added - - - - - Method - - Gnome.Vfs.Result - - - - - - - To be added - a - a - a + Asynchronously load a directory from uri with the specified . + + representing the URI of the directory to be loaded. + + for loading the directory. + the number of entries to read in the directory per notification. + a value from to (normally should be ) indicating the priority to assign this job in allocating threads from the thread pool. + a to be called when the specified number of entries have been read or the operation is complete. To be added @@ -178,8 +207,9 @@ - To be added - a + Delete . must be an empty directory. + + of the directory to be removed. a To be added @@ -194,11 +224,48 @@ - To be added - a + Remove uri. Uri must be an empty directory. + URI of the directory to be removed. + a + To be added + + + + + Method + + Gnome.Vfs.Result + + + + + + + Create a directory at . Only succeeds if a file or directory does not already exist at . + + of the directory to be created. + Unix-style permissions for the newly created directory. + a + To be added + + + + + Method + + Gnome.Vfs.Result + + + + + + + Create a directory at uri. Only succeeds if a file or directory does not already exist at the uri. + URI of the directory to be created. + Unix-style permissions for the newly created directory. a To be added - + \ No newline at end of file diff --git a/doc/en/Gnome.Vfs/Drive.xml b/doc/en/Gnome.Vfs/Drive.xml index 10f603524..7b957f455 100644 --- a/doc/en/Gnome.Vfs/Drive.xml +++ b/doc/en/Gnome.Vfs/Drive.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Container for (floppy drive, CD reader, ...). To be added diff --git a/doc/en/Gnome.Vfs/FileFlags.xml b/doc/en/Gnome.Vfs/FileFlags.xml index 54a19b37f..e01560185 100644 --- a/doc/en/Gnome.Vfs/FileFlags.xml +++ b/doc/en/Gnome.Vfs/FileFlags.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Enumeration representing special flags a class can have. To be added @@ -41,7 +41,7 @@ - To be added + no flags. To be added @@ -54,7 +54,7 @@ - To be added + whether the file is a symlink. To be added @@ -67,7 +67,7 @@ - To be added + whether the file is on a local filesystem. To be added diff --git a/doc/en/Gnome.Vfs/FileInfo.xml b/doc/en/Gnome.Vfs/FileInfo.xml index 7edeafa27..0bf88df78 100644 --- a/doc/en/Gnome.Vfs/FileInfo.xml +++ b/doc/en/Gnome.Vfs/FileInfo.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Class containing all metadata pertaining to a . To be added @@ -51,8 +51,9 @@ - To be added - a + Create a new FileInfo instance representing the text uri. + + representing the uri. a To be added @@ -66,9 +67,11 @@ - To be added - a - a + Create a new FileInfo instance representing the text uri with the specified . + + representing the uri. + + for the FileInfo metadata. a To be added @@ -81,7 +84,7 @@ - To be added + Create a new FileInfo instance representing . a a To be added @@ -96,9 +99,10 @@ - To be added + Create a new FileInfo instance representing with the specified . a - a + + for the FileInfo metadata. a To be added @@ -111,7 +115,7 @@ - To be added + Base name of the file (no path). a To be added @@ -124,7 +128,7 @@ - To be added + Properties which are actually valid in this class. a To be added @@ -137,7 +141,7 @@ - To be added + File type (i.e. regular, directory, block device...). a To be added @@ -150,7 +154,7 @@ - To be added + File permissions. a To be added @@ -163,7 +167,8 @@ - To be added + + for this file. a To be added @@ -176,7 +181,7 @@ - To be added + Device id of the file. Only valid if the . a To be added @@ -189,7 +194,7 @@ - To be added + Inode number of the file. Only valid if the . a To be added @@ -202,7 +207,7 @@ - To be added + Link count. a To be added @@ -215,7 +220,7 @@ - To be added + UNIX user id. a To be added @@ -228,7 +233,7 @@ - To be added + UNIX group id. a To be added @@ -241,7 +246,7 @@ - To be added + Size in bytes. a To be added @@ -254,7 +259,7 @@ - To be added + Size measured in units of 512-byte blocks. a To be added @@ -267,7 +272,7 @@ - To be added + Optimal buffer size for reading/writing the file. a To be added @@ -280,7 +285,7 @@ - To be added + Last time the file was accessed. a To be added @@ -293,7 +298,7 @@ - To be added + Last time the file was modified. a To be added @@ -306,7 +311,7 @@ - To be added + Last time the file was changed. a To be added @@ -319,7 +324,7 @@ - To be added + If , this specifies the file the link points to. a To be added @@ -332,8 +337,9 @@ - To be added - a + MIME type. Only valid if the FileInfo was created with . + + representation of the MIME type. To be added @@ -345,7 +351,7 @@ - To be added + Indicates whether the file is a symlink. a To be added @@ -358,7 +364,7 @@ - To be added + Indicates whether the represents a file on the local filesystem. a To be added @@ -371,7 +377,7 @@ - To be added + Indicates whether the property is set. a To be added @@ -384,7 +390,7 @@ - To be added + Indicates whether the property is set. a To be added @@ -397,7 +403,7 @@ - To be added + Indicates whether the sticky bit is set. a To be added diff --git a/doc/en/Gnome.Vfs/FileInfoFields.xml b/doc/en/Gnome.Vfs/FileInfoFields.xml index 4a6d754e5..eec0f3889 100644 --- a/doc/en/Gnome.Vfs/FileInfoFields.xml +++ b/doc/en/Gnome.Vfs/FileInfoFields.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Flags indicating what properties in a class are valid. Name is always assumed valid (how else would you have gotten a instance otherwise?). To be added @@ -41,7 +41,7 @@ - To be added + no properties are valid. To be added @@ -54,7 +54,8 @@ - To be added + + property is valid. To be added @@ -67,7 +68,8 @@ - To be added + + property is valid. To be added @@ -80,7 +82,8 @@ - To be added + + property is valid. To be added @@ -93,7 +96,8 @@ - To be added + + property is valid. To be added @@ -106,7 +110,8 @@ - To be added + + property is valid. To be added @@ -119,7 +124,8 @@ - To be added + + property is valid. To be added @@ -132,7 +138,8 @@ - To be added + + property is valid. To be added @@ -145,7 +152,8 @@ - To be added + + property is valid. To be added @@ -158,7 +166,8 @@ - To be added + + property is valid. To be added @@ -171,7 +180,8 @@ - To be added + + property is valid. To be added @@ -184,7 +194,8 @@ - To be added + + property is valid. To be added @@ -197,7 +208,8 @@ - To be added + + property is valid. To be added @@ -210,7 +222,8 @@ - To be added + + property is valid. To be added @@ -223,7 +236,8 @@ - To be added + + property is valid. To be added @@ -236,7 +250,7 @@ - To be added + the access properties (, and ) are valid. To be added diff --git a/doc/en/Gnome.Vfs/FileInfoOptions.xml b/doc/en/Gnome.Vfs/FileInfoOptions.xml index b984b3bff..dd9618830 100644 --- a/doc/en/Gnome.Vfs/FileInfoOptions.xml +++ b/doc/en/Gnome.Vfs/FileInfoOptions.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Packed boolean bitfield representing options that can be passed into a constructor. To be added @@ -41,7 +41,7 @@ - To be added + default flags. To be added @@ -54,7 +54,7 @@ - To be added + detect the MIME type. To be added @@ -67,7 +67,7 @@ - To be added + only use fast MIME type detection (extensions). To be added @@ -80,7 +80,7 @@ - To be added + force slow MIME type detection where available (sniffing, algorithmic detection, etc). To be added @@ -93,7 +93,7 @@ - To be added + automatically follow symbolic links and retrieve the properties of their target (recommended). To be added @@ -106,7 +106,7 @@ - To be added + tries to get data similar to what would return access(2) on a local file system (ie is the file readable, writable and/or executable). Can be really slow on remote file systems. To be added diff --git a/doc/en/Gnome.Vfs/FilePermissions.xml b/doc/en/Gnome.Vfs/FilePermissions.xml index 7c95e2f4c..459b643eb 100644 --- a/doc/en/Gnome.Vfs/FilePermissions.xml +++ b/doc/en/Gnome.Vfs/FilePermissions.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + File permissions. These are the same as the Unix ones, but we wrap them into a nicer VFS-like enum. To be added @@ -41,7 +41,7 @@ - To be added + UID bit. To be added @@ -54,7 +54,7 @@ - To be added + GID bit. To be added @@ -67,7 +67,7 @@ - To be added + sticky bit. To be added @@ -80,7 +80,7 @@ - To be added + owner has read permission. To be added @@ -93,7 +93,7 @@ - To be added + owner has write permission. To be added @@ -106,7 +106,7 @@ - To be added + owner has execution permission. To be added @@ -119,7 +119,7 @@ - To be added + owner has all permissions. To be added @@ -132,7 +132,7 @@ - To be added + group has read permission. To be added @@ -145,7 +145,7 @@ - To be added + group has write permission. To be added @@ -158,7 +158,7 @@ - To be added + group has execution permission. To be added @@ -171,7 +171,7 @@ - To be added + group has all permissions. To be added @@ -184,7 +184,7 @@ - To be added + others have read permission. To be added @@ -197,7 +197,7 @@ - To be added + others have write permission. To be added @@ -210,7 +210,7 @@ - To be added + others have execution permission. To be added @@ -223,7 +223,7 @@ - To be added + others have all permissions. To be added diff --git a/doc/en/Gnome.Vfs/Handle.xml b/doc/en/Gnome.Vfs/Handle.xml index 37d71ed5e..95faaa9f5 100644 --- a/doc/en/Gnome.Vfs/Handle.xml +++ b/doc/en/Gnome.Vfs/Handle.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + A handle to an asynchronous operation. To be added diff --git a/doc/en/Gnome.Vfs/MimeType.xml b/doc/en/Gnome.Vfs/MimeType.xml index 203840536..7fd792932 100644 --- a/doc/en/Gnome.Vfs/MimeType.xml +++ b/doc/en/Gnome.Vfs/MimeType.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + File Types; functions for getting information about files based on their MIME type. To be added @@ -27,7 +27,7 @@ - To be added + The value returned for the mime type when a file did not match any entries in the mime database. May be treated as a file of an unknown type. To be added @@ -41,9 +41,11 @@ - To be added - a - a + Shortcut for determining the mime type of a file. Use this if you just want to know what mime type a file has and do not want to create a new instance of MimeType. + + representation of the . + + representation of the mime type. To be added @@ -55,8 +57,9 @@ - To be added - a + Returns the representation of the mime type. + + representation of the mime type. To be added @@ -68,7 +71,7 @@ - To be added + Construct a new MimeType for this . a a To be added @@ -82,8 +85,9 @@ - To be added - a + Construct a new MimeType for the specified mime type. + + representation of the mime type. a To be added @@ -97,9 +101,9 @@ - To be added - a - a + Tries to guess the mime type of the data in the buffer using the magic patterns. + a array containing the first part of a file. + the size of the buffer. a To be added @@ -112,7 +116,7 @@ - To be added + Query the mime database for the to be performed on a particular mime type by default. a To be added @@ -125,7 +129,7 @@ - To be added + Query the mime database for default associated with a particular mime type. a To be added @@ -138,7 +142,7 @@ - To be added + Query the mime database for a description of the specified mime type. a To be added @@ -151,8 +155,8 @@ - To be added - a + Query the mime database for an icon representing the specified mime type. + The filename of the icon as listed in the mime database. This is usually a filename without path information, e.g. "i-chardev.png", and sometimes does not have an extension, e.g. "i-regular" if the icon is supposed to be image type agnostic between icon themes. Icons are generic, and not theme specific. These will not necessarily match with the icons a user sees in Nautilus, you have been warned. To be added @@ -164,7 +168,7 @@ - To be added + Indicates whether files of this mime type might conceivably be executable. Default for known types is false. Default for unknown types is true. a To be added @@ -177,7 +181,7 @@ - To be added + The name of the mime type. This is the same as what the method returns. a To be added diff --git a/doc/en/Gnome.Vfs/ModuleCallback.xml b/doc/en/Gnome.Vfs/ModuleCallback.xml index 08e48ec37..65df7c9ee 100644 --- a/doc/en/Gnome.Vfs/ModuleCallback.xml +++ b/doc/en/Gnome.Vfs/ModuleCallback.xml @@ -9,8 +9,86 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + Abstract class used by modules for asking an application for necessary information (authentication for example). + + + +using GLib; +using Gnome.Vfs; +using System; +using System.Text; + +namespace Test.Gnome.Vfs { + public class TestCallback { + private static MainLoop loop; + + static void Main (string[] args) + { + if (args.Length != 1) { + Console.WriteLine ("Usage: TestCallback <uri>"); + return; + } + + Gnome.Vfs.Vfs.Initialize (); + + Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (args[0]); + Handle handle; + + // Test 1: Attempt to access a URI requiring authentication w/o a callback registered. + try { + handle = Sync.Open (uri, OpenMode.Read); + Sync.Close (handle); + Console.WriteLine ("Uri '{0}' doesn't require authentication", uri); + return; + } catch (VfsException ex) { + if (ex.Result != Result.ErrorAccessDenied) + throw ex; + } + + // Test 2: Attempt an open that requires authentication. + ModuleCallbackFullAuthentication cb = new ModuleCallbackFullAuthentication (); + cb.Callback += new ModuleCallbackHandler (OnAuthenticate); + cb.SetDefault (); + + handle = Sync.Open (uri, OpenMode.Read); + Sync.Close (handle); + + // Test 3: This call should not require any new authentication. + Console.WriteLine ("File info: \n{0}", uri.GetFileInfo ()); + + // Test 4: Attempt a call to the parent uri. + FileInfo[] entries = Directory.GetEntries (uri.Parent); + Console.WriteLine ("Directory '{0}' has {1} entries", uri.Parent, entries.Length); + + // Test 5: Pop the authentication callback and try again. + cb.Pop (); + try { + handle = Sync.Open (uri, OpenMode.Read); + } catch (VfsException ex) { + if (ex.Result != Result.ErrorAccessDenied) + throw ex; + } + + Gnome.Vfs.Vfs.Shutdown (); + } + + private static void OnAuthenticate (ModuleCallback cb) + { + ModuleCallbackFullAuthentication fcb = cb as ModuleCallbackFullAuthentication; + Console.Write ("Enter your username ({0}): ", fcb.Username); + string username = Console.ReadLine (); + Console.Write ("Enter your password : "); + string passwd = Console.ReadLine (); + + if (username.Length > 0) + fcb.Username = username; + fcb.Password = passwd; + } + } +} + + + System.Object @@ -26,8 +104,12 @@ - To be added - To be added + Set this ModuleCallback as a temporary handler. will be called on the same thread as the gnome-vfs operation that invokes it. The temporary handler is set per-thread. + + + removes the most recently set temporary handler. The temporary handlers are treated as a first-in first-out stack. + Use this function to set a temporary callback handler for a single call or a few calls. You can use to set a callback function that will establish a permanent global setting for all threads instead. + @@ -38,8 +120,8 @@ - To be added - To be added + Remove the temporary handler set with . If another temporary handler was previously set on the same thread, it becomes the current handler. Otherwise, the default handler, if any, becomes current. + The temporary handlers are treated as a first-in first-out stack. @@ -50,8 +132,8 @@ - To be added - To be added + Set this as the default handler. will be called on the same thread as the gnome-vfs operation that invokes it. The default value is shared for all threads, but setting it is thread-safe. + Use this function if you want to set a handler to be used by your whole application. You can use to set a callback function that will temporarily override the default on the current thread instead. Or you can also use to set an async callback function. @@ -62,8 +144,13 @@ - To be added - To be added + Set as a temprary async handler. will be called from a callback on the main thread. It will be passed a response function which should be called to signal completion of the callback. The callback function itself may return in the meantime. + + The temporary async handler is set per-thread. + + removes the most recently set temporary temporary handler. The temporary async handlers are treated as a first-in first-out stack. + Use this function to set a temporary async callback handler for a single call or a few calls. You can use to set an async callback function that will establish a permanent global setting for all threads instead. + @@ -74,8 +161,8 @@ - To be added - To be added + Remove the temporary async handler most recently set with . If another temporary async handler was previously set on the same thread, it becomes the current handler. Otherwise, the default async handler, if any, becomes current. + The temporary async handlers are treated as a first-in first-out stack. @@ -86,8 +173,12 @@ - To be added - To be added + Set the default async callback. will be called from a callback on the main thread. It will be passed a response function which should be called to signal completion of the callback. The callback function itself may return in the meantime. + + The default value is shared for all threads, but setting it is thread-safe. + Use this function if you want to globally set a callback handler for use with async operations. + You can use to set an async callback function that will temporarily override the default on the current thread instead. Or you can also use to set a regular callback function. + @@ -109,8 +200,8 @@ - To be added - To be added + Event which is called when a gnome-vfs module requires additional information from an application such as authentication. + Implementations of have properties such as which can be retrieved and set from the handler. These properties are only valid during the callback activation. diff --git a/doc/en/Gnome.Vfs/Monitor.xml b/doc/en/Gnome.Vfs/Monitor.xml index dcf4864ee..d52840657 100644 --- a/doc/en/Gnome.Vfs/Monitor.xml +++ b/doc/en/Gnome.Vfs/Monitor.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Monitor changes to files and directories. To be added @@ -29,9 +29,10 @@ - To be added - a - a + Watch the file or directory at uri for changes (or the creation/deletion of the file) and fire an event when there is a change. If a directory monitor is added, an event is fired when any file in the directory changes. + + representation of a . + whether the to monitor is a file or directory. a To be added @@ -44,7 +45,7 @@ - To be added + Stop monitoring any files and directories. a To be added @@ -55,7 +56,7 @@ - To be added + Create a new instance. a To be added @@ -68,7 +69,7 @@ - To be added + File data has changed. To be added @@ -80,7 +81,7 @@ - To be added + A file has been deleted. To be added @@ -116,7 +117,7 @@ - To be added + A file has been created. To be added @@ -128,7 +129,7 @@ - To be added + A file metadata has changed. To be added diff --git a/doc/en/Gnome.Vfs/MonitorEventType.xml b/doc/en/Gnome.Vfs/MonitorEventType.xml deleted file mode 100644 index f37568a7d..000000000 --- a/doc/en/Gnome.Vfs/MonitorEventType.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - gnome-vfs-sharp - [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4] - 2.0.0.0 - neutral - - - Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - To be added - To be added - - - System.Enum - - - - System.IComparable - - - System.IConvertible - - - System.IFormattable - - - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - Gnome.Vfs.MonitorEventType - - - - - To be added - To be added - - - - - Field - - System.Int32 - - - - - To be added - To be added - - - - \ No newline at end of file diff --git a/doc/en/Gnome.Vfs/MonitorHandler.xml b/doc/en/Gnome.Vfs/MonitorHandler.xml index b54e8a99e..a4d53780d 100644 --- a/doc/en/Gnome.Vfs/MonitorHandler.xml +++ b/doc/en/Gnome.Vfs/MonitorHandler.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Delegate used for notification of changes in monitored files and/or directories. See . To be added diff --git a/doc/en/Gnome.Vfs/MonitorType.xml b/doc/en/Gnome.Vfs/MonitorType.xml index fd69360b8..e6d430ddc 100644 --- a/doc/en/Gnome.Vfs/MonitorType.xml +++ b/doc/en/Gnome.Vfs/MonitorType.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Type of to monitor. To be added @@ -37,7 +37,7 @@ - To be added + a file. To be added @@ -50,7 +50,7 @@ - To be added + a directory. To be added diff --git a/doc/en/Gnome.Vfs/OpenMode.xml b/doc/en/Gnome.Vfs/OpenMode.xml index d9ba0f4ad..4267200dd 100644 --- a/doc/en/Gnome.Vfs/OpenMode.xml +++ b/doc/en/Gnome.Vfs/OpenMode.xml @@ -9,8 +9,8 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + Mode in which files are opened. + If is not used, the file will be have to be accessed sequentially. System.Enum diff --git a/doc/en/Gnome.Vfs/Priority.xml b/doc/en/Gnome.Vfs/Priority.xml index 8113080e4..76396b3b0 100644 --- a/doc/en/Gnome.Vfs/Priority.xml +++ b/doc/en/Gnome.Vfs/Priority.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Standard values for the priority to use when executing asynchronous operations. To be added @@ -37,7 +37,7 @@ - To be added + Minimum priority value. To be added @@ -50,7 +50,7 @@ - To be added + Default priority value. To be added @@ -63,7 +63,7 @@ - To be added + Maximum priority value. To be added diff --git a/doc/en/Gnome.Vfs/Result.xml b/doc/en/Gnome.Vfs/Result.xml index 1c0166028..8583392f8 100644 --- a/doc/en/Gnome.Vfs/Result.xml +++ b/doc/en/Gnome.Vfs/Result.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Enumeration containing result codes for gnome-vfs operations. To be added @@ -37,7 +37,7 @@ - To be added + No error. To be added @@ -50,7 +50,7 @@ - To be added + File not found. To be added @@ -63,7 +63,7 @@ - To be added + Generic error. To be added @@ -76,7 +76,7 @@ - To be added + Internal error. To be added @@ -89,7 +89,7 @@ - To be added + Invalid parameters. To be added @@ -102,7 +102,7 @@ - To be added + Unsupported operation. To be added @@ -115,7 +115,7 @@ - To be added + I/O error. To be added @@ -128,7 +128,7 @@ - To be added + Data corrupted. To be added @@ -141,7 +141,7 @@ - To be added + Format not valid. To be added @@ -154,7 +154,7 @@ - To be added + Bad file handle. To be added @@ -167,7 +167,7 @@ - To be added + File too big. To be added @@ -180,7 +180,7 @@ - To be added + No space left on device. To be added @@ -193,7 +193,7 @@ - To be added + Read-only file system. To be added @@ -206,7 +206,7 @@ - To be added + Invalid . To be added @@ -219,7 +219,7 @@ - To be added + File not open. To be added @@ -232,7 +232,7 @@ - To be added + Open mode not valid. To be added @@ -245,7 +245,7 @@ - To be added + Access denied. To be added @@ -258,7 +258,7 @@ - To be added + Too many open files. To be added @@ -271,7 +271,7 @@ - To be added + End of file. To be added @@ -284,7 +284,7 @@ - To be added + Not a directory. To be added @@ -297,7 +297,7 @@ - To be added + Operation in progress. To be added @@ -310,7 +310,7 @@ - To be added + Operation interrupted. To be added @@ -323,7 +323,7 @@ - To be added + File exists. To be added @@ -336,7 +336,7 @@ - To be added + Looping links encountered. To be added @@ -349,7 +349,7 @@ - To be added + Operation not permitted. To be added @@ -362,7 +362,7 @@ - To be added + Is a directory. To be added @@ -375,7 +375,7 @@ - To be added + Not enough memory. To be added @@ -388,7 +388,7 @@ - To be added + Host not found. To be added @@ -401,7 +401,7 @@ - To be added + Host name not valid. To be added @@ -414,7 +414,7 @@ - To be added + Host has no address. To be added @@ -427,7 +427,7 @@ - To be added + Login failed. To be added @@ -440,7 +440,7 @@ - To be added + Operation cancelled. To be added @@ -453,7 +453,7 @@ - To be added + Directory busy. To be added @@ -466,7 +466,7 @@ - To be added + Directory not empty. To be added @@ -479,7 +479,7 @@ - To be added + Too many links. To be added @@ -492,7 +492,7 @@ - To be added + Read only file system. To be added @@ -505,7 +505,7 @@ - To be added + Not on the same file system. To be added @@ -518,7 +518,7 @@ - To be added + Name too long. To be added @@ -531,7 +531,7 @@ - To be added + Service not available. To be added @@ -544,7 +544,7 @@ - To be added + Request obsoletes service's data. To be added @@ -557,7 +557,7 @@ - To be added + Protocol error. To be added @@ -570,7 +570,7 @@ - To be added + Could not find master browser. To be added @@ -583,7 +583,7 @@ - To be added + No default action associated. To be added @@ -596,7 +596,7 @@ - To be added + No handler for URL scheme. To be added @@ -609,7 +609,7 @@ - To be added + Error parsing command line. To be added @@ -622,7 +622,7 @@ - To be added + Error launching command. To be added @@ -635,7 +635,7 @@ - To be added + Number of errors. To be added diff --git a/doc/en/Gnome.Vfs/SeekPosition.xml b/doc/en/Gnome.Vfs/SeekPosition.xml index c59a1bc7b..be86eae11 100644 --- a/doc/en/Gnome.Vfs/SeekPosition.xml +++ b/doc/en/Gnome.Vfs/SeekPosition.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Used to specify the start position for seek operations. To be added @@ -37,7 +37,7 @@ - To be added + Start of the file. To be added @@ -50,7 +50,7 @@ - To be added + Current position. To be added @@ -63,7 +63,7 @@ - To be added + End of the file. To be added diff --git a/doc/en/Gnome.Vfs/Sync.xml b/doc/en/Gnome.Vfs/Sync.xml index d681209d8..2f7fc4aa6 100644 --- a/doc/en/Gnome.Vfs/Sync.xml +++ b/doc/en/Gnome.Vfs/Sync.xml @@ -9,8 +9,57 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + File Operations; basic POSIX-style file operations. + + + +using Gnome.Vfs; +using System; +using System.Text; + +namespace Test.Gnome.Vfs { + public class TestSync { + static void Main (string[] args) + { + if (args.Length != 1) { + Console.WriteLine ("Usage: TestSync <uri>"); + return; + } + + Gnome.Vfs.Vfs.Initialize (); + + Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (args[0]); + Handle handle = Sync.Open (uri, OpenMode.Read); + + UTF8Encoding utf8 = new UTF8Encoding (); + byte[] buffer = new byte[1024]; + Result result = Result.Ok; + while (result == Result.Ok) { + ulong bytesRead; + result = Sync.Read (handle, out buffer[0], + (ulong)buffer.Length, out bytesRead); + Console.WriteLine ("result read '{0}' = {1}", uri, result); + if (bytesRead == 0) + break; + Console.WriteLine ("read ({0} bytes) : '{1}'", + bytesRead, utf8.GetString (buffer, 0, (int)bytesRead)); + } + + string test; + result = Sync.FileControl (handle, "file:test", out test); + Console.WriteLine ("result filecontrol '{0}' = {1}", uri, result); + Console.WriteLine ("result file:test = {0}", test); + + result = Sync.Close (handle); + Console.WriteLine ("result close '{0}' = {1}", uri, result); + + Gnome.Vfs.Vfs.Shutdown (); + } + } +} + + + System.Object @@ -28,7 +77,7 @@ - To be added + Close file associated with . a a To be added @@ -47,11 +96,13 @@ - To be added - a - a - a - a + Create uri according to . + + representing the to create. + + . + Whether the file should be created in "exclusive" mode: i.e. if this flag is true, the operation will fail if a file with the same name already exists. + Bitmap representing the for the newly created file (Unix style). a To be added @@ -69,11 +120,13 @@ - To be added - a - a - a - a + Create according to . + + for the file to create. + + . + Whether the file should be created in "exclusive" mode: i.e. if this flag is true, the operation will fail if a file with the same name already exists. + Bitmap representing the for the newly created file (Unix style). a To be added @@ -89,9 +142,11 @@ - To be added - a - a + Open uri according to . + + representing the to open. + + . a To be added @@ -107,9 +162,11 @@ - To be added - a - a + Open according to . + + to open. + + . a To be added @@ -127,13 +184,15 @@ - To be added - a - a - a - a + Read specified number of bytes from the uri . + + of the file to read data from. + + array that must be at least as large as the specified number of bytes to read. The array needs to be passed as "out buffer[0]". + The number of bytes to read. + The number of bytes actually read. a - To be added + As with Unix system calls, the number of bytes read can effectively be less than the specified number of bytes on return and will be stored in bytes_read. @@ -148,10 +207,12 @@ - To be added - a - a - a + Set the current position for reading/writing through . + + for which the current position must be changed. + + value representing the starting position. + number of bytes to skip from the position specified by (a positive value means to move forward; a negative one to move backwards). a To be added @@ -169,13 +230,15 @@ - To be added - a - a - a - a + Write number of bytes from buffer byte array into the file pointed to be . + + of the file to write data to. + + array containing the data to be written. + number of bytes to write. + number of bytes actually written. a - To be added + As with Unix system calls, the number of bytes written can effectively be less than the specified number or bytes on return and will be stored in bytes_written. @@ -189,9 +252,10 @@ - To be added - a - a + Return the current position on . This is the point in the file pointed to by that reads and writes will occur on. + + for which the current position must be retrieved. + Contains the position on return. a To be added @@ -207,9 +271,10 @@ - To be added - a - a + Truncate the file represented by uri to the specified length. Data past the new length will be discarded. + + representation of . + length of the new file. a To be added @@ -225,9 +290,10 @@ - To be added - a - a + Truncate the file pointed at by to the specified length. Data past the new length will be discarded. + + to the file to be truncated. + length of the new file. a To be added @@ -244,13 +310,13 @@ - To be added - a - a - a + Execute a backend dependent operation specified by the string operation. + a to the file to affect. + operation to execute. + data needed to execute the operation. a - To be added + This is typically used for specialized vfs backends that need additional operations that gnome-vfs doesn't have. Compare it to the unix call ioctl(). The format of data depends on the operation. Operation that are backend specific are normally namespaced by their module name. - + \ No newline at end of file diff --git a/doc/en/Gnome.Vfs/Uri.xml b/doc/en/Gnome.Vfs/Uri.xml index 6398aad3e..328a9ba29 100644 --- a/doc/en/Gnome.Vfs/Uri.xml +++ b/doc/en/Gnome.Vfs/Uri.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Functions for manipulating Uris. To be added @@ -22,22 +22,6 @@ - - - Method - - GLib.List - - - - - - To be added - a - a - To be added - - Method @@ -49,110 +33,13 @@ - To be added + Returns a full Uri given a full base Uri, and a secondary Uri which may be relative. a a a To be added - - - Method - - System.UInt32 - - - - - - To be added - a - a - To be added - - - - - Method - - GLib.List - - - - - - To be added - a - a - To be added - - - - - Method - - GLib.List - - - - - - To be added - a - a - To be added - - - - - Method - - System.Void - - - - - - To be added - a - To be added - - - - - Method - - GLib.List - - - - - - To be added - a - a - To be added - - - - - Method - - System.Int32 - - - - - - - To be added - a - a - a - To be added - - Method @@ -161,22 +48,9 @@ - To be added + Retrieve base file name for the Uri, ignoring any trailing path separators. a - To be added - - - - - Method - - Gnome.Vfs.Uri - - - - To be added - a - To be added + This matches the XPG definition of basename, but not g_basename. This is often useful when you want the name of something that's pointed to by a Uri, and don't care whether the Uri has a directory or file form. If the Uri points to the root of a domain, the host name is returned. If there's no host name, it returns a single path character. @@ -189,24 +63,12 @@ - To be added - a + Translate the Uri into a printable string hiding the fields specified by . + hide the specified fields. a To be added - - - Method - - System.Void - - - - To be added - To be added - - Method @@ -215,9 +77,9 @@ - To be added + Retrieve base file name for the Uri, ignoring any trailing path separators. a - To be added + This matches the XPG definition of basename, but not g_basename. This is often useful when you want the name of something that's pointed to by a Uri, and don't care whether the Uri has a directory or file form. If the Uri points to the root (including the root of any domain), it returns a single path character. @@ -230,8 +92,9 @@ - To be added - a + Create a new Uri from relative_reference, relative to this Uri. + + representing a possibly relative Uri reference. a To be added @@ -246,7 +109,7 @@ - To be added + Create a new Uri obtained by appending the Uri fragment. This will take care of adding an appropriate directory separator between the end of the Uri and the start of the fragment if necessary. a a To be added @@ -262,28 +125,12 @@ - To be added + Create a new Uri obtained by appending the path. This will take care of adding an appropriate directory separator between the end of the Uri and the start of the path if necessary as well as escaping the path as necessary. a a To be added - - - Method - - System.Boolean - - - - - - To be added - a - a - To be added - - Method @@ -292,7 +139,7 @@ - To be added + Extract the name of the directory in which the file pointed to by the Uri is stored as a newly allocated string. The string will end with a path character. a To be added @@ -307,25 +154,12 @@ - To be added + Create a new Uri obtained by appending the specified filename. This will take care of adding an appropriate directory separator between the end of Uri and the start of the filename if necessary. a a To be added - - - Method - - Gnome.Vfs.Uri - - - - To be added - a - To be added - - Method @@ -337,9 +171,9 @@ - To be added + Check if the possible_child Uri is contained by this Uri. If recursive is false, just try the immediate parent directory, else search up through the hierarchy. a - a + a flag to turn recursive check on. a To be added @@ -352,7 +186,7 @@ - To be added + Returns the for this Uri. a To be added @@ -367,8 +201,9 @@ - To be added - a + Returns the for this Uri with the specified . + + for the metadata. a To be added @@ -381,7 +216,7 @@ - To be added + Translate the Uri into a printable string using . a To be added @@ -408,8 +243,9 @@ - To be added - a + Create a new Uri instance from the representation. + + representation of a Uri. a To be added @@ -422,7 +258,7 @@ - To be added + Retrieve the Uris host name. a To be added @@ -435,7 +271,7 @@ - To be added + Check if the Uri points to an existing entity. a To be added @@ -448,8 +284,8 @@ - To be added - a + Retrieve the host port number. + The host port number used. If the value is zero, the default port value for the specified toplevel access method is used. To be added @@ -461,7 +297,7 @@ - To be added + Retrieve the full path name. a To be added @@ -474,7 +310,7 @@ - To be added + Retrieve the user name. a To be added @@ -487,7 +323,7 @@ - To be added + Retrieve the optional fragment identifier. a To be added @@ -500,7 +336,7 @@ - To be added + Retrieve the . a To be added @@ -513,7 +349,7 @@ - To be added + Retrieve the password. a To be added @@ -526,7 +362,7 @@ - To be added + Check if the Uri is a local (native) file system. a To be added @@ -539,7 +375,7 @@ - To be added + Retrieve the Uris parent. a To be added @@ -552,7 +388,7 @@ - To be added + Check if Uri has a parent or not. a To be added @@ -565,7 +401,7 @@ - To be added + Retrieve the scheme. a To be added @@ -578,10 +414,97 @@ - To be added + The Uris . a To be added + + + Method + + Gnome.Vfs.Uri + + + + Creates a duplicate of the Uri. + a + To be added + + + + + Method + + System.Int32 + + + + Generates a hash code for the current instance. + a + To be added + + + + + Method + + Gnome.Vfs.Uri[] + + + + + + Extracts a list of Uris from a standard text/uri-list, such as one you would get on a drop operation. + a + a + To be added + + + + + Method + + Gnome.Vfs.Result + + + + + + Truncate the Uri to be the specified length in bytes. Data past the specified length will be discarded. + length of the new file. + a + To be added + + + + + Method + + Gnome.Vfs.Result + + + + Unlink this Uri (i.e. delete the file). + a + To be added + + + + + Method + + System.Boolean + + + + + + Compare the two Uris. + a + Returns true if the two Uris are equal, otherwise false. + To be added + + \ No newline at end of file diff --git a/doc/en/Gnome.Vfs/UriHideOptions.xml b/doc/en/Gnome.Vfs/UriHideOptions.xml index 02a783341..6524885dd 100644 --- a/doc/en/Gnome.Vfs/UriHideOptions.xml +++ b/doc/en/Gnome.Vfs/UriHideOptions.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Enumeration indicating which parts of a should be hidden when translated to a . To be added @@ -41,7 +41,7 @@ - To be added + don't hide anything. To be added @@ -54,7 +54,7 @@ - To be added + hide the user name. To be added @@ -67,7 +67,7 @@ - To be added + hide the password. To be added @@ -80,7 +80,7 @@ - To be added + hide the host name. To be added @@ -93,7 +93,7 @@ - To be added + hide the host port. To be added @@ -106,7 +106,7 @@ - To be added + hide the method (e.g. http, file). To be added @@ -119,7 +119,7 @@ - To be added + hide the fragment identifier. To be added diff --git a/doc/en/Gnome.Vfs/Vfs.xml b/doc/en/Gnome.Vfs/Vfs.xml index f41d0e439..62284829e 100644 --- a/doc/en/Gnome.Vfs/Vfs.xml +++ b/doc/en/Gnome.Vfs/Vfs.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Common VFS tasks. To be added @@ -26,72 +26,27 @@ - To be added - a - To be added - - - - - Method - - System.Boolean - - - - To be added - a - To be added - - - - - Method - - System.Boolean - - - - - - To be added - a - a + If Gnome.Vfs is not already initialized, initialize it. This must be called prior to performing any other Gnome.Vfs operations, and may be called multiple times without error. + true if Gnome.Vfs was succesfully initialized or was already initialized. To be added - + Method Gnome.Vfs.Result - - + + - To be added - a - a - a - a - To be added - - - - - Method - - Gnome.Vfs.Result - - - - - - To be added - a + Move a file from source to dest. This will only work if source and dest are on the same file system. Otherwise, it is necessary to use the more general function. + source . + destination . + If true, move target to new_uri even if there is already a file at new_uri. If there is a file, it will be discarded. a To be added @@ -106,64 +61,12 @@ - To be added - a + Returns a string representation of , useful for debugging purposes, but probably not appropriate for passing to the user. + a value. a To be added - - - Method - - System.String - - - - - - To be added - a - a - To be added - - - - - Method - - Gnome.Vfs.Result - - - - - - - To be added - a - a - a - To be added - - - - - Method - - Gnome.Vfs.Result - - - - - - - To be added - a - a - a - To be added - - Method @@ -174,7 +77,7 @@ - To be added + Throws a with the appropriate description if the is not . a To be added @@ -190,10 +93,12 @@ - To be added - a - a - To be added + Throws a with the appropriate description if the is not . + + to which the pertains. + + return value. + Throws a if is passed. Otherwise a is thrown. @@ -207,10 +112,12 @@ - To be added - a - a - To be added + Throws a with the appropriate description if the is not . + + representing the in question. + + return value. + Throws a if is passed. Otherwise a is thrown. @@ -221,10 +128,22 @@ - To be added + Returns whether Gnome.Vfs has already been initialized. a + Gnome.Vfs must be initialized prior to using any methods or operations. + + + + + Method + + System.Void + + + + Cease all active Gnome.Vfs operations and unload the Mime database from memory. To be added - + \ No newline at end of file diff --git a/doc/en/Gnome.Vfs/VfsException.xml b/doc/en/Gnome.Vfs/VfsException.xml index bb0452f81..d727c81fa 100644 --- a/doc/en/Gnome.Vfs/VfsException.xml +++ b/doc/en/Gnome.Vfs/VfsException.xml @@ -9,7 +9,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added + Custom Vfs class. To be added @@ -30,8 +30,9 @@ - To be added - a + Create a new VfsException based on the specified . + + return value from an operation. a To be added @@ -44,7 +45,7 @@ - To be added + the error code from the underlying operation. a To be added diff --git a/doc/en/Gnome.Vfs/VfsStream.xml b/doc/en/Gnome.Vfs/VfsStream.xml index e2e5e9a2e..663601c4a 100644 --- a/doc/en/Gnome.Vfs/VfsStream.xml +++ b/doc/en/Gnome.Vfs/VfsStream.xml @@ -9,8 +9,12 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + + implementation using the Gnome.Vfs library. + + The VfsStream class hides the Gnome.Vfs API from the developer. It uses the class and associated enums to access the representation of the passed in the constructor. + This class is particularly useful if you want to develop an application that wants to use Gnome.Vfs where available, but can't depend on it being available always. On platforms where Gnome.Vfs is not available, the application can fallback to a regular . This doesn't affect how the rest of the application deals with the stream since both implement the abstract class. + System.IO.Stream @@ -234,11 +238,13 @@ - To be added - a - a + Construct a new instance of the VfsStream with the specified . + + representing the to open. + + specifying how to open the . a - To be added + The underlying file will be accessed synchronously using the class. @@ -251,12 +257,14 @@ - To be added - a - a - a + Construct a new instance of the VfsStream with the specified . Based the async parameter, the file will be accessed (a)synchronously. + + representing the to open. + + specifying how to open the . + whether to access the file (a)sychronously. a - To be added + The underlying file will be accessed either by using the or class. @@ -267,7 +275,8 @@ - To be added + + value indicating whether the current stream supports reading. a To be added @@ -280,7 +289,8 @@ - To be added + + value indicating whether the current stream supports writing. a To be added @@ -293,7 +303,8 @@ - To be added + + value indicating whether the current stream supports seeking. a To be added @@ -306,7 +317,8 @@ - To be added + + value indicating whether the current stream is (a)synchronous. a To be added @@ -319,7 +331,7 @@ - To be added + Gets the representing the which this stream reads and writes from. a To be added @@ -332,7 +344,7 @@ - To be added + Gets the length in bytes of the stream. a To be added @@ -345,7 +357,7 @@ - To be added + Gets or sets the position within the current stream. a To be added diff --git a/gnomevfs/Directory.cs b/gnomevfs/Directory.cs index 42a80ba15..2c9d7ffaa 100644 --- a/gnomevfs/Directory.cs +++ b/gnomevfs/Directory.cs @@ -85,14 +85,14 @@ namespace Gnome.Vfs { [DllImport ("gnomevfs-2")] private static extern Result gnome_vfs_make_directory (string uri, uint perm); - public static Result Create (Uri uri, uint perm) + public static Result Create (Uri uri, FilePermissions perm) { return Create (uri.ToString (), perm); } - public static Result Create (string uri, uint perm) + public static Result Create (string uri, FilePermissions perm) { - return gnome_vfs_make_directory (uri, perm); + return gnome_vfs_make_directory (uri, (uint)perm); } [DllImport ("gnomevfs-2")] diff --git a/gnomevfs/Gnomevfs.metadata b/gnomevfs/Gnomevfs.metadata index 5ad0f0564..6cd96ae61 100644 --- a/gnomevfs/Gnomevfs.metadata +++ b/gnomevfs/Gnomevfs.metadata @@ -38,7 +38,7 @@ MimeActionType MimeApplicationArgumentType ModuleCallbackFullAuthenticationFlags - MonitorEventType + 1 MonitorType OpenMode ProcessOptions @@ -103,7 +103,18 @@ ToplevelUri Transform Uri + Clone GetExists + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 UnixMount UnixMountPoint XferProgressInfo diff --git a/gnomevfs/Monitor.cs b/gnomevfs/Monitor.cs index 1f40c1d62..5367f61e5 100644 --- a/gnomevfs/Monitor.cs +++ b/gnomevfs/Monitor.cs @@ -45,6 +45,15 @@ namespace Gnome.Vfs { } } + internal enum MonitorEventType { + Changed, + Deleted, + Startexecuting, + Stopexecuting, + Created, + MetadataChanged, + } + public class Monitor { private IntPtr handle; private MonitorCallbackWrapper wrapper; diff --git a/gnomevfs/Uri.custom b/gnomevfs/Uri.custom index 724207175..cf8745fc1 100644 --- a/gnomevfs/Uri.custom +++ b/gnomevfs/Uri.custom @@ -33,7 +33,56 @@ return new FileInfo (this, options); } + [DllImport("gnomevfs-2")] + static extern bool gnome_vfs_uri_equal(IntPtr raw, IntPtr b); + + public override bool Equals (object o) { + if (o is Uri) { + Uri uri = o as Uri; + return gnome_vfs_uri_equal (Handle, uri.Handle); + } else { + return false; + } + } + + [DllImport("gnomevfs-2")] + static extern uint gnome_vfs_uri_hash(IntPtr p); + + public override int GetHashCode () { + return checked ((int)gnome_vfs_uri_hash (Handle)); + } + + [DllImport("gnomevfs-2")] + static extern IntPtr gnome_vfs_uri_list_parse(string uri_list); + + public static Uri[] ParseList (string uri_list) { + IntPtr raw_ret = gnome_vfs_uri_list_parse(uri_list); + GLib.List list = new GLib.List(raw_ret); + Uri[] uris = new Uri [list.Count]; + for (int i = 0; i < list.Count; i++) + uris[i] = list[i] as Uri; + list.Dispose (); + return uris; + } + public override string ToString () { return ToString (UriHideOptions.None); } + + [DllImport ("gnomevfs-2")] + private static extern Result gnome_vfs_truncate_uri (IntPtr raw, ulong length); + + public Result Truncate (ulong length) + { + return gnome_vfs_truncate_uri (Handle, length); + } + + [DllImport ("gnomevfs-2")] + private static extern Result gnome_vfs_unlink_from_uri (IntPtr raw); + + public Result Unlink () + { + return gnome_vfs_unlink_from_uri (Handle); + } + diff --git a/gnomevfs/Vfs.cs b/gnomevfs/Vfs.cs index 7f5d1ef91..47f3ecc2e 100644 --- a/gnomevfs/Vfs.cs +++ b/gnomevfs/Vfs.cs @@ -50,33 +50,19 @@ namespace Gnome.Vfs { } [DllImport ("gnomevfs-2")] - static extern bool gnome_vfs_shutdown (); + static extern void gnome_vfs_shutdown (); - public static bool Shutdown () + public static void Shutdown () { - return gnome_vfs_shutdown (); - } - - public static bool Exists (string textUri) - { - Uri uri = new Uri (textUri); - return uri.Exists; + gnome_vfs_shutdown (); } [DllImport ("gnomevfs-2")] private static extern Result gnome_vfs_move (string old_uri, string new_uri, bool force_replace); - public static Result Move (string old_uri, string new_uri, bool force_replace) + public static Result Move (string source, string dest, bool force_replace) { - return gnome_vfs_move (old_uri, new_uri, force_replace); - } - - [DllImport ("gnomevfs-2")] - private static extern Result gnome_vfs_unlink (string uri); - - public static Result Unlink (string uri) - { - return gnome_vfs_unlink (uri); + return gnome_vfs_move (source, dest, force_replace); } [DllImport ("gnomevfs-2")] @@ -87,25 +73,12 @@ namespace Gnome.Vfs { return ResultToString ((int)result); } - public static string ResultToString (int result) + internal static string ResultToString (int result) { IntPtr ptr = gnome_vfs_result_to_string (result); return Marshal.PtrToStringAnsi (ptr); } - [DllImport ("gnomevfs-2")] - private static extern Result gnome_vfs_truncate (string uri, ulong length); - - public static Result Truncate (string uri, ulong length) - { - return gnome_vfs_truncate (uri, length); - } - - public static Result Truncate (Uri uri, ulong length) - { - return Truncate (uri.ToString (), length); - } - public static void ThrowException (Result result) { ThrowException ((string)null, result); diff --git a/gnomevfs/VfsStream.cs b/gnomevfs/VfsStream.cs index a2beb9d6e..eca5c5219 100644 --- a/gnomevfs/VfsStream.cs +++ b/gnomevfs/VfsStream.cs @@ -153,7 +153,7 @@ namespace Gnome.Vfs { if (mode == FileMode.CreateNew) { string dname = uri.ExtractDirname (); - if (dname != "" && !Vfs.Exists (dname)) + if (dname != "" && !new Uri (dname).Exists) throw new DirectoryNotFoundException ("Could not find a part of " + "the path \"" + dname + "\"."); } @@ -231,7 +231,7 @@ namespace Gnome.Vfs { Wait (); } else { handle = Sync.Open (uri, om); - result = Sync.Truncate (handle, 0); + result = uri.Truncate (0); Vfs.ThrowException (uri, result); } } else { @@ -289,7 +289,7 @@ namespace Gnome.Vfs { break; case FileMode.Truncate: if (uri.Exists) { - result = Vfs.Truncate (uri, 0); + result = uri.Truncate (0); if (async) { handle = Async.Open (uri, om, (int)Async.Priority.Default, diff --git a/sample/gnomevfs/TestUnlink.cs b/sample/gnomevfs/TestUnlink.cs index 1b3f9b234..a595ceaea 100644 --- a/sample/gnomevfs/TestUnlink.cs +++ b/sample/gnomevfs/TestUnlink.cs @@ -13,7 +13,7 @@ namespace Test.Gnome.Vfs { Gnome.Vfs.Vfs.Initialize (); Gnome.Vfs.Uri uri = new Gnome.Vfs.Uri (args[0]); - Result result = Gnome.Vfs.Vfs.Unlink (uri.ToString ()); + Result result = uri.Unlink (); Console.WriteLine ("result unlink ('{0}') = {1}", uri, result);