diff options
author | waker <wakeroid@gmail.com> | 2012-10-30 20:30:44 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-10-30 20:30:44 +0100 |
commit | 7d1687be25eec9808b278bf6ecf1fea9c9af6b1f (patch) | |
tree | 636561e051149953b204620c186564b42c024f2c | |
parent | bfa903e6a3e00e936546e71371288f90f914784c (diff) |
fixed playlist refresh on search window selection changes
-rw-r--r-- | deadbeef.h | 2 | ||||
-rw-r--r-- | plugins/gtkui/ddblistview.c | 13 | ||||
-rw-r--r-- | plugins/gtkui/mainplaylist.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/search.c | 1 | ||||
-rw-r--r-- | plugins/gtkui/widgets.c | 18 |
5 files changed, 22 insertions, 13 deletions
@@ -274,7 +274,7 @@ enum { DB_EV_DSPCHAINCHANGED = 21, // emitted when any parameter of the main dsp chain has been changed // new in 1.2 - DB_EV_SELCHANGED = 20, // selection changed in playlist p1 iter p2 + DB_EV_SELCHANGED = 22, // selection changed in playlist p1 iter p2 DB_EV_FIRST = 1000, DB_EV_SONGCHANGED = 1000, // current song changed from one to another, ctx=ddb_event_trackchange_t diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index e13c7456..d45238d9 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -1381,7 +1381,7 @@ ddb_listview_select_single (DdbListview *ps, int sel) { int nchanged = 0; deadbeef->pl_lock (); - DB_playItem_t *sel_it = ps->binding->get_for_idx (sel); + DdbListviewIter sel_it = ps->binding->get_for_idx (sel); if (!sel_it) { deadbeef->pl_unlock (); return; @@ -1390,12 +1390,7 @@ ddb_listview_select_single (DdbListview *ps, int sel) { DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN); while (it) { int selected = deadbeef->pl_is_selected (it); - if (it == sel_it) { - if (!selected) { - deadbeef->pl_set_selected (it, 1); - } - } - else if (selected) { + if (selected) { deadbeef->pl_set_selected (it, 0); } DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN); @@ -1403,6 +1398,9 @@ ddb_listview_select_single (DdbListview *ps, int sel) { it = next; } UNREF (it); + + ps->binding->select (sel_it, 1); + UNREF (sel_it); deadbeef->pl_unlock (); @@ -1481,7 +1479,6 @@ ddb_listview_click_selection (DdbListview *ps, int ex, int ey, DdbListviewGroup UNREF (it); } deadbeef->pl_unlock (); - deadbeef->sendmessage (DB_EV_SELCHANGED, 0, deadbeef->plt_get_curr_idx (), PL_MAIN); } // {{{ expected behaviour for mouse1 without modifiers: diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c index b3a7f7d2..f1b829da 100644 --- a/plugins/gtkui/mainplaylist.c +++ b/plugins/gtkui/mainplaylist.c @@ -197,6 +197,7 @@ main_delete_selected (void) { void main_select (DdbListviewIter it, int sel) { deadbeef->pl_set_selected ((DB_playItem_t *)it, sel); + deadbeef->sendmessage (DB_EV_SELCHANGED, 0, deadbeef->plt_get_curr_idx (), PL_MAIN); } int diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c index 6634f12f..e5afd8f2 100644 --- a/plugins/gtkui/search.c +++ b/plugins/gtkui/search.c @@ -289,6 +289,7 @@ search_is_selected (DdbListviewIter it) { void search_select (DdbListviewIter it, int sel) { deadbeef->pl_set_selected ((DB_playItem_t *)it, sel); + deadbeef->sendmessage (DB_EV_SELCHANGED, 0, deadbeef->plt_get_curr_idx (), PL_SEARCH); } int diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c index 1d96441f..d9fdc706 100644 --- a/plugins/gtkui/widgets.c +++ b/plugins/gtkui/widgets.c @@ -1365,9 +1365,9 @@ tabbed_refresh_cb (gpointer p) { static gboolean refresh_cb (gpointer data) { - w_playlist_t *p = (w_playlist_t *)data; - ddb_listview_clear_sort (DDB_LISTVIEW (p->list)); - ddb_listview_refresh (DDB_LISTVIEW (p->list), DDB_REFRESH_LIST | DDB_REFRESH_VSCROLL); + DdbListview *p = DDB_LISTVIEW (data); + ddb_listview_clear_sort (p); + ddb_listview_refresh (DDB_LISTVIEW (p), DDB_REFRESH_LIST | DDB_REFRESH_VSCROLL); return FALSE; } @@ -1592,6 +1592,11 @@ w_tabbed_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, ui case DB_EV_TRACKFOCUSCURRENT: g_idle_add (tabbed_trackfocus_cb, w); break; + case DB_EV_SELCHANGED: + if (p2 == PL_SEARCH && p1 == deadbeef->plt_get_curr_idx ()) { + g_idle_add (refresh_cb, tp->list); + } + break; } return 0; } @@ -1632,7 +1637,7 @@ w_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t g_idle_add (paused_cb, w); break; case DB_EV_PLAYLISTCHANGED: - g_idle_add (refresh_cb, w); + g_idle_add (refresh_cb, p->list); break; case DB_EV_PLAYLISTSWITCHED: g_idle_add (playlistswitch_cb, w); @@ -1640,6 +1645,11 @@ w_playlist_message (ddb_gtkui_widget_t *w, uint32_t id, uintptr_t ctx, uint32_t case DB_EV_TRACKFOCUSCURRENT: g_idle_add (trackfocus_cb, w); break; + case DB_EV_SELCHANGED: + if (p2 == PL_SEARCH && p1 == deadbeef->plt_get_curr_idx ()) { + g_idle_add (refresh_cb, p->list); + } + break; } return 0; } |