Commit b38a9cdc authored by William Jon McCann's avatar William Jon McCann

Interpret a blank search as a search for any name

This allows us to filter the list based on other parameters
like file type and to make clearing the search make more sense.

https://bugzilla.gnome.org/show_bug.cgi?id=679900
parent 469eb891
......@@ -86,7 +86,7 @@ void
nautilus_query_set_text (NautilusQuery *query, const char *text)
{
g_free (query->details->text);
query->details->text = g_strdup (text);
query->details->text = g_strstrip (g_strdup (text));
}
char *
......@@ -125,7 +125,7 @@ nautilus_query_add_mime_type (NautilusQuery *query, const char *mime_type)
char *
nautilus_query_to_readable_string (NautilusQuery *query)
{
if (!query || !query->details->text) {
if (!query || !query->details->text || query->details->text[0] == '\0') {
return g_strdup (_("Search"));
}
......
......@@ -1071,16 +1071,6 @@ nautilus_query_editor_set_visible (NautilusQueryEditor *editor,
}
}
static gboolean
query_is_valid (NautilusQueryEditor *editor)
{
const char *text;
text = gtk_entry_get_text (GTK_ENTRY (editor->details->entry));
return text != NULL && text[0] != '\0';
}
static void
nautilus_query_editor_changed_force (NautilusQueryEditor *editor, gboolean force_reload)
{
......@@ -1089,13 +1079,11 @@ nautilus_query_editor_changed_force (NautilusQueryEditor *editor, gboolean force
if (editor->details->change_frozen) {
return;
}
if (query_is_valid (editor)) {
query = nautilus_query_editor_get_query (editor);
g_signal_emit (editor, signals[CHANGED], 0,
query, force_reload);
g_object_unref (query);
}
query = nautilus_query_editor_get_query (editor);
g_signal_emit (editor, signals[CHANGED], 0,
query, force_reload);
g_object_unref (query);
}
static void
......@@ -1142,11 +1130,6 @@ nautilus_query_editor_get_query (NautilusQueryEditor *editor)
query_text = gtk_entry_get_text (GTK_ENTRY (editor->details->entry));
/* Empty string is a NULL query */
if (query_text && query_text[0] == '\0') {
return NULL;
}
query = nautilus_query_new ();
nautilus_query_set_text (query, query_text);
......
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