diff src/audacious/playlist.c @ 3920:c2b2828186ba

- serial number has been added to playlist structure so that changes of the current playlist can be notified. - now jumptotrack always synchronizes to the current plalylist. - jumptotrack remembers the filter string while the current playlist is identical. - refresh button in jumptotrack deletes filter string.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Fri, 09 Nov 2007 19:39:27 +0900
parents e48f2f4c116d
children 35a26116f6bd
line wrap: on
line diff
--- a/src/audacious/playlist.c	Thu Nov 08 18:33:14 2007 +0100
+++ b/src/audacious/playlist.c	Fri Nov 09 19:39:27 2007 +0900
@@ -451,6 +451,7 @@
     playlist->entries = NULL;
     playlist->tail = NULL;
     playlist->attribute = PLAYLIST_PLAIN;
+    playlist->serial = 0;
 
     PLAYLIST_UNLOCK(playlist);
 }
@@ -985,7 +986,6 @@
 {
     guint entries;
     entries = playlist_ins_url(playlist, url, -1);
-//    printf("playlist_add_url: entries = %d\n", entries);
     return entries;
 }
 
@@ -1038,8 +1038,6 @@
     g_return_val_if_fail(playlist != NULL, 0);
     g_return_val_if_fail(string != NULL, 0);
 
-//    playlistwin_update_list(playlist); // is this necessary? --yaz
-
     while (*string) {
         GList *node;
         guint i = 0;
@@ -1115,7 +1113,7 @@
         }
     }
 
-    playlist_recalc_total_time(playlist);
+//    playlist_recalc_total_time(playlist); //annoying --yaz
 
     /* broadcast a PlaylistEventInfoChange message. */
     msg = g_new0(PlaylistEventInfoChange, 1);
@@ -1714,7 +1712,6 @@
 		pr = input_check_file(filename, FALSE);
 
             __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL);
-
             g_free(pr);
             return;
         }
@@ -1741,7 +1738,6 @@
 	    pr = input_check_file(filename, FALSE);
 
         __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL);
-
         g_free(pr);
     }
 
@@ -1782,7 +1778,6 @@
 	        pr = input_check_file(filename, FALSE);
 
             __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL);
-
             g_free(pr);
             return;
         }
@@ -1849,7 +1844,6 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_manager_update();
-
     return new_len - old_len;
 }
 
@@ -2960,6 +2954,7 @@
                 playlist->pl_selection_more = TRUE;
         }
     }
+    playlist->serial++;
 }
 
 static void
@@ -3157,7 +3152,7 @@
     }
 
     PLAYLIST_UNLOCK(playlist);
-    playlist_recalc_total_time(playlist);
+//    playlist_recalc_total_time(playlist); //annoying --yaz
 }
 
 void
@@ -3191,7 +3186,7 @@
     }
 
     PLAYLIST_UNLOCK(playlist);
-    playlist_recalc_total_time(playlist);
+//    playlist_recalc_total_time(playlist); //annoying --yaz
 
     return invert_ok;
 }
@@ -3315,6 +3310,9 @@
     playlist->title = NULL;
     playlist->filename = NULL;
     playlist_clear(playlist);
+    playlist->tail = NULL;
+    playlist->attribute = PLAYLIST_PLAIN;
+    playlist->serial = 0;
 
     return playlist;
 }
@@ -3327,6 +3325,7 @@
     
     g_mutex_free( playlist->mutex );
     g_free( playlist );
+    playlist = NULL; //XXX lead to crash? --yaz
 }
 
 Playlist *