[nautilus] files-view: mark empty query as not valid



commit ecaa50d659d208b55048f307e1c094f1aac49473
Author: Carlos Soriano <csoriano gnome org>
Date:   Fri Sep 4 16:00:03 2015 +0200

    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.

 src/nautilus-files-view.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 67aaedf..872bd1a 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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]