Re: reordering top-level items in a tree




Nathan Fredrickson wrote:

Hi,
I'm trying to reorder items in a GtkTreeStore using
gtk_tree_store_swap().  This works fine if the items being reordered are
on a sub-level of the tree, but is fails when reordering top-level
items.

(test:7491): Gtk-CRITICAL **: file gtktreemodel.c: line 626
(gtk_tree_path_compare): assertion `a->depth > 0' failed

Looking at the source of gtk_tree_store_swap(), I see that parents of
both items are found in order to determine if both items belong to the
same level.  Top-level items do not have a parent so it fails.

The manual says nothing about this function not working on top level
items.  And if this function can't do it, then how can top-level items
be reordered?

Here is a small test program demonstrating the behavior:
http://worksintheory.org/files/misc/tree-swap.c

See bug #139785 for a patch to fix this.

John





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