2004-11-03 Todd Berman <tberman@off.net>

* gtk/FileChooserDialog.custom:
        * gtk/FileChooserWidget.custom: Properly implement .Filenames. The old
        code was a really bad c&p job.

svn path=/trunk/gtk-sharp/; revision=35619
This commit is contained in:
Todd Berman 2004-11-04 04:06:07 +00:00
parent ad4b452f48
commit 131f2ed0d9
3 changed files with 22 additions and 27 deletions

View File

@ -1,3 +1,9 @@
2004-11-03 Todd Berman <tberman@off.net>
* gtk/FileChooserDialog.custom:
* gtk/FileChooserWidget.custom: Properly implement .Filenames. The old
code was a really bad c&p job.
2004-11-02 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* gnomevfs/AsyncDirectoryLoadCallback.cs:

View File

@ -54,21 +54,15 @@
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_get_filenames (IntPtr raw);
[DllImport("libglib-2.0-0.dll")]
static extern void g_strfreev (IntPtr handle);
public string[] Filenames {
get {
IntPtr strv = gtk_file_chooser_get_filenames (Handle);
System.Collections.ArrayList result = new System.Collections.ArrayList ();
int i = 0;
IntPtr strptr = Marshal.ReadIntPtr (strv, IntPtr.Size * i++);
while (strptr != IntPtr.Zero) {
result.Add (Marshal.PtrToStringAnsi (strptr));
strptr = Marshal.ReadIntPtr (strv, IntPtr.Size * i++);
}
g_strfreev (strv);
return result.ToArray (typeof (string)) as string[];
IntPtr raw_ret = gtk_file_chooser_get_filenames (Handle);
if (raw_ret == IntPtr.Zero)
return new string[0];
GLib.SList list = new GLib.SList (raw_ret, typeof (string));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
return result;
}
}

View File

@ -22,20 +22,15 @@
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_file_chooser_get_filenames (IntPtr raw);
[DllImport("libglib-2.0-0.dll")]
static extern void g_strfreev (IntPtr handle);
public string[] Filenames {
get {
IntPtr strv = gtk_file_chooser_get_filenames (Handle);
System.Collections.ArrayList result = new System.Collections.ArrayList ();
int i = 0;
IntPtr strptr = Marshal.ReadIntPtr (strv, IntPtr.Size * i++);
while (strptr != IntPtr.Zero) {
result.Add (Marshal.PtrToStringAnsi (strptr));
strptr = Marshal.ReadIntPtr (strv, IntPtr.Size * i++);
}
g_strfreev (strv);
return result.ToArray (typeof (string)) as string[];
IntPtr raw_ret = gtk_file_chooser_get_filenames (Handle);
if (raw_ret == IntPtr.Zero)
return new string[0];
GLib.SList list = new GLib.SList (raw_ret, typeof (string));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
return result;
}
}