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

* generator/ReturnValue.cs : don't write a sem in FromNative.
	* glib/ListBase.cs : handle GLib.Object explicit element types.
	* glib/Marshaler.cs : only copy lists if Count > 0.
	* gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element
	type for automatic list to array marshaling.
	* gtk/Window.custom : kill manual ListToplevels impl.

svn path=/trunk/gtk-sharp/; revision=45654
This commit is contained in:
Mike Kestner 2005-06-08 17:29:48 +00:00
parent a307c78232
commit e24d72317a
6 changed files with 15 additions and 19 deletions

View File

@ -1,3 +1,12 @@
2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : don't write a sem in FromNative.
* glib/ListBase.cs : handle GLib.Object explicit element types.
* glib/Marshaler.cs : only copy lists if Count > 0.
* gtk/Gtk.metadata : unhide Window.ListToplevels with a proper element
type for automatic list to array marshaling.
* gtk/Window.custom : kill manual ListToplevels impl.
2005-06-08 Mike Kestner <mkestner@novell.com>
* generator/ReturnValue.cs : improved list to array marshaling.

View File

@ -108,7 +108,7 @@ namespace GtkSharp.Generation {
var += ", true";
else if (ElementType != String.Empty) {
string type_str = "typeof (" + ElementType + ")";
return String.Format ("({0}[]) GLib.Marshaller.ListToArray ({1}, {2});", ElementType, IGen.FromNativeReturn (var + ", " + type_str), type_str);
return String.Format ("({0}[]) GLib.Marshaller.ListToArray ({1}, {2})", ElementType, IGen.FromNativeReturn (var + ", " + type_str), type_str);
}
return IGen.FromNativeReturn (var);
}

View File

@ -147,6 +147,8 @@ namespace GLib {
ret = Marshaller.Utf8PtrToString (data);
else if (element_type == typeof (FilenameString))
ret = Marshaller.FilenamePtrToString (data);
else if (element_type.IsSubclassOf (typeof (GLib.Object)))
ret = GLib.Object.GetObject (data, false);
else if (element_type == typeof (int))
ret = (int) data;
else if (element_type.IsValueType)

View File

@ -282,7 +282,8 @@ namespace GLib {
public static Array ListToArray (ListBase list, System.Type type)
{
Array result = Array.CreateInstance (type, list.Count);
list.CopyTo (result, 0);
if (list.Count > 0)
list.CopyTo (result, 0);
return result;
}
}

View File

@ -549,7 +549,7 @@
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetSize']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='HasToplevelFocus']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='IsActive']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='ListToplevels']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='ListToplevels']/return-type" name="element_type">Gtk.Window</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='SetDefaultIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='SetIconList']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/property[@name='Screen']" name="new_flag">1</attr>

View File

@ -76,22 +76,6 @@
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_window_list_toplevels();
public static Window[] ListToplevels ()
{
IntPtr raw_ret = gtk_window_list_toplevels();
if (raw_ret == IntPtr.Zero)
return new Window [0];
GLib.List list = new GLib.List(raw_ret);
Window[] result = new Window [list.Count];
for (int i = 0; i < list.Count; i++)
result [i] = list [i] as Window;
return result;
}
public Gdk.Size DefaultSize {
get {
return new Gdk.Size (DefaultWidth, DefaultHeight);