Directory Tree (GtkTreeModel)



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).
My problem is to get the directory path from the GtkTreeModel path (to
pass it to GnomeVFS). I tried the following with no success:

(iter and path are passed correctly by the "row-collapsed" callback)

  while (valid) {
    char *buf;
    GtkTreeIter iter_parent = iter;

    gtk_tree_model_get (_model, &iter, 0, &buf, -1);

    dname_parent = (char *) g_malloc (sizeof (char) * (strlen (buf) + 1)
* (strlen (dname_parent_buf) + 1));
    sprintf (dname_parent, "/%s%s", buf, dname_parent_buf);
    g_free (buf);
    dname_parent_buf = dname_parent;

    valid = gtk_tree_model_iter_parent (_model, &iter, &iter_parent);
  }

Any ideas?

Thanks,
Matthias

P.S.: What about a directory tree in the Gnome API? I think that would
be useful.



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