summaryrefslogtreecommitdiff
path: root/plugins/converter
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-11-05 22:17:25 +0100
committerGravatar waker <wakeroid@gmail.com>2012-11-05 22:18:42 +0100
commiteee42b650c1408388e08e85dfbd473e521492906 (patch)
treecf3aa58456fead35c0917dd3bc121d973417dd5c /plugins/converter
parente4b82f177f06caa3cc123899bc420627abe022b6 (diff)
more adaptation of plugin actions to the new APIs
Diffstat (limited to 'plugins/converter')
-rw-r--r--plugins/converter/convgui.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c
index be6795c3..302c31fb 100644
--- a/plugins/converter/convgui.c
+++ b/plugins/converter/convgui.c
@@ -344,22 +344,24 @@ converter_show_cb (void *data) {
case DDB_ACTION_CTX_SELECTION:
{
// copy list
- int nsel = deadbeef->pl_getselcount ();
- conv->convert_items_count = nsel;
- if (0 < nsel) {
- conv->convert_items = malloc (sizeof (DB_playItem_t *) * nsel);
- if (conv->convert_items) {
- int n = 0;
- DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN);
- while (it) {
- if (deadbeef->pl_is_selected (it)) {
- assert (n < nsel);
- deadbeef->pl_item_ref (it);
- conv->convert_items[n++] = it;
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ if (plt) {
+ conv->convert_items_count = deadbeef->plt_getselcount (plt);
+ if (0 < conv->convert_items_count) {
+ conv->convert_items = malloc (sizeof (DB_playItem_t *) * conv->convert_items_count);
+ if (conv->convert_items) {
+ int n = 0;
+ DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN);
+ while (it) {
+ if (deadbeef->pl_is_selected (it)) {
+ assert (n < conv->convert_items_count);
+ deadbeef->pl_item_ref (it);
+ conv->convert_items[n++] = it;
+ }
+ DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN);
+ deadbeef->pl_item_unref (it);
+ it = next;
}
- DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN);
- deadbeef->pl_item_unref (it);
- it = next;
}
}
}
@@ -377,11 +379,8 @@ converter_show_cb (void *data) {
int n = 0;
DB_playItem_t *it = deadbeef->pl_get_first (PL_MAIN);
while (it) {
- deadbeef->pl_item_ref (it);
conv->convert_items[n++] = it;
- DB_playItem_t *next = deadbeef->pl_get_next (it, PL_MAIN);
- deadbeef->pl_item_unref (it);
- it = next;
+ it = deadbeef->pl_get_next (it, PL_MAIN);
}
}
}