[gnome-control-center] shell: " " isn't a search term, really
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] shell: " " isn't a search term, really
- Date: Tue, 21 Jun 2011 16:38:27 +0000 (UTC)
commit 632501cf1cc46f1254f5056815bdaa2261e0fa99
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jun 21 16:56:41 2011 +0100
shell: " " isn't a search term, really
Don't re-filter for added trailing or leading spaces
shell/gnome-control-center.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index c4a9289..18dfe31 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -436,13 +436,23 @@ static void
search_entry_changed_cb (GtkEntry *entry,
GnomeControlCenterPrivate *priv)
{
+ char *str;
/* if the entry text was set manually (not by the user) */
if (!g_strcmp0 (priv->filter_string, gtk_entry_get_text (entry)))
return;
+ /* Don't re-filter for added trailing or leading spaces */
+ str = g_strdup (gtk_entry_get_text (entry));
+ g_strstrip (str);
+ if (!g_strcmp0 (str, priv->filter_string))
+ {
+ g_free (str);
+ return;
+ }
+
g_free (priv->filter_string);
- priv->filter_string = g_strdup (gtk_entry_get_text (entry));
+ priv->filter_string = str;
g_object_set (priv->search_renderer,
"search-string", priv->filter_string,
@@ -552,6 +562,7 @@ setup_search (GnomeControlCenter *shell)
/* setup the search entry widget */
widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "search-entry");
priv->search_entry = widget;
+ priv->filter_string = g_strdup ("");
g_signal_connect (widget, "changed", G_CALLBACK (search_entry_changed_cb),
priv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]