Re: Directory Tree (GtkTreeModel)
- From: Evan Martin <martine cs washington edu>
- To: Matthias Reis <matthias reis web de>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Directory Tree (GtkTreeModel)
- Date: Mon, 12 Aug 2002 17:45:39 -0700
Matthias Reis wrote:
Hi!
I'm trying to implement a directory tree with GtkTreeModel.I already
have a GtkTreeModel containing the / directory and its first-level
subdirectories. If a child row is collapsed, I want to add its children
(its subdirectories).
I did this recently.
Some stuff is hardcoded, but you should be able to see the idea. I
build the path forward, so I can use g_stpcpy for speed while appending
to the string... not that it really matters.
indices = gtk_tree_path_get_indices(path);
depth = gtk_tree_path_get_depth(path);
curdirpath = g_stpcpy(dirpath, "/mp3");
*curdirpath++ = '/';
for (i = 0; i < depth; i++) {
parent = iter;
gtk_tree_model_iter_nth_child(model, &iter, i > 0 ? &parent :
NULL, indices[i]);
gtk_tree_model_get(model, &iter,
STORE_NAME, &dir,
-1);
curdirpath = g_stpcpy(curdirpath, dir);
*curdirpath++ = '/';
g_free(dir);
}
*curdirpath = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]