2004-11-01 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* gnomevfs/Directory.cs: Bind gnome_vfs_directory_list_load as a static FileInfo[] GetEntries (uri) method. * gnomevfs/FileInfo.cs: Add internal FileInfoNative constructor to create a FileInfo class based on an existing FileInfoNative struct. * gnomevfs/Makefile.am: * sample/gnomevfs/Makefile.am: * sample/gnomevfs/TestDirectory.cs: svn path=/trunk/gtk-sharp/; revision=35532
This commit is contained in:
parent
ed8c757a0f
commit
33dbe7485e
6 changed files with 106 additions and 6 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004-11-01 Jeroen Zwartepoorte <jeroen@xs4all.nl>
|
||||||
|
|
||||||
|
* gnomevfs/Directory.cs: Bind gnome_vfs_directory_list_load as a static
|
||||||
|
FileInfo[] GetEntries (uri) method.
|
||||||
|
* gnomevfs/FileInfo.cs: Add internal FileInfoNative constructor to
|
||||||
|
create a FileInfo class based on an existing FileInfoNative struct.
|
||||||
|
* gnomevfs/Makefile.am:
|
||||||
|
* sample/gnomevfs/Makefile.am:
|
||||||
|
* sample/gnomevfs/TestDirectory.cs:
|
||||||
|
|
||||||
2004-10-30 Todd Berman <tberman@off.net>
|
2004-10-30 Todd Berman <tberman@off.net>
|
||||||
|
|
||||||
* gtk/ComboBox.custom:
|
* gtk/ComboBox.custom:
|
||||||
|
|
48
gnomevfs/Directory.cs
Normal file
48
gnomevfs/Directory.cs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
//
|
||||||
|
// Directory.cs: Bindings for gnome-vfs directory functions calls.
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Jeroen Zwartepoorte <jeroen@xs4all.nl>
|
||||||
|
//
|
||||||
|
// (C) Copyright Jeroen Zwartepoorte 2004
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Gnome.Vfs {
|
||||||
|
public class Directory {
|
||||||
|
[DllImport ("gnomevfs-2")]
|
||||||
|
private static extern Result gnome_vfs_directory_list_load (out IntPtr list, string uri, FileInfoOptions options);
|
||||||
|
|
||||||
|
public static FileInfo[] GetEntries (Uri uri)
|
||||||
|
{
|
||||||
|
return GetEntries (uri.ToString ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileInfo[] GetEntries (Uri uri, FileInfoOptions options)
|
||||||
|
{
|
||||||
|
return GetEntries (uri.ToString (), options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FileInfo[] GetEntries (string text_uri)
|
||||||
|
{
|
||||||
|
return GetEntries (text_uri, FileInfoOptions.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
FileInfo[] entries = new FileInfo [list.Count];
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
entries[i] = new FileInfo ((FileInfo.FileInfoNative) list [i]);
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,6 +53,12 @@ namespace Gnome.Vfs {
|
||||||
[DllImport ("gnomevfs-2")]
|
[DllImport ("gnomevfs-2")]
|
||||||
extern static void gnome_vfs_file_info_unref (ref FileInfoNative info);
|
extern static void gnome_vfs_file_info_unref (ref FileInfoNative info);
|
||||||
|
|
||||||
|
internal FileInfo (FileInfoNative info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
uri = null;
|
||||||
|
}
|
||||||
|
|
||||||
public FileInfo (string uri) : this (uri, FileInfoOptions.Default) {}
|
public FileInfo (string uri) : this (uri, FileInfoOptions.Default) {}
|
||||||
|
|
||||||
public FileInfo (string uri, FileInfoOptions options) : this (new Uri (uri), options) {}
|
public FileInfo (string uri, FileInfoOptions options) : this (new Uri (uri), options) {}
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
SUBDIRS = .
|
SUBDIRS = .
|
||||||
|
|
||||||
|
if ENABLE_GNOMEVFS
|
||||||
|
TARGET = $(ASSEMBLY) $(ASSEMBLY).config
|
||||||
|
APIS = $(API) $(ADDITIONAL_API)
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = gnome-vfs-sharp-2.0.pc
|
||||||
|
else
|
||||||
|
TARGET =
|
||||||
|
APIS =
|
||||||
|
endif
|
||||||
|
|
||||||
API = gnomevfs-api.xml
|
API = gnomevfs-api.xml
|
||||||
ADDITIONAL_API = gnomevfs-symbols.xml
|
ADDITIONAL_API = gnomevfs-symbols.xml
|
||||||
RAW_API = gnomevfs-api.raw
|
RAW_API = gnomevfs-api.raw
|
||||||
|
@ -8,11 +18,10 @@ METADATA = Gnomevfs.metadata
|
||||||
ASSEMBLY_NAME = gnome-vfs-sharp
|
ASSEMBLY_NAME = gnome-vfs-sharp
|
||||||
references = /r:../glib/glib-sharp.dll
|
references = /r:../glib/glib-sharp.dll
|
||||||
|
|
||||||
TARGET = $(ASSEMBLY)
|
|
||||||
ASSEMBLY = $(ASSEMBLY_NAME).dll
|
ASSEMBLY = $(ASSEMBLY_NAME).dll
|
||||||
gapidir = $(datadir)/gapi-2.0
|
gapidir = $(datadir)/gapi-2.0
|
||||||
noinst_DATA = $(ASSEMBLY) $(ASSEMBLY).config
|
noinst_DATA = $(TARGET)
|
||||||
gapi_DATA = $(API) $(ADDITIONAL_API)
|
gapi_DATA = $(APIS)
|
||||||
CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API) glue/generated.c gtk-sharp.snk
|
CLEANFILES = $(ASSEMBLY) generated-stamp generated/*.cs $(API) glue/generated.c gtk-sharp.snk
|
||||||
DISTCLEANFILES = $(ASSEMBLY).config AssemblyInfo.cs gnome-vfs-sharp.pc
|
DISTCLEANFILES = $(ASSEMBLY).config AssemblyInfo.cs gnome-vfs-sharp.pc
|
||||||
|
|
||||||
|
@ -24,6 +33,7 @@ sources = \
|
||||||
AsyncReadCallbackNative.cs \
|
AsyncReadCallbackNative.cs \
|
||||||
AsyncWriteCallback.cs \
|
AsyncWriteCallback.cs \
|
||||||
AsyncWriteCallbackNative.cs \
|
AsyncWriteCallbackNative.cs \
|
||||||
|
Directory.cs \
|
||||||
FileInfo.cs \
|
FileInfo.cs \
|
||||||
Handle.cs \
|
Handle.cs \
|
||||||
MimeType.cs \
|
MimeType.cs \
|
||||||
|
@ -71,9 +81,6 @@ gtk-sharp.snk: $(top_srcdir)/gtk-sharp.snk
|
||||||
$(ASSEMBLY): $(build_sources) generated-stamp gtk-sharp.snk
|
$(ASSEMBLY): $(build_sources) generated-stamp gtk-sharp.snk
|
||||||
$(CSC) /unsafe /out:$(ASSEMBLY) /target:library $(references) $(build_sources) $(GENERATED_SOURCES)
|
$(CSC) /unsafe /out:$(ASSEMBLY) /target:library $(references) $(build_sources) $(GENERATED_SOURCES)
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
|
||||||
pkgconfig_DATA = gnome-vfs-sharp-2.0.pc
|
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
@if test -n '$(TARGET)'; then \
|
@if test -n '$(TARGET)'; then \
|
||||||
echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \
|
echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
TARGETS = \
|
TARGETS = \
|
||||||
TestAsync.exe \
|
TestAsync.exe \
|
||||||
TestAsyncStream.exe \
|
TestAsyncStream.exe \
|
||||||
|
TestDirectory.exe \
|
||||||
TestInfo.exe \
|
TestInfo.exe \
|
||||||
TestMime.exe \
|
TestMime.exe \
|
||||||
TestMonitor.exe \
|
TestMonitor.exe \
|
||||||
|
@ -21,6 +22,7 @@ CLEANFILES = $(TARGETS)
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
TestAsync.cs \
|
TestAsync.cs \
|
||||||
TestAsyncStream.cs \
|
TestAsyncStream.cs \
|
||||||
|
TestDirectory.cs \
|
||||||
TestInfo.cs \
|
TestInfo.cs \
|
||||||
TestMime.cs \
|
TestMime.cs \
|
||||||
TestMonitor.cs \
|
TestMonitor.cs \
|
||||||
|
@ -38,6 +40,9 @@ TestAsync.exe: $(srcdir)/TestAsync.cs $(assemblies)
|
||||||
TestAsyncStream.exe: $(srcdir)/TestAsyncStream.cs $(assemblies)
|
TestAsyncStream.exe: $(srcdir)/TestAsyncStream.cs $(assemblies)
|
||||||
$(CSC) /out:TestAsyncStream.exe $(references) $(srcdir)/TestAsyncStream.cs
|
$(CSC) /out:TestAsyncStream.exe $(references) $(srcdir)/TestAsyncStream.cs
|
||||||
|
|
||||||
|
TestDirectory.exe: $(srcdir)/TestDirectory.cs $(assemblies)
|
||||||
|
$(CSC) /out:TestDirectory.exe $(references) $(srcdir)/TestDirectory.cs
|
||||||
|
|
||||||
TestInfo.exe: $(srcdir)/TestInfo.cs $(assemblies)
|
TestInfo.exe: $(srcdir)/TestInfo.cs $(assemblies)
|
||||||
$(CSC) /out:TestInfo.exe $(references) $(srcdir)/TestInfo.cs
|
$(CSC) /out:TestInfo.exe $(references) $(srcdir)/TestInfo.cs
|
||||||
|
|
||||||
|
|
24
sample/gnomevfs/TestDirectory.cs
Normal file
24
sample/gnomevfs/TestDirectory.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using Gnome.Vfs;
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Test.Gnome.Vfs {
|
||||||
|
public class TestInfo {
|
||||||
|
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]);
|
||||||
|
|
||||||
|
foreach (FileInfo info in entries)
|
||||||
|
Console.WriteLine (info.ToString ());
|
||||||
|
|
||||||
|
Gnome.Vfs.Vfs.Shutdown ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue