changeset 3780:ec989c2cde74

Make selective subtunes support actually work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 18 Oct 2007 01:30:05 +0300
parents 7f42752acf4d
children e0da46ca4c0b a3fc112b10f1
files src/audacious/playlist.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Wed Oct 17 23:02:12 2007 +0300
+++ b/src/audacious/playlist.c	Thu Oct 18 01:30:05 2007 +0300
@@ -669,7 +669,7 @@
 {
     PlaylistEntry *entry;
     Tuple *parent_tuple = NULL;
-    gint nsubtunes = 0, i = 0;
+    gint nsubtunes, subtune;
     gboolean add_flag = TRUE;
 
     g_return_if_fail(playlist != NULL);
@@ -677,18 +677,17 @@
 
     if (tuple != NULL) {
         nsubtunes = tuple->nsubtunes;
-        if (nsubtunes > 0) {
+        if (nsubtunes > 0)
             parent_tuple = tuple;
-            i = 1;
-        }
-    }
-
-    for (; add_flag && i <= nsubtunes; i++) {
+    } else
+        nsubtunes = 0;
+
+    for (subtune = 0; add_flag && subtune < nsubtunes; subtune++) {
         gchar *filename_entry;
         
         if (nsubtunes > 0) {
             filename_entry = g_strdup_printf("%s?%d", filename,
-                parent_tuple->subtunes ? parent_tuple->subtunes[i] : i);
+                parent_tuple->subtunes ? parent_tuple->subtunes[subtune] : subtune + 1);
             
             /* We're dealing with subtune, let's ask again tuple information
              * to plugin, by passing the ?subtune suffix; this way we get
@@ -709,7 +708,7 @@
 
         PLAYLIST_LOCK(playlist);
 
-        if ((pos == -1) && (i < 2)) { // the common case
+        if (pos == -1 && subtune < 1 && nsubtunes < 1) { // the common case
             GList *element;
             element = g_list_alloc();
             element->data = entry;