I just created another version of this. This time it has one more sorting method: Sorting by folder (which refers to the folder in the documents list in the sidebar, and does exactly what it has to do: sort documents the way the sidebar sorts them). I thought this would solve the ambiguity that makes us wonder how 'Sort by pathname' should really sort the documents: whether to copy sidebar's way of sorting them, or whether to just sort them based on their complete pathnames. This time, 'Sort by pathname' does it simpler: get the directory part through `doc->realpath`. If `realpath` is `NULL`, the directory is simply an empty string.
I placed the the changes in another branch: https://github.com/konsolebox/geany/tree/sort_tabs_v2
Aside from adding the new feature, these changes were also made: (List copied from https://github.com/konsolebox/geany/commit/7adbc1e33f983ec32bfe05006930bcbbb...)
- Sorting by pathname now relies on doc->realpath when getting the directory part. - Popup menu now only has a single sort command item (a submenu with three subitems). - No longer uses NotebookTabAutoSortMethod. Just added NOTEBOOK_TAB_SORT_NONE to NotebookTabSortMethod. Along with get_compare_method(), it made stuff much simpler. - No longer uses variables 'doc_a' and 'doc_b' since they're only used once. '*(GeanyDocument **) a|b' is just directly passed as an argument instead. It makes the code look less heavier and it saves a few lines. - Declares GeanyDocument as constant in function declarations. - 'on_sort_tabs_by_*_activate' were moved from notebook.h to notebook.c. - Documentation was updated.
And these are the preview images: http://imgur.com/a/PySmh
The last image is about the newer update (https://github.com/konsolebox/geany/commit/474c5ef027d714e9c95c8e0c0b55fdc7d...) where the radio options are converted to a combobox.
I can forward the changes here if it's wanted.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1144#issuecomment-236888774