TreeView and row-reordering by Drag and Drop



I am using a GtkTreeView and a GtkListStore as TreeModel. I want to reorder the rows by DnD. This is easy if I set "set_reorderable" to true. But I want to take extra actions when the rows are reordered. Eg I want to renumber the rows (think of a playlist). Also I want to do DIFFERENT things when a row is deleted or inserted. This, however, conflicts with my renumbering-code because after a row is re-ordered by dnd a set of row-deleted/row-inserted signals is emitted.  I want a way to differentiate between the signals emitted by DnD and other actions. IMHO the DnD implemention of the TreeView should use different signals. Why doesn't it use the "rows-reordered" signal???

A way I thought of, is the following. But I am currently really confused on how to proceed. Maybe this is not possible the way I am thinking it. I want the CURRENT gtk implementation to work as-is up to the point where the row is deleted/inserted when dropped. At that point, I want my code to step-in and instead of calling delete/insert, it will call gtk_list_store_reorder() or gtk_list_store_move_*(), prevent the emission of delete/insert signals and then emit a custom signal. What do I need to do to achieve this? Derive from GtkListStore? If yes, what should I implement/handle? Any tutorials/links/docs on this?

Sidenote: Do gtk_list_store_reorder()/gtk_list_store_move_*() emit a signal on their own?


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