diff options
author | TingPing <tingping@tingping.se> | 2013-09-16 21:48:04 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-09-16 21:48:04 -0400 |
commit | b67953c70c0ee6582fd9790b7b735cbda13c33ac (patch) | |
tree | c9966eec5706b8efcd0a0282d1d36cbb5d1fb1c8 /src | |
parent | 1a67e245acb0da1b6f2c41cbf90def4a36c27580 (diff) |
Searchbar: Don't show error on empty string
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-gtk/maingui.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 2e828cfd..11b76261 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -2869,17 +2869,24 @@ search_handle_event(int search_type, session *sess) } else if (!last) { - /* Either end of search or not found, try again to wrap if only end */ - last = gtk_xtext_search (GTK_XTEXT (sess->gui->xtext), text, flags, &err); - if (!last) /* Not found error */ + if (text && text[0] == 0) /* empty string, no error */ { - gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR); - gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("No results found.")); + gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL); + } + else + { + /* Either end of search or not found, try again to wrap if only end */ + last = gtk_xtext_search (GTK_XTEXT (sess->gui->xtext), text, flags, &err); + if (!last) /* Not found error */ + { + gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_DIALOG_ERROR); + gtk_entry_set_icon_tooltip_text (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, _("No results found.")); + } } } else { - gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL); + gtk_entry_set_icon_from_stock (GTK_ENTRY (sess->gui->shentry), GTK_ENTRY_ICON_SECONDARY, NULL); } } |