GString in GtkTreeStore columns



Hello all,

the application I'm trying to implement contains a table view which is periodically updated. Some of the columns shall contain dynamically sprintf'd strings. Imagine a "top" utility which reads the processes' command lines from files and shows them in the "command line" column.

I'm currently using a GtkTreeView backed by a GtkTreeStore. My GtkTreeStore has a G_TYPE_STRING column for the command line, and I fill these cells with the C-string contents of computed GStrings. That works and leaks memory.

As far as I understand GObject's refcounting, it should be possible to have the GtkTreeStore own the allocated strings, so that the strings are freed automatically when I delete rows. However, when I change the column type to G_TYPE_GSTRING, the GtkCellRendererText refuses to render the cell contents due to their type.

What would be a smart way to store dynamic strings in a table without having to manage their memory manually?

Thanks,
Konrad



--
Konrad Anton <konrad minus1 de>
   Tel. +49-761-21429279
   Web http://www.pechfunk.de/



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