From 1a16f6680343538eb410dfce8d318df0aca53120 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 8 Jan 2009 18:43:00 +0000 Subject: [PATCH] 2009-01-08 Mike Kestner * generator/ReturnValue.cs: map gfilename* list elements to type ListBase.FilenameString so they are marshaled correctly. * glib/Marshaller.cs: handle FilenameStrings in ListPtrToArray. * gtk/Gtk.metadata: FileChooser.GetFilenames and ListShortcutFolders return type mangling to avoid custom implementations. * gtk/FileChooser*.custom: kill manual Filenames and ShortcutFolders. svn path=/trunk/gtk-sharp/; revision=122802 --- ChangeLog | 9 ++++++++ generator/ReturnValue.cs | 2 +- glib/Marshaller.cs | 3 ++- gtk/FileChooser.custom | 24 -------------------- gtk/FileChooserButton.custom | 43 ------------------------------------ gtk/FileChooserDialog.custom | 22 ------------------ gtk/FileChooserWidget.custom | 43 ------------------------------------ gtk/Gtk.metadata | 10 ++++++--- gtk/Makefile.am | 3 --- 9 files changed, 19 insertions(+), 140 deletions(-) delete mode 100644 gtk/FileChooser.custom delete mode 100644 gtk/FileChooserButton.custom delete mode 100644 gtk/FileChooserWidget.custom diff --git a/ChangeLog b/ChangeLog index 6b6cef298..24ba27721 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-01-08 Mike Kestner + + * generator/ReturnValue.cs: map gfilename* list elements to type + ListBase.FilenameString so they are marshaled correctly. + * glib/Marshaller.cs: handle FilenameStrings in ListPtrToArray. + * gtk/Gtk.metadata: FileChooser.GetFilenames and ListShortcutFolders + return type mangling to avoid custom implementations. + * gtk/FileChooser*.custom: kill manual Filenames and ShortcutFolders. + 2009-01-08 Stephane Delcroix * gio/Gio.metadata: change AppInfo's CanRemoveSupportsType to a diff --git a/generator/ReturnValue.cs b/generator/ReturnValue.cs index 4ace994d1..54a971d61 100644 --- a/generator/ReturnValue.cs +++ b/generator/ReturnValue.cs @@ -126,7 +126,7 @@ namespace GtkSharp.Generation { if (IGen.QualifiedName == "GLib.PtrArray") return String.Format ("({0}[]) GLib.Marshaller.PtrArrayToArray ({1}, {2}, typeof({0}))", ElementType, var, args); else - return String.Format ("({0}[]) GLib.Marshaller.ListPtrToArray ({1}, typeof({2}), {3}, typeof({0}))", ElementType, var, IGen.QualifiedName, args); + return String.Format ("({0}[]) GLib.Marshaller.ListPtrToArray ({1}, typeof({2}), {3}, typeof({4}))", ElementType, var, IGen.QualifiedName, args, element_ctype == "gfilename*" ? "GLib.ListBase.FilenameString" : ElementType); } else if (IGen is HandleBase) return ((HandleBase)IGen).FromNative (var, owned); else if (is_null_term) diff --git a/glib/Marshaller.cs b/glib/Marshaller.cs index 6dfb2c42d..520c9a38d 100644 --- a/glib/Marshaller.cs +++ b/glib/Marshaller.cs @@ -377,6 +377,7 @@ namespace GLib { public static Array ListPtrToArray (IntPtr list_ptr, Type list_type, bool owned, bool elements_owned, Type elem_type) { + Type array_type = elem_type == typeof (ListBase.FilenameString) ? typeof (string) : elem_type; ListBase list; if (list_type == typeof(GLib.List)) list = new GLib.List (list_ptr, elem_type, owned, elements_owned); @@ -384,7 +385,7 @@ namespace GLib { list = new GLib.SList (list_ptr, elem_type, owned, elements_owned); using (list) - return ListToArray (list, elem_type); + return ListToArray (list, array_type); } public static Array PtrArrayToArray (IntPtr list_ptr, bool owned, bool elements_owned, Type elem_type) diff --git a/gtk/FileChooser.custom b/gtk/FileChooser.custom deleted file mode 100644 index a5b42635f..000000000 --- a/gtk/FileChooser.custom +++ /dev/null @@ -1,24 +0,0 @@ -// Gtk.FileChooser.custom - Gtk FileChooser customizations -// -// Authors: Mike Kestner -// -// Copyright (c) 2004 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - - string[] Filenames { get; } - string[] ShortcutFolders { get; } - diff --git a/gtk/FileChooserButton.custom b/gtk/FileChooserButton.custom deleted file mode 100644 index f18e302b0..000000000 --- a/gtk/FileChooserButton.custom +++ /dev/null @@ -1,43 +0,0 @@ -// Gtk.FileChooserButton.custom - Gtk FileChooserButton customizations -// -// Authors: Mike Kestner -// -// Copyright (c) 2005 Novell, Inc. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_get_filenames (IntPtr raw); - - public string[] Filenames { - get { - IntPtr raw_ret = gtk_file_chooser_get_filenames (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_list_shortcut_folders (IntPtr raw); - - public string[] ShortcutFolders { - get { - IntPtr raw_ret = gtk_file_chooser_list_shortcut_folders (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - diff --git a/gtk/FileChooserDialog.custom b/gtk/FileChooserDialog.custom index 68f55432b..8c9aafab7 100644 --- a/gtk/FileChooserDialog.custom +++ b/gtk/FileChooserDialog.custom @@ -66,25 +66,3 @@ AddButton ((string) button_data [i], (int) button_data [i + 1]); } - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_get_filenames (IntPtr raw); - - public string[] Filenames { - get { - IntPtr raw_ret = gtk_file_chooser_get_filenames (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_list_shortcut_folders (IntPtr raw); - - public string[] ShortcutFolders { - get { - IntPtr raw_ret = gtk_file_chooser_list_shortcut_folders (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - diff --git a/gtk/FileChooserWidget.custom b/gtk/FileChooserWidget.custom deleted file mode 100644 index f5db8a2b3..000000000 --- a/gtk/FileChooserWidget.custom +++ /dev/null @@ -1,43 +0,0 @@ -// Gtk.FileChooserWidget.custom - Gtk FileChooserWidget customizations -// -// Authors: Todd Berman -// -// Copyright (c) 2004 Todd Berman -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of version 2 of the Lesser GNU General -// Public License as published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - - - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_get_filenames (IntPtr raw); - - public string[] Filenames { - get { - IntPtr raw_ret = gtk_file_chooser_get_filenames (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - - [DllImport ("libgtk-win32-2.0-0.dll")] - static extern IntPtr gtk_file_chooser_list_shortcut_folders (IntPtr raw); - - public string[] ShortcutFolders { - get { - IntPtr raw_ret = gtk_file_chooser_list_shortcut_folders (Handle); - GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString), true, true); - return (string[]) GLib.Marshaller.ListToArray (list, typeof (string)); - } - } - diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index 9e9ea711a..80f3f84a5 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -153,7 +153,9 @@ 1 gfilename* gfilename* - 1 + true + gfilename* + true gfilename* const-gfilename* const-gfilename* @@ -163,7 +165,10 @@ GetFilters GtkFileFilter* true - 1 + GetShortcutFolders + true + gfilename* + true GetShortcutFolderUris gchar* true @@ -789,7 +794,6 @@ 1 1 ProcessEvent - 1 out 1 1 diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 6628640c1..d3f420d57 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -72,10 +72,7 @@ customs = \ Drag.custom \ Entry.custom \ EntryCompletion.custom \ - FileChooser.custom \ - FileChooserButton.custom \ FileChooserDialog.custom \ - FileChooserWidget.custom \ FileSelection.custom \ Frame.custom \ HBox.custom \