Having trouble with TreeView, GNOME 3.2 (GTK 3.2)



Hi all,

I'm trying to append a value to my TreeView/ListStore, but keep
getting a segmentation fault.

The segmentation fault occurs when I try to call ListStore.append(),
and using gdb the problem is:

0x445fc373 in g_type_check_is_value_type () from /lib/libgobject-2.0.so.0

This snippet is sufficient to reproduce the problem (run in
gjs-console on GNOME 3.2):

const Gtk = imports.gi.Gtk;

let store = new Gtk.ListStore();
store.set_column_types([16]); // <-- looked up G_TYPE_STRING: cannot
find this anywhere (it is not exported in imports.gi.GObject on GNOME
3.2)

// try add the first row 'asdf'
let iter = store.append();
store.set(iter, [0], ['asdf']); // <-- segfault here

Now I suspect the problem is somehow to do with me specifying 16 as
the column type (I want G_TYPE_STRING), but according to the GObject
docs[0] G_TYPE_STRING is G_TYPE_MAKE_FUNDAMENTAL(16), and when I tried

const GObject = imports.gi.GObject;
GObject.type_fundamental(16); // <-- gives 16
GObject.type_check_type_is_value_type(16); // <-- gives TRUE

If I instead try:

store.set_value(iter, 0, 'asdf');

I get "Unable to convert from gchararray to guchar".

Can anyone shed some light on this?

[0]: http://developer.gnome.org/gobject/stable/gobject-Type-Information.html#G-TYPE-STRING:CAPS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]