[Gtk-sharp-list] Some problem with IconSize enum
Peter Williams
peter@newton.cx
Sat, 15 May 2004 20:05:07 -0400
--=-W3Coh4EsKs1UhPqoKnZP
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2004-05-15 at 18:13, Peter Williams wrote:
> Hi,
>
> I'm having some kind of problem with setting enum values in HEAD
> gtk-sharp. When I run the attached program, I get:
Ok, so it seems like the problem here is that the "stock_size" property
of GtkCellRendererPixbuf is stored as uint, which glib thinks is not
compatible with an enum. And the introspection that Gtk# uses causes it
to try and assign an enum-typed GValue to the property which results in
an error.
Attached is a patch to work around the issue because I suspect a patch
to gtk+ wouldn't go in due to interface compatibility constraints.
Peter
--
Peter Williams peter@newton.cx
"[Ninjas] are cool; and by cool, I mean totally sweet."
-- REAL Ultimate Power
--=-W3Coh4EsKs1UhPqoKnZP
Content-Disposition: attachment; filename=stocksize.diff
Content-Type: text/x-patch; name=stocksize.diff; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
? gtk/CellRendererPixbuf.custom
Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.805
diff -u -r1.805 ChangeLog
--- ChangeLog 14 May 2004 20:25:56 -0000 1.805
+++ ChangeLog 15 May 2004 23:19:09 -0000
@@ -1,3 +1,11 @@
+2004-05-15 Peter Williams <peter@newton.cx>
+
+ * gtk/CellRendererPixbuf.custom: New file: customization to interface
+ with the somewhat wonky StockSize property.
+
+ * gtk/Gtk.metadata: Suppress generation of the default StockSize property
+ getter/setter because it has a problem.
+
2004-05-14 Todd Berman <tberman@sevenl.net>
* glib/Object.cs: make static GLib.Object.LookupGType protected for now.
Index: gtk/Gtk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Gtk.metadata,v
retrieving revision 1.56
diff -u -r1.56 Gtk.metadata
--- gtk/Gtk.metadata 10 May 2004 20:00:08 -0000 1.56
+++ gtk/Gtk.metadata 15 May 2004 23:19:09 -0000
@@ -79,6 +79,7 @@
<attr path="/api/namespace/object[@cname='GtkButton']/signal[@name='Enter']" name="name">Entered</attr>
<attr path="/api/namespace/object[@cname='GtkButton']/signal[@name='Leave']" name="name">Left</attr>
<attr path="/api/namespace/object[@cname='GtkCalendar']/method[@name='DisplayOptions']" name="name">SetDisplayOptions</attr>
+ <attr path="/api/namespace/object[@cname='GtkCellRendererPixbuf']/property[@name='StockSize']" name="hidden">1</attr> <!--pkwill-->
<attr path="/api/namespace/object[@cname='GtkCheckButton']/constructor[@cname='gtk_check_button_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkCheckMenuItem']/constructor[@cname='gtk_check_menu_item_new_with_mnemonic']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCheckMenuItem']/constructor[@cname='gtk_check_menu_item_new_with_label']" name="hidden">1</attr>
Index: gtk/Makefile.am
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Makefile.am,v
retrieving revision 1.13
diff -u -r1.13 Makefile.am
--- gtk/Makefile.am 14 May 2004 20:25:57 -0000 1.13
+++ gtk/Makefile.am 15 May 2004 23:19:09 -0000
@@ -34,6 +34,7 @@
Button.custom \
Calendar.custom \
CellRenderer.custom \
+ CellRendererPixbuf.custom \
CheckMenuItem.custom \
Clipboard.custom \
ColorSelection.custom \
--=-W3Coh4EsKs1UhPqoKnZP
Content-Disposition: attachment; filename=CellRendererPixbuf.custom
Content-Type: text/plain; name=CellRendererPixbuf.custom; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
//
// CellRendererPixbuf.custom - Gtk CellRendererPixbuf class customizations
//
// Author: Peter Williams <peter@newton.cx
//
// Copyright (C) 2004 Peter Williams
//
// This code is inserted after the automatically generated code.
//
// this is needed because stock_size is stored as a uint,
// but it corresponds to Gtk enum type, and glib doesn't
// think the two are compatible.
public IconSize StockSize {
get {
GLib.Value val = GetProperty ("stock_size");
Gtk.IconSize ret = (Gtk.IconSize) (uint) val;
return ret;
}
set {
GLib.Value val = new GLib.Value ((uint) value);
SetProperty ("stock_size", val);
}
}
--=-W3Coh4EsKs1UhPqoKnZP--