Hi all!

To insert the various nodes in a GtkTreeStore, the code below works for me.
The problem is, this should not work, because I am handling a
GtkTreeIter as if it was some sort of integer, while it is in fact a 
structure!

The current child node is the next parent node, so I would expect the 
proper
way to do this would be to copy the current node iter to the parent 
iter, and
because these are structures, I would have to copy their contents...

What is the standard way of doing this? I am confused!

Thanks!
Carlos

GtkTreeIter insert_row (GtkTreeStore *store, GtkTreeIter *parent, char 
*label)
{
GtkTreeIter iter;

gtk_tree_store_append (store, &iter, parent);
gtk_tree_store_set (store, &iter, 0, label, -1);

return iter;
}

void insert_model (GtkWidget *treeview)
{
GtkTreeStore *store;
GtkTreeIter iter1, iter2, iter3;

store = gtk_tree_store_new (1, G_TYPE_STRING);
iter1 = insert_row (store, NULL, "Node 0");
iter2 = insert_row (store, &iter1, "Node 0:0");
insert_row (store, &iter2, "Node 0:0:0");
insert_row (store, &iter2, "Node 0:0:1");
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
g_object_unref (store);
}

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to