Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,500
    • Issues 1,500
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 251
    • Merge requests 251
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gtkgtk
  • Issues
  • #4696
Closed
Open
Created Feb 13, 2022 by António Fernandes@antoniof🐚Developer

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:

image

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.

Assignee
Assign to
Time tracking