2009-01-08 Mike Kestner <mkestner@novell.com>

* 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
This commit is contained in:
Mike Kestner 2009-01-08 18:43:00 +00:00
parent 3030c6d535
commit 1a16f66803
9 changed files with 19 additions and 140 deletions

View file

@ -1,3 +1,12 @@
2009-01-08 Mike Kestner <mkestner@novell.com>
* 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 <sdelcroix@novell.com>
* gio/Gio.metadata: change AppInfo's CanRemoveSupportsType to a

View file

@ -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)

View file

@ -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)

View file

@ -1,24 +0,0 @@
// Gtk.FileChooser.custom - Gtk FileChooser customizations
//
// Authors: Mike Kestner <mkestner@novell.com>
//
// 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; }

View file

@ -1,43 +0,0 @@
// Gtk.FileChooserButton.custom - Gtk FileChooserButton customizations
//
// Authors: Mike Kestner <mkestner@novell.com>
//
// 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));
}
}

View file

@ -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));
}
}

View file

@ -1,43 +0,0 @@
// Gtk.FileChooserWidget.custom - Gtk FileChooserWidget customizations
//
// Authors: Todd Berman <tberman@off.net>
//
// 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));
}
}

View file

@ -153,7 +153,9 @@
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/property[@name='Action']" name="new_flag">1</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetCurrentFolder']/return-type" name="type">gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilename']/return-type" name="type">gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilenames']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilenames']/return-type" name="owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilenames']/return-type" name="element_type">gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetFilenames']/return-type" name="elements_owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetPreviewFilename']/return-type" name="type">gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method/parameters/*[@name='filename']" name="type">const-gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method/parameters/*[@name='folder']" name="type">const-gfilename*</attr>
@ -163,7 +165,10 @@
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_filters']" name="name">GetFilters</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_filters']/return-type" name="element_type">GtkFileFilter*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_filters']/return-type" name="owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='ListShortcutFolders']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folders']" name="name">GetShortcutFolders</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folders']/return-type" name="owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folders']/return-type" name="element_type">gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folders']/return-type" name="elements_owned">true</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folder_uris']" name="name">GetShortcutFolderUris</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folder_uris']/return-type" name="element_type">gchar*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@cname='gtk_file_chooser_list_shortcut_folder_uris']/return-type" name="elements_owned">true</attr>
@ -789,7 +794,6 @@
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroy']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroyed']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Event']" name="name">ProcessEvent</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetAllocation']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetChildRequisition']/*/*[@name='requisition']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetColormap']" name="needs_ref">1</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetDefaultColormap']" name="needs_ref">1</attr>

View file

@ -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 \