[nautilus] Interpret a blank search as a search for any name
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Interpret a blank search as a search for any name
- Date: Sat, 14 Jul 2012 18:18:16 +0000 (UTC)
commit b38a9cdc2fc92df1a7de6541aa289bf98dda6443
Author: William Jon McCann <jmccann redhat com>
Date: Fri Jul 13 19:22:52 2012 -0400
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
libnautilus-private/nautilus-query.c | 4 ++--
src/nautilus-query-editor.c | 27 +++++----------------------
2 files changed, 7 insertions(+), 24 deletions(-)
---
diff --git a/libnautilus-private/nautilus-query.c b/libnautilus-private/nautilus-query.c
index e96ba64..76c4e50 100644
--- a/libnautilus-private/nautilus-query.c
+++ b/libnautilus-private/nautilus-query.c
@@ -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"));
}
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index b993830..a30fd0f 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]