Commit 947d28a9 authored by António Fernandes's avatar António Fernandes 🐚 Committed by Carlos Soriano

file: Sync sort types with settings

The org.gnome.nautilus.preferences default-sort-order key is a currently
hidden-from-UI preference that should be honored by all views, if no
custom order is specified in the current location's metadata.

However, for this to work, two enums must be kept in sync between the
code and the schemas. This has not been happening since the introduction
of the Starred files feature.

To fix this, restore the sort order according to settings, and make
starred take the place of trash-time, which is non-sensical as default
for all folders.

Forthermore, to prevent this from breaking again, add documentation to
both enums.

Fixes #636
parent 8940f90a
......@@ -23,13 +23,17 @@
</enum>
<enum id="org.gnome.nautilus.SortOrder">
<!--
When touching this, make sure to keep the values in sync with the
#NautilusFileSortType enum in the `src/nautilus-file.h` code header file.
-->
<value value="0" nick="manually"/>
<value value="1" nick="name"/>
<value value="2" nick="size"/>
<value value="3" nick="type"/>
<value value="4" nick="mtime"/>
<value value="5" nick="atime"/>
<value value="6" nick="trash-time"/>
<value value="6" nick="starred"/>
</enum>
<enum id="org.gnome.nautilus.CanvasZoomLevel">
......
......@@ -50,13 +50,21 @@ typedef struct NautilusFile NautilusFile;
(G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_FILE, NautilusFileClass))
typedef enum {
NAUTILUS_FILE_SORT_NONE,
NAUTILUS_FILE_SORT_BY_DISPLAY_NAME,
NAUTILUS_FILE_SORT_BY_SIZE,
NAUTILUS_FILE_SORT_BY_TYPE,
NAUTILUS_FILE_SORT_BY_STARRED,
NAUTILUS_FILE_SORT_BY_MTIME,
NAUTILUS_FILE_SORT_BY_ATIME,
/* These may be set as default-sort-order. When touching this, make sure to
* keep the values in sync with the "org.gnome.nautilus.SortOrder" enum in the
* `data/org.gnome.nautilus.gschema.xml` schemas file.
*/
NAUTILUS_FILE_SORT_NONE = 0, /* Formerly used for "manual" sorting. */
NAUTILUS_FILE_SORT_BY_DISPLAY_NAME = 1,
NAUTILUS_FILE_SORT_BY_SIZE = 2,
NAUTILUS_FILE_SORT_BY_TYPE = 3,
NAUTILUS_FILE_SORT_BY_MTIME = 4,
NAUTILUS_FILE_SORT_BY_ATIME = 5,
NAUTILUS_FILE_SORT_BY_STARRED = 6,
/* The following are specific to special locations and as such are not to be
* included in the "org.gnome.nautilus.SortOrder" enum.
*/
NAUTILUS_FILE_SORT_BY_TRASHED_TIME,
NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE,
NAUTILUS_FILE_SORT_BY_RECENCY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment