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:
parent
ad4b452f48
commit
131f2ed0d9
3 changed files with 22 additions and 27 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue