diff options
author | TingPing <tngpng@gmail.com> | 2013-05-18 17:32:41 -0400 |
---|---|---|
committer | TingPing <tngpng@gmail.com> | 2013-05-18 17:32:41 -0400 |
commit | c471388021b4bdd0ec4f71d6eec5ae245c6710ff (patch) | |
tree | 03944b876aefe0ad89e6d33e36eb441c9a473ac2 | |
parent | 9d717ffee9d3ebb88c08312a3c8bd20f24c1dd8e (diff) |
Don't use popup when search is not found
-rw-r--r-- | src/fe-gtk/search.c | 19 |
1 files changed, 17 insertions, 2 deletions
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); } } @@ -109,6 +114,12 @@ search_entry_cb (GtkWidget * entry, session * sess) } 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) { prefs.hex_text_search_case_match = (but->active)? 1: 0; @@ -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); |