diff options
author | 2009-12-28 19:51:52 +0100 | |
---|---|---|
committer | 2009-12-28 19:51:52 +0100 | |
commit | 0cdf6df414e5d59cc41d915c6d9f012299656c7e (patch) | |
tree | e22119ce3262be400a3c39fa7e21b1656e3ff280 /plugins/gtkui/gtkplaylist.c | |
parent | 50bd3ec6e2a8f0d9c5073aad0f9b0b997fcc4ccb (diff) |
fixed crashbug when deleting tracks with search window opened
now it's possible to delete tracks in search window with Delete key
Diffstat (limited to 'plugins/gtkui/gtkplaylist.c')
-rw-r--r-- | plugins/gtkui/gtkplaylist.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index bf551e5a..2f9821dd 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -887,6 +887,16 @@ gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) { } void +main_refresh (void) { + if (mainwin && GTK_WIDGET_VISIBLE (mainwin)) { + gtkplaylist_t *ps = &main_playlist; + gtkpl_setup_scrollbar (ps); + gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); + gtkpl_expose (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height); + } +} + +void gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) { GtkWidget *range = ps->scrollbar; int prev = deadbeef->pl_get_cursor (ps->iterator); @@ -935,6 +945,22 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) { gtkpl_set_cursor (ps->iterator, 0); } } + else if (keyval == GDK_Delete) { + GtkWidget *widget = ps->playlist; + int row = deadbeef->pl_delete_selected (); + if (row >= ps->get_count ()) { + row = ps->get_count ()-1; + } + deadbeef->pl_set_cursor (ps->iterator, row); + if (row != -1) { + DB_playItem_t *it = deadbeef->pl_get_for_idx (row); + if (it) { + deadbeef->pl_set_selected (it, 1); + } + } + main_refresh (); + search_refresh (); + } if (state & GDK_SHIFT_MASK) { // select all between shift_sel_anchor and deadbeef->pl_get_cursor (ps->iterator) if (prev != deadbeef->pl_get_cursor (ps->iterator)) { |