No way to change sort column programatically in GtkColumnView
GNOME Files needs a way to set the sort column at runtime from a menu action, as requested by designer.
However, doing this by calling gtk_column_view_sort_by_column()
results in the previous sort column header still drawing an arrow:
Indeed, I realize what I am doing is not supported, as per documentation of gtk_column_view_sort_by_column()
:
* This function should be used to set up the initial sorting.
* At runtime, users can change the sorting of a column view
* by clicking on the list headers.
So, I would request to expand the scope of this method to support this use case.
I can provide a patch, for which I see two apparently simple possible solutions: either having gtk_column_view_sort_by_column()
always call gtk_column_view_sorter_clear()
before gtk_column_view_sorter_set_column()
, or having gtk_column_view_sorter_set_column()
call gtk_column_view_column_notify_sort()
on the previous first sorte column, as gtk_column_view_sorter_add_column()
already does.
Indeed, I can workaround this whole issue by calling gtk_column_view_sort_by_column()
twice, the first time passing NULL
for the column. But this is ugly and probably the wrong thing to do.