summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-09-04 16:00:03 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-09-04 21:34:28 +0200
commitecaa50d659d208b55048f307e1c094f1aac49473 (patch)
tree32fa796008a86ce538123a1b60274d648b1b593c
parentca98645f1db0002ef5cc543dc7877dd621796a91 (diff)
downloadnautilus-ecaa50d659d208b55048f307e1c094f1aac49473.tar.gz
files-view: mark empty query as not valid
So the view loads the original directory when the query is empty. This fixes having a wrong location set when the query is empty after searching.
-rw-r--r--src/nautilus-files-view.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 67aaedf6d..872bd1a08 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -7651,14 +7651,22 @@ nautilus_files_view_set_search_query (NautilusView *view,
{
NautilusFilesView *files_view;
GFile *location;
+ gchar *text;
+ gboolean valid_query = FALSE;
files_view = NAUTILUS_FILES_VIEW (view);
location = NULL;
+ if (query) {
+ text = nautilus_query_get_text (query);
+ valid_query = strlen (text) > 0;
+
+ g_free (text);
+ }
g_set_object (&files_view->details->search_query, query);
g_object_notify (G_OBJECT (view), "search-query");
- if (query) {
+ if (valid_query) {
if (nautilus_view_is_searching (view)) {
location = nautilus_directory_get_location (files_view->details->model);