Moving subtrees to other levels in GtkTreeStore and keeping GtkTreeRowReferences alive?



Greetings,

I have a GtkTreeView/Store which represents a tree which is
basically like a directory tree, but only leaf "directories" may
contain "files".  I would like to implement an ability to move any
"directory" (with all its contents, i.e. the entire subtree) to any
other "directory", possibly on other level in the tree, by means of
drag and drop and possibly other mechanisms.

gtk_tree_store_move_before() and gtk_tree_store_move_after() say
that "iter and position should be in the same level".  _Should_ be?
Why?  _Can_ they be on different levels (maybe in some specific
situations)?  gtk_tree_store_swap() seems to have the same problem
(although no "should" in this case).  Are there other ways (that I
haven't been able to find) that I could conveniently move rows and
their children around?  Are there improved TreeModel
implementations (not part of Gtk+ distribution) that I could use?

I suppose I could copy the entire subtree to the target location
and then remove the source, but how, in this case, would I ensure
that GtkTreeRowReferences that point to the moved directory or its
children point to the new location after the operation?  It seems
to me that the signals RowReferences use to track model changes do
not make it possible (at least not sanely) to handle cases where
the row the RowReference points to is first deleted and then
inserted elsewhere.

-- 
Hannu




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