On Wed, Aug 26, 2009 at 12:33 PM, Nicolas Soubeiran<nicolas.soubei...@gmail.com> wrote: > If the column is sorted, when one activates the toggle, the tree is > re-sorted (normal) but the selected row is changed (unexpected). I > investigated and I found that when clicking on a toggle cell renderer, the > "activate" callback is send which update the treemodel. After re-ordering, > the function gtk_tree_view_button_press is called. This function checks
The function gtk_tree_view_button_press() is not called, but continued after re-ordering. The "activate" callback (and thus the re-ordering) are triggered from gtk_tree_view_button_press(). > which row is under the cursor and selects it. I am looking for a way to trap > this event to keep the selection on the "activated" row (like when one edits > a text) Your main problem here is that the model is re-ordered before tree view will select the row under the cursor. When things change within a tree view callback, it is always a kind of a gray area. There are certain reasons why editable and activatable cell renders have to be handled before we update the cursor, so this is not something that can be easily changed. The most important difference with the case of editing text is that the model is updated (and possibly resorted) at a later point. I think your best chance is to set the cursor on the wished row manually, after the tree view has updated the cursor. From the "rows-reordered" callback emitted by the model set on the tree view, you can deduce how the rows are reordered. As soon as the tree view changes the cursor the "cursor-changed" signal is emitted on the tree view. Using these events, I think you should be able to work something out? Hope this helps. regards, -kris. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list