Re: Having trouble with TreeView, GNOME 3.2 (GTK 3.2)



On 24 August 2012 16:12, Jasper St. Pierre <jstpierre mecheye net> wrote:
> I doubt gjs from GNOME 3.2 works properly with TreeModel and
> everything. I wrote a lot of code for GNOME 3.4 for gjs for it.
>

Cheers. I found a way to make it not segfault, but if GNOME 3.2 + gjs
+ TreeModel is sort of buggy I may just steer clear of it and find
another way to do what I want.

For interest, this is how I got it "working" (it doesn't segfault and
displays the labels in the TreeView. Haven't tested editting,
removing, ...):

I found out about GObject.type_from_name and
GObject.type_from_name('gchararray') returns 64.

So I set the column type to 64, and using .set segfaults but using
.set_value doesn't:

store.set(iter, [0], ['asdf']); // <-- segfaults
store.set_value(iter, 0, 'asdf'); // <-- doesn't segfault

cheers.

> On Fri, Aug 24, 2012 at 2:05 AM, Amy C <mathematical coffee gmail com> wrote:
>> 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
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> https://mail.gnome.org/mailman/listinfo/gtk-list
>
>
>
> --
>   Jasper


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