2005-06-02 Mike Kestner <mkestner@novell.com>

* glib/ListBase.cs : add a nested class to support filename encoded
	string element marshaling.
	* gtk/Gtk.metadata : mark the filenames and folders as filename
	encoded.
	* gtk/FileChooserDialog.custom : use new ListBase.FilenameString type
	for list element type of filenames and folders.
	* gtk/FileChooserWidget.custom : use new ListBase.FilenameString type
	for list element type of filenames and folders.
	[Fixes #72701]

svn path=/trunk/gtk-sharp/; revision=45334
This commit is contained in:
Mike Kestner 2005-06-02 16:16:28 +00:00
parent bd2b0d9a7f
commit ff096ac998
7 changed files with 49 additions and 6 deletions

View file

@ -1,3 +1,15 @@
2005-06-02 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs : add a nested class to support filename encoded
string element marshaling.
* gtk/Gtk.metadata : mark the filenames and folders as filename
encoded.
* gtk/FileChooserDialog.custom : use new ListBase.FilenameString type
for list element type of filenames and folders.
* gtk/FileChooserWidget.custom : use new ListBase.FilenameString type
for list element type of filenames and folders.
[Fixes #72701]
2005-06-02 Mike Kestner <mkestner@novell.com>
* generator/ConstFilenameGen.cs : new generatable for filename encoded

View file

@ -0,0 +1,18 @@
<Type Name="ListBase+FilenameString" FullName="GLib.ListBase+FilenameString">
<TypeSignature Language="C#" Value="public class FilenameString" />
<AssemblyInfo>
<AssemblyName>glib-sharp</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Members>
</Members>
<Docs>
<summary>Type for Filename encoded string element marshaling.</summary>
<remarks>Use this type as a List constructor element_type parameter to use filename-encoded string marshaling.</remarks>
</Docs>
</Type>

View file

@ -71,6 +71,7 @@
<Type Name="TimeoutHandler" />
<Type Name="LogLevelFlags" />
<Type Name="TypeFundamentals" />
<Type Name="ListBase+FilenameString" />
</Namespace>
<Namespace Name="Pango">
<Type Name="Attribute" />

View file

@ -1,8 +1,9 @@
// SList.cs - GSList class wrapper implementation
// ListBase.cs - List base class implementation
//
// Authors: Mike Kestner <mkestner@speakeasy.net>
// Authors: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2002 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
@ -134,12 +135,18 @@ namespace GLib {
orig.CopyTo (array, index);
}
public class FilenameString {
private FilenameString () {}
}
internal object DataMarshal (IntPtr data)
{
object ret = null;
if (element_type != null) {
if (element_type == typeof (string))
ret = Marshaller.Utf8PtrToString (data);
else if (element_type == typeof (FilenameString))
ret = Marshaller.FilenamePtrToString (data);
else if (element_type == typeof (int))
ret = (int) data;
else if (element_type.IsValueType)

View file

@ -71,7 +71,7 @@
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));
GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
@ -119,7 +119,7 @@
IntPtr raw_ret = gtk_file_chooser_list_shortcut_folders (Handle);
if (raw_ret == IntPtr.Zero)
return new string[0];
GLib.SList list = new GLib.SList (raw_ret, typeof (string));
GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];

View file

@ -27,7 +27,7 @@
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));
GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];
@ -75,7 +75,7 @@
IntPtr raw_ret = gtk_file_chooser_list_shortcut_folders (Handle);
if (raw_ret == IntPtr.Zero)
return new string[0];
GLib.SList list = new GLib.SList (raw_ret, typeof (string));
GLib.SList list = new GLib.SList (raw_ret, typeof (GLib.ListBase.FilenameString));
string[] result = new string [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = (string) list [i];

View file

@ -87,7 +87,12 @@
<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='position']" name="pass_as">ref</attr>
<attr path="/api/namespace/interface[@cname='GtkEditable']/signal[@name='InsertText']" name="name">TextInserted</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='GetPreviewFilename']/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/parameters/*[@name='filename']" name="type">const-gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method/parameters/*[@name='folder']" name="type">const-gfilename*</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='GetUris']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='ListFilters']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='GtkFileChooser']/method[@name='ListShortcutFolders']" name="hidden">1</attr>