[nautilus] file: Initialize sort to order to default
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file: Initialize sort to order to default
- Date: Sun, 16 Dec 2018 09:30:37 +0000 (UTC)
commit 8851f764f9c41021fb16d617dce31d28bd681564
Author: Ernestas Kulik <ekulik redhat com>
Date: Sun Dec 16 10:26:12 2018 +0100
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 https://gitlab.gnome.org/GNOME/nautilus/issues/794
src/nautilus-file.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index 4a2068948..c1b326762 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -8831,9 +8831,18 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
gboolean *reversed)
{
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);
if (res)
@@ -8854,6 +8863,10 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
{
retval = NAUTILUS_FILE_SORT_BY_SEARCH_RELEVANCE;
}
+ else
+ {
+ g_assert_not_reached ();
+ }
if (reversed != NULL)
{
@@ -8862,8 +8875,6 @@ nautilus_file_get_default_sort_type (NautilusFile *file,
}
else
{
- retval = g_settings_get_enum (nautilus_preferences,
- NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER);
if (reversed != NULL)
{
*reversed = g_settings_get_boolean (nautilus_preferences,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]