From 238f1bdd77ab7cab9f072d93475fe0a23463444b Mon Sep 17 00:00:00 2001 From: waker Date: Tue, 19 Apr 2011 20:49:16 +0200 Subject: reapply search after switching playlist --- plugins/gtkui/gtkui.c | 2 +- plugins/gtkui/search.c | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'plugins') 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 @@ -59,6 +59,16 @@ search_start (void) { search_refresh (); } +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); } -- cgit v1.2.3