diff options
author | 2009-07-31 22:56:59 +0200 | |
---|---|---|
committer | 2009-07-31 22:56:59 +0200 | |
commit | 12e2421e2bf9f8565fee5f3ff40e208408a333d4 (patch) | |
tree | 5bdc04278510429bf9d32110640b8658de65ab68 /gtkplaylist.c | |
parent | 79d0a9187928ccb832eefff59c609dfe03bb79fb (diff) |
implemented "delete selection"
Diffstat (limited to 'gtkplaylist.c')
-rw-r--r-- | gtkplaylist.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gtkplaylist.c b/gtkplaylist.c index d034b5b2..b31b09df 100644 --- a/gtkplaylist.c +++ b/gtkplaylist.c @@ -8,6 +8,7 @@ #include <stdlib.h> #include <time.h> #include <string.h> +#include <assert.h> #include "gtkplaylist.h" #include "callbacks.h" #include "interface.h" @@ -175,9 +176,10 @@ draw_playlist (GtkWidget *widget, int x, int y, int w, int h) { } } it = it_copy; - for (row = row1; row < row2; row++) { - draw_ps_row (backbuf, cr, row, it); - it = it->next; + int idx = 0; + for (row = row1; row < row2; row++, idx++) { + draw_ps_row (backbuf, cr, row, it); + it = it->next; } cairo_destroy (cr); @@ -706,6 +708,15 @@ gtkps_keypress (int keyval, int state) { messagepump_push (M_PLAYSONGNUM, 0, playlist_row, 0); return; } + else if (keyval == GDK_Delete) { + ps_delete_selected (); + if (playlist_row >= ps_getcount ()) { + playlist_row = ps_getcount () - 1; + } + draw_playlist (widget, 0, 0, widget->allocation.width, widget->allocation.height); + gdk_draw_drawable (widget->window, widget->style->black_gc, backbuf, 0, 0, 0, 0, widget->allocation.width, widget->allocation.height); + return; + } else if (keyval == GDK_Down && playlist_row < ps_getcount () - 1) { playlist_row++; if (playlist_row > scrollpos + widget->allocation.height / rowheight - 1) { |