Re: GtkTreeStore and GtkTreeIter



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

Thanks it did the trick now if only i could find a simple way to break the path up.. oh well one step at a 
time..

thanks for the help...

regards
Dennis





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