Do not actually search less than 3 characters in 'typing' search

This commit is contained in:
Christian Dywan 2009-02-22 16:12:58 +01:00
parent 30729676db
commit 9662e99354
2 changed files with 7 additions and 5 deletions

View file

@ -893,7 +893,7 @@ midori_view_search_text_cb (GtkWidget* view,
gtk_editable_insert_text (GTK_EDITABLE (browser->find_text), typing, -1, &position); gtk_editable_insert_text (GTK_EDITABLE (browser->find_text), typing, -1, &position);
gtk_editable_set_position (GTK_EDITABLE (browser->find_text), -1); gtk_editable_set_position (GTK_EDITABLE (browser->find_text), -1);
} }
if (GTK_WIDGET_VISIBLE (browser->find)) if (GTK_WIDGET_VISIBLE (browser->find) && !typing)
{ {
gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (browser->find_text), gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (browser->find_text),
GTK_ICON_ENTRY_PRIMARY, (found) ? GTK_STOCK_FIND : GTK_STOCK_STOP); GTK_ICON_ENTRY_PRIMARY, (found) ? GTK_STOCK_FIND : GTK_STOCK_STOP);
@ -1578,7 +1578,11 @@ midori_browser_find_text_changed_cb (GtkWidget* entry,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
if (browser->find_typing) if (browser->find_typing)
{
const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_utf8_strlen (text, -1) > 2)
_midori_browser_find (browser, TRUE); _midori_browser_find (browser, TRUE);
}
} }
static gboolean static gboolean

View file

@ -822,9 +822,7 @@ gtk_widget_key_press_event_cb (WebKitWebView* web_view,
{ {
gchar* text = g_strdup_printf ("%c", character); gchar* text = g_strdup_printf ("%c", character);
g_signal_emit (view, signals[SEARCH_TEXT], 0, g_signal_emit (view, signals[SEARCH_TEXT], 0, TRUE, text);
webkit_web_view_search_text (web_view,
text, FALSE, TRUE, TRUE), text);
g_free (text); g_free (text);
} }