[gtksourceview/wip/search: 31/36] test-search-ui: connect to "notify::text" instead of "changed"
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/search: 31/36] test-search-ui: connect to "notify::text" instead of "changed"
- Date: Sat, 6 Jul 2013 15:59:20 +0000 (UTC)
commit 2a8de8796653369c30dc5b4b875caeaa976da2ca
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jul 4 21:45:41 2013 +0200
test-search-ui: connect to "notify::text" instead of "changed"
The "changed" signal seems to be really slow, there is a gap between the
insertion/deletion of text in the GtkEntry, and the highlighting of the
search matches.
With the "notify::text" signal, the search highlighting is updated
immediately.
What I don't understand is that gedit uses the "changed" signal and it's
working fine... But it's not a search entry (here it is a search entry).
tests/test-search-ui.c | 7 ++++---
tests/test-search-ui.ui | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/tests/test-search-ui.c b/tests/test-search-ui.c
index 690db48..2053a53 100644
--- a/tests/test-search-ui.c
+++ b/tests/test-search-ui.c
@@ -122,8 +122,9 @@ update_label (TestSearchUI *search)
}
static void
-search_entry_changed_cb (TestSearchUI *search,
- GtkEntry *entry)
+search_entry_text_notify_cb (TestSearchUI *search,
+ GParamSpec *spec,
+ GtkEntry *entry)
{
const gchar *text = gtk_entry_get_text (entry);
gchar *unescaped_text = gtk_source_utils_unescape_search_text (text);
@@ -300,7 +301,7 @@ test_search_ui_class_init (TestSearchUIClass *klass)
gtk_widget_class_bind_child (widget_class, TestSearchUIPrivate, replace_entry);
gtk_widget_class_bind_child (widget_class, TestSearchUIPrivate, label_occurrences);
- gtk_widget_class_bind_callback (widget_class, search_entry_changed_cb);
+ gtk_widget_class_bind_callback (widget_class, search_entry_text_notify_cb);
gtk_widget_class_bind_callback (widget_class, button_previous_clicked_cb);
gtk_widget_class_bind_callback (widget_class, button_next_clicked_cb);
gtk_widget_class_bind_callback (widget_class, button_replace_clicked_cb);
diff --git a/tests/test-search-ui.ui b/tests/test-search-ui.ui
index 1461727..d2d7cc7 100644
--- a/tests/test-search-ui.ui
+++ b/tests/test-search-ui.ui
@@ -87,7 +87,7 @@
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
- <signal name="changed" handler="search_entry_changed_cb" object="TestSearchUI" swapped="yes"/>
+ <signal name="notify::text" handler="search_entry_text_notify_cb" object="TestSearchUI"
swapped="yes"/>
</object>
<packing>
<property name="left_attach">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]