summary refs log tree commit diff stats
path: root/src/fe-gtk/search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk/search.c')
-rw-r--r--src/fe-gtk/search.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/fe-gtk/search.c b/src/fe-gtk/search.c
index 44cbf3a0..8d251694 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);
@@ -183,7 +198,7 @@ search_open (session * sess)
 	GTK_TOGGLE_BUTTON (wid)->active = prefs.hex_text_search_case_match;
 	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_caseign_cb), sess);
 	gtk_container_add (GTK_CONTAINER (vbox), wid);
-	add_tip (wid, "Perform a case-sensitive search.");
+	add_tip (wid, _("Perform a case-sensitive search."));
 	gtk_widget_show (wid);
 
 	/* Third line:  X Search backwards */
@@ -191,7 +206,7 @@ search_open (session * sess)
 	GTK_TOGGLE_BUTTON (wid)->active = prefs.hex_text_search_backward;
 	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_dirbwd_cb), sess);
 	gtk_container_add (GTK_CONTAINER (vbox), wid);
-	add_tip (wid, "Search from the newest text line to the oldest.");
+	add_tip (wid, _("Search from the newest text line to the oldest."));
 	gtk_widget_show (wid);
 
 	/* Fourth line:  X Highlight all */
@@ -199,7 +214,7 @@ search_open (session * sess)
 	GTK_TOGGLE_BUTTON (wid)->active = prefs.hex_text_search_highlight_all;
 	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_highlight_cb), sess);
 	gtk_container_add (GTK_CONTAINER (vbox), wid);
-	add_tip (wid, "Highlight all occurrences, and underline the current occurrence.");
+	add_tip (wid, _("Highlight all occurrences, and underline the current occurrence."));
 	gtk_widget_show (wid);
 
 	/* Fifth line:  X Regular expression */
@@ -207,7 +222,7 @@ search_open (session * sess)
 	GTK_TOGGLE_BUTTON (wid)->active = prefs.hex_text_search_regexp;
 	g_signal_connect (G_OBJECT (wid), "toggled", G_CALLBACK (search_regexp_cb), sess);
 	gtk_container_add (GTK_CONTAINER (vbox), wid);
-	add_tip (wid, "Regard search string as a regular expression.");
+	add_tip (wid, _("Regard search string as a regular expression."));
 	gtk_widget_show (wid);
 
 	/* Sixth line:  _Close    Close and _Reset */
@@ -217,10 +232,10 @@ search_open (session * sess)
 
 	wid = gtkutil_button (hbox, GTK_STOCK_CLOSE, 0, search_close_cb, win,
 						_("_Close"));
-	add_tip (wid, "Close this box, but continue searching new lines.");
+	add_tip (wid, _("Close this box, but continue searching new lines."));
 	wid = gtkutil_button (hbox, "gtk-reset", 0, search_reset_cb, sess,
 						_("Close and _Reset"));
-	add_tip (wid, "Close this box, reset highlighted search items, and stop searching new lines.");
+	add_tip (wid, _("Close this box, reset highlighted search items, and stop searching new lines."));
 
 	/* Add recognition of the ESC key to close the box */
 	gtkutil_destroy_on_esc (win);