2004-10-29 Todd Berman <tberman@off.net>

* gtk/FileChooserDialog.custom: Add Filenames property to return
        the data as a string[] instead of a GSList.
        * gtk/FileChooserWidget.custom: Same as above.
        * gtk/Makefile.am: Add FileChooserWidget.custom

svn path=/trunk/gtk-sharp/; revision=35492
This commit is contained in:
Todd Berman 2004-10-30 02:40:00 +00:00
parent 8d5882f49b
commit 3bc36b0d37
5 changed files with 50 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2004-10-29 Todd Berman <tberman@off.net>
* gtk/FileChooserDialog.custom: Add Filenames property to return
the data as a string[] instead of a GSList.
* gtk/FileChooserWidget.custom: Same as above.
* gtk/Makefile.am: Add FileChooserWidget.custom
2004-10-30 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* sources/gtk-sharp-sources.xml: Invalid XML due to unremoved -->

View file

@ -13,3 +13,24 @@
{
Raw = gtk_file_chooser_dialog_new_with_backend (title, parent == null ? IntPtr.Zero : parent.Handle, (int)action, backend, IntPtr.Zero);
}
[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[];
}
}

View file

@ -0,0 +1,20 @@
[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[];
}
}

View file

@ -64,6 +64,7 @@
<attr path="/api/namespace/interface[@cname='GtkEditable']/method[@name='SetEditable']" name="name">SetIsEditable</attr>
<attr path="/api/namespace/interface[@cname='GtkEditable']/signal[@name='DeleteText']" name="name">TextDeleted</attr>
<attr path="/api/namespace/interface[@cname='GtkEditable']/signal[@name='InsertText']" name="name">TextInserted</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilenames']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetIterFirst']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='Get']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkTreeModel']/method[@name='GetIterFromString']/*/*[@name='iter']" name="pass_as">out</attr>

View file

@ -46,6 +46,7 @@ customs = \
Dialog.custom \
Entry.custom \
FileChooserDialog.custom \
FileChooserWidget.custom \
FileSelection.custom \
FileSystemModel.custom \
Frame.custom \