Re: [java-gnome-hackers] GtkCellRendererCombo - help appreciated
Brought to you by:
afcowie
From: Stefan P. <st...@pr...> - 2008-09-13 22:36:57
|
Hi all, I was revisiting my attempts to implement a CellRendererCombo. This time I was trying to implement a "DataColumnTreeModel" to give the CellRendererCombo a column to pick its model from. public final class DataColumnTreeModel extends DataColumn { public DataColumnTreeModel() { super(TreeModel.class); } } I ran into the problem that there is no mapping from TreeModel to a GType: org.freedesktop.bindings.FatalError: Don't know how to map org.gnome.gtk.TreeModel into a GType So I tried modifying src/jni/bindings_java_type.[c|h] to add some mappings: } else if (g_str_equal(fqcn, "org.gnome.gtk.TreeStore")) { return GTK_TYPE_TREE_STORE; } else if (g_str_equal(fqcn, "org.gnome.gtk.ListStore")) { return GTK_TYPE_LIST_STORE; } else if (g_str_equal(fqcn, "org.gnome.gtk.TreeModel")) { return GTK_TYPE_TREE_MODEL; While this got me a bit further, I now seem to have problems with an assertion in the native GTK code: org.gnome.glib.FatalError: Gtk-CRITICAL gtk_cell_renderer_combo_set_property: assertion `GTK_IS_TREE_MODEL (object)' failed which propably leads to the line in gtk/gtktreemodel.h #define GTK_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL)) So from my understanding GTK has problems identifying e.g. a org.gnome.gtk.ListStore (which is an implementation of the abstract org.gnome.gtk.TreeModel) as of being of a native GtkTreeModel. Correct? Am Mittwoch, den 14.05.2008, 15:22 +1000 schrieb Andrew Cowie: > It _might_ be the same class of problem that we recently ran into with > GValues holding enums: for some reason GValue gets grumpy when asked to > hold abstract types. See 'textview' revno 508. Possibly. Honestly I feel a bit overwhelmed by the whole Plumbing, GValue, GType and generally deep and dirty mapping stuff. > [..] > What a pain. I hate GValues. > > In fact, I'd be happy if they went away entirely. That would mean making > GObject.setProperty(), GtkTreeView.setValue() and anything else that > uses GValue have a native overload for every type combination [in a > hand written Override]. That *is* doable, but at present we have all > those code paths concentrated through the Value code paths. > > Well, whatever. Something for the future. So that means there is currently no simple workaround to get the CellRendererCombo working? Regards, Stefan |