From: Chady K. <cha...@gm...> - 2007-09-11 14:27:14
|
Hi, Investigating some sorting weirdness in Exhibit revealed an issue in the way Etk handles the sorting of trees. We have: - etk_tree_col_sort_set: which sets a comparing function inside the tree structure - etk_tree_col_sort: which calls etk_tree_col_sort_full with the inner comparing function as a callback - etk_tree_col_sort_full: which can be passed a callback function for comparison. Further, etk_tree_col_sort_full does a check at the beginning to test if the column to be sorted is already sorted and returns without sorting. So if we sort with etk_tree_col_sort_full on a column, then we sort with etk_tree_col_sort_full on that same column but with a different callback function, the second sort will not happen. Proposed solutions: patch1.diff - we can either set tree->sorted_col to NULL whenever we set etk_tree_col_sort_set to something, so one doesn't use sort_full and always uses sort_set and then sort. OR patch2.diff - we add some kind of reference to the last sorting function and compare that too inside sort_full.. so if the sorted column is the same as the one we are sorting AND the callback function is the same, then return. Which one do you people prefer? -- Chady 'Leviathan' Kassouf http://chady.net/ |