GtkTreeModel and gpointer



Hi all,

I am writing an application for playing digital
talking books (DAISY books).  There will be a tree
view sidebar to show the table of contents.

In the actual book, the TOC is an XHTML file.  I read
this file in using Xerces/SAX and make a vector list
of structs.  Each struct contains an element's display
text, ID, and level .  This part works just fine.

After a new element struct is created, a gpointer to
it is stored in the GtkTreeModel.  Hierarchical
placement is based on the element's level.  The tree
model uses G_TYPE_POINTER.  Because I am storing more
than raw text, I defined a cell data function to get
the display text from the struct and show it in the
cell.  Here is the problem - the gpointer value seems
correct (matches earlier pointer values used by the
vector-of-structs) but the data I am getting is total
garbage.  However, the original storage
vector-of-structs is still intact.

If I skip the cell func, as you might expect, I get a
treeview with the correct order of entries but no
text.

It could be that this is more of a C++ problem than a
GTK problem .. but if anyone has done something
similar (GtkTreeModel with gpointer), I would love to
see how you did it.

I would be grateful if anyone has some ideas about
this...I am really stuck.  I've attached the code,
MSVC project files, and sample input ncc.html file.

Thanks
Marisa
--
AMIS project: http://amis.sf.net

Attachment: TestGtkTree.zip
Description: TestGtkTree.zip



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