Re: GString in GtkTreeStore columns
- From: Konrad Anton <konrad minus1 de>
- To: gtk-app-devel-list gnome org
- Subject: Re: GString in GtkTreeStore columns
- Date: Wed, 24 Jun 2009 08:56:41 +0200
Hello all,
problem solved (thanks, Tadej!). For the archive: If a column of a
GtkTreeStore is defined as G_TYPE_STRING, then gtk_tree_store_set will
make a copy of the string contents.
> string = g_string_new( "Sample text" );
> /* Next call will free any string that was present in first column
> * of a row pointed to by an iter and copy string->str into it's
place. */
> gtk_tree_store_set( store, &iter, 0, string->str, -1 );
> /* You'll probably want to free your GString now, since there is no
> * point having one string copy in tree store and another one
> * in GString structure. */
> g_string_free( string, TRUE );
Documentation of gtk_tree_store_set says "The value will be copied or
referenced by the store if appropriate" -- so apparently, it *is*
appropriate for gtk_tree_store_set to copy the string contents.
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]