Commit 8851f764 authored by Ernestas Kulik's avatar Ernestas Kulik 🦑

file: Initialize sort to order to default

If get_attributes_for_default_sort_type() returns FALSE,
nautilus_file_get_default_sort_type() will return garbage, as retval
will remain uninitialized. This commit initializes it by default to the
default GSettings value.

Fixes #794
parent a6b2599f
Pipeline #46269 passed with stages
in 12 minutes and 42 seconds
...@@ -8831,9 +8831,18 @@ nautilus_file_get_default_sort_type (NautilusFile *file, ...@@ -8831,9 +8831,18 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
gboolean *reversed) gboolean *reversed)
{ {
NautilusFileSortType retval; NautilusFileSortType retval;
gboolean is_recent, is_download, is_trash, is_search, res; gboolean is_recent;
gboolean is_download;
gboolean is_trash;
gboolean is_search;
gboolean res;
is_recent = is_download = is_trash = is_search = FALSE; retval = g_settings_get_enum (nautilus_preferences,
NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER);
is_recent = FALSE;
is_download = FALSE;
is_trash = FALSE;
is_search = FALSE;
res = get_attributes_for_default_sort_type (file, &is_recent, &is_download, &is_trash, &is_search); res = get_attributes_for_default_sort_type (file, &is_recent, &is_download, &is_trash, &is_search);
if (res) if (res)
...@@ -8854,6 +8863,10 @@ nautilus_file_get_default_sort_type (NautilusFile *file, ...@@ -8854,6 +8863,10 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
{ {
retval = NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE; retval = NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE;
} }
else
{
g_assert_not_reached ();
}
if (reversed != NULL) if (reversed != NULL)
{ {
...@@ -8862,8 +8875,6 @@ nautilus_file_get_default_sort_type (NautilusFile *file, ...@@ -8862,8 +8875,6 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
} }
else else
{ {
retval = g_settings_get_enum (nautilus_preferences,
NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER);
if (reversed != NULL) if (reversed != NULL)
{ {
*reversed = g_settings_get_boolean (nautilus_preferences, *reversed = g_settings_get_boolean (nautilus_preferences,
......
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