Re: Working With Trees
- From: Charles Tassell <ctassell isn net>
- To: Keith Sharp <kms passback co uk>
- Cc: gtk-list gnome org
- Subject: Re: Working With Trees
- Date: 21 May 2003 20:30:46 -0300
Doesn't make any difference, I've tried the code below, and it seems to
do the same thing. Am I wrong here, or is the GtkTreeStore type not
compatible with GtkTreeModel? From the docs, I think I should be able
to use a GtkTreeStore pointer with any function that takes a
GtkTreeModel, but maybe I'm misreading something.
int SetFolders(void)
{
GtkTreeStore *tstoreFolders;
GtkTreeIter iterStore, iterTest;
char *Test, *readTest;
/* Create test strings */
Test = malloc(100);
memset(Test, 0, 100);
strcpy(Test, "This is a test");
readTest = malloc(100);
memset(readTest, 0, 100);
/* Create the storage area */
tstoreFolders = gtk_tree_store_new(NUM_COLUMNS, G_TYPE_STRING);
/* Add the test entry */
gtk_tree_store_append(GTK_TREE_MODEL(tstoreFolders), &iterStore,
NULL);
gtk_tree_store_set(GTK_TREE_MODEL(tstoreFolders), &iterStore,
FOLDER_NAME, Test, -1);
/* Read the value we just wrote back */
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(tstoreFolders),
&iterTest)) {
printf("Couldn't get first iterator\n");
}
gtk_tree_model_get(GTK_TREE_MODEL(tstoreFolders), &iterTest,
FOLDER_NAME, readTest, -1);
printf("Test is %s\n", readTest);
return 0;
}
On Wed, 2003-05-21 at 04:50, Keith Sharp wrote:
[snip]
> What happens if you take the g_free(gTest) out?
>
> Keith.
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]