diff options
author | waker <wakeroid@gmail.com> | 2011-04-19 20:49:16 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-04-19 20:49:16 +0200 |
commit | 238f1bdd77ab7cab9f072d93475fe0a23463444b (patch) | |
tree | 0e7d93405f9b666e89f3a8da2a211a3bebd289f5 /plugins/gtkui | |
parent | a064bf908a88e266d16ab1c201331f2d0d1d140a (diff) |
reapply search after switching playlist
Diffstat (limited to 'plugins/gtkui')
-rw-r--r-- | plugins/gtkui/gtkui.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/search.c | 25 |
2 files changed, 14 insertions, 13 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index eaf08861..c1a49425 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -490,7 +490,7 @@ playlistswitch_cb (gpointer none) { deadbeef->pl_item_unref (it); } } - ddb_listview_clear_sort (listview); + playlist_refresh (); ddb_listview_set_vscroll (listview, scroll); search_refresh (); 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); } |