how to get the parent of a selected row in treeview?



Hi, i create a tree model using following codes:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GtkTreeStore *treestore;
GtkTreeIter toplevel, child;

treestore = gtk_tree_store_new(1, G_TYPE_STRING);

gtk_tree_store_append(treestore, &toplevel, NULL);
gtk_tree_store_set(treestore, &toplevel, 0, "Linux", -1);

gtk_tree_store_append(treestore, &child, &toplevel);
gtk_tree_store_set(treestore, &child, 0, "Ubuntu 10.04", -1);

return GTK_TREE_MODEL(treestore);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Although I can get selection with gtk_tree_selection_get_selected(), but i
don't know how to get the selected row's parent.for example, when i click
on "Ubuntu 10.04",how to get its' parent "Linux"?

Thanks.

-- 
---------------------
Best regards



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