diff options
-rw-r--r-- | callbacks.c | 2 | ||||
-rw-r--r-- | playlist.c | 10 | ||||
-rw-r--r-- | playlist.h | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/callbacks.c b/callbacks.c index 2150b0d1..f03c36c4 100644 --- a/callbacks.c +++ b/callbacks.c @@ -404,7 +404,7 @@ on_remove1_activate (GtkMenuItem *menuitem, { gtkplaylist_t *ps = &main_playlist; GtkWidget *widget = ps->playlist; - pl_delete_selected (); + ps->row = pl_delete_selected (); gtkpl_setup_scrollbar (ps); gtkpl_draw_playlist (ps, 0, 0, widget->allocation.width, widget->allocation.height); gtkpl_expose (ps, 0, 0, widget->allocation.width, widget->allocation.height); @@ -955,15 +955,21 @@ pl_find_meta (playItem_t *it, const char *key) { return NULL; } -void +int pl_delete_selected (void) { + int i = 0; + int ret = -1; playItem_t *next = NULL; - for (playItem_t *it = playlist_head[PL_MAIN]; it; it = next) { + for (playItem_t *it = playlist_head[PL_MAIN]; it; it = next, i++) { next = it->next[PL_MAIN]; if (it->selected) { + if (ret == -1) { + ret = i; + } pl_remove (it); } } + return ret; } void @@ -133,7 +133,8 @@ pl_format_item_display_name (playItem_t *it, char *str, int len); const char * pl_find_meta (playItem_t *it, const char *key); -void +// returns index of 1st deleted item +int pl_delete_selected (void); void |