diff options
author | Rui Matos <tiagomatos@gmail.com> | 2013-03-22 22:53:16 +0100 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2013-03-25 13:32:09 -0400 |
commit | 54270d1bae66ec24c56a10fe1973ec271433f6b0 (patch) | |
tree | 8efdfb82012c96660b44f5e69f5785789430de67 | |
parent | 670875d76ed212e0bb9d071ef79b56fa6dacae2a (diff) | |
download | nautilus-54270d1bae66ec24c56a10fe1973ec271433f6b0.tar.gz |
query-editor: Don't set the entry's text if not strictly needed
If the current text in the entry is equal to the new query's text we
shouldn't needlessly set the text on the entry since that affects the
cursor position.
gtk_entry_set_text() already does a similar check internally but that
isn't enough here because NautilusQuery doesn't keep the full string
but instead a stripped version of it.
https://bugzilla.gnome.org/show_bug.cgi?id=696430
-rw-r--r-- | src/nautilus-query-editor.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c index c9473af6a..d72d81cee 100644 --- a/src/nautilus-query-editor.c +++ b/src/nautilus-query-editor.c @@ -1210,6 +1210,7 @@ nautilus_query_editor_set_query (NautilusQueryEditor *editor, NautilusQuery *query) { char *text = NULL; + char *current_text = NULL; if (query != NULL) { text = nautilus_query_get_text (query); @@ -1220,7 +1221,12 @@ nautilus_query_editor_set_query (NautilusQueryEditor *editor, } editor->details->change_frozen = TRUE; - gtk_entry_set_text (GTK_ENTRY (editor->details->entry), text); + + current_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->details->entry)))); + if (!g_str_equal (current_text, text)) { + gtk_entry_set_text (GTK_ENTRY (editor->details->entry), text); + } + g_free (current_text); g_free (editor->details->current_uri); editor->details->current_uri = NULL; |