summaryrefslogtreecommitdiff
path: root/plugins/gtkui/search.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-19 20:49:16 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-19 20:49:16 +0200
commit238f1bdd77ab7cab9f072d93475fe0a23463444b (patch)
tree0e7d93405f9b666e89f3a8da2a211a3bebd289f5 /plugins/gtkui/search.c
parenta064bf908a88e266d16ab1c201331f2d0d1d140a (diff)
reapply search after switching playlist
Diffstat (limited to 'plugins/gtkui/search.c')
-rw-r--r--plugins/gtkui/search.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
index 471d3620..905b18b4 100644
--- a/plugins/gtkui/search.c
+++ b/plugins/gtkui/search.c
@@ -60,6 +60,16 @@ search_start (void) {
}
void
+search_process (const char *text) {
+ deadbeef->pl_search_process (text);
+
+ int row = deadbeef->pl_get_cursor (PL_SEARCH);
+ if (row >= deadbeef->pl_getcount (PL_SEARCH)) {
+ deadbeef->pl_set_cursor (PL_SEARCH, deadbeef->pl_getcount (PL_SEARCH) - 1);
+ }
+}
+
+void
on_searchentry_changed (GtkEditable *editable,
gpointer user_data)
{
@@ -69,24 +79,15 @@ on_searchentry_changed (GtkEditable *editable,
// walk playlist starting with playlist_head, and populate list starting
// with search_head
-
- const gchar *text = gtk_entry_get_text (GTK_ENTRY (editable));
- deadbeef->pl_search_process (text);
-
- int row = deadbeef->pl_get_cursor (PL_SEARCH);
- if (row >= deadbeef->pl_getcount (PL_SEARCH)) {
- deadbeef->pl_set_cursor (PL_SEARCH, deadbeef->pl_getcount (PL_SEARCH) - 1);
- }
-
search_refresh ();
-
- // redraw main playlist to be in sync selection-wise
- ddb_listview_refresh (DDB_LISTVIEW (lookup_widget (mainwin, "playlist")), DDB_REFRESH_LIST);
}
void
search_refresh (void) {
if (searchwin && gtk_widget_get_visible (searchwin)) {
+ GtkEntry *entry = lookup_widget (searchwin, "searchentry");
+ const gchar *text = gtk_entry_get_text (entry);
+ search_process (text);
GtkWidget *pl = lookup_widget (searchwin, "searchlist");
ddb_listview_refresh (DDB_LISTVIEW (pl), DDB_REFRESH_VSCROLL | DDB_REFRESH_LIST | DDB_LIST_CHANGED);
}