From c471388021b4bdd0ec4f71d6eec5ae245c6710ff Mon Sep 17 00:00:00 2001 From: TingPing Date: Sat, 18 May 2013 17:32:41 -0400 Subject: Don't use popup when search is not found --- src/fe-gtk/search.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fe-gtk/search.c b/src/fe-gtk/search.c index 44cbf3a0..528be780 100644 --- a/src/fe-gtk/search.c +++ b/src/fe-gtk/search.c @@ -32,6 +32,7 @@ #include "maingui.h" GtkWidget *searchwin; +GtkWidget *searchentry; static void search_search (session * sess, const gchar *text) @@ -64,7 +65,11 @@ search_search (session * sess, const gchar *text) } else if (!last) { - fe_message (_("Search hit end, not found."), FE_MSG_ERROR); + gtk_entry_set_icon_from_stock (GTK_ENTRY (searchentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR); + } + else + { + gtk_entry_set_icon_from_stock (GTK_ENTRY (searchentry), GTK_ENTRY_ICON_SECONDARY, NULL); } } @@ -108,6 +113,12 @@ search_entry_cb (GtkWidget * entry, session * sess) search_search (sess, gtk_entry_get_text (GTK_ENTRY (entry))); } +static void +search_changed_cb (GtkWidget * entry, gpointer userdata) +{ + gtk_entry_set_icon_from_stock (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, NULL); +} + static void search_caseign_cb (GtkToggleButton * but, session * sess) { @@ -158,8 +169,10 @@ search_open (session * sess) gtk_container_add (GTK_CONTAINER (vbox), hbox); gtk_widget_show (hbox); - entry = gtk_entry_new (); + entry = searchentry = gtk_entry_new (); text = GTK_XTEXT (sess->gui->xtext)->buffer->search_text; + gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, FALSE); + gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, "Search hit end or not found."); if (text) { gtk_entry_set_text (GTK_ENTRY (entry), text); @@ -167,6 +180,8 @@ search_open (session * sess) } g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (search_entry_cb), sess); + g_signal_connect (G_OBJECT (entry), "changed", + G_CALLBACK (search_changed_cb), NULL); gtk_container_add (GTK_CONTAINER (hbox), entry); gtk_widget_show (entry); gtk_widget_grab_focus (entry); -- cgit 1.4.1