On Mon, 2005-10-24 at 22:53 +1300, Dennis Morgan wrote:
> hey eveyone,
> 
> This may sound really stupid.
> but what is the easiest way to obtain the GtkTreeIter of a newly created
> row? 

When you add a row with gtk_tree_store_append or cousins, the
GtkTreeIter is stored in the variable you pass to it as second
parameter. It's a return value.

GtkTreeIter iter;

gtk_tree_store_append   (store, &iter, NULL);

The GtkTreeIter of the newly created row is stored in the "iter"
variable.

> I have a function which adds 2 or more rows but the second and subsequent 
> rows must be a child of the one before..
> all the nodes are based on the path to a file..
> 
> ie /home /  someuser    / whateva 
>     ^             ^                     ^
>    parent    child parent      child  
> 
> so it looks like:
>   /home
>       /someuser
>             /subdirs 

void 
gtk_tree_store_append   (GtkTreeStore *tree_store,
                         GtkTreeIter *iter,
                         GtkTreeIter *parent);
                                      ^^^^^^

Pseudo code should look like:

gtk_tree_store_append   (store,
                         iter,
                         NULL); //root no parents

SET "/home" on iter

gtk_tree_store_append   (store,
                         iter2,
                         iter); // parent "/home"
SET "/someuser" on iter2

gtk_tree_store_append   (store,
                         iter3,
                         iter2); // parent "/someuser"

SET "/subdirs" on iter3

-- 
Iago Rubio

_______________________________________________
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