changeset 3922:23e5b148ae7c

to get rid of annoying side effects, an independent function for playlist serial increment has been provided.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sat, 10 Nov 2007 00:47:40 +0900
parents 35a26116f6bd
children e9fd46b0893b
files src/audacious/playlist.c
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Fri Nov 09 20:32:06 2007 +0900
+++ b/src/audacious/playlist.c	Sat Nov 10 00:47:40 2007 +0900
@@ -143,6 +143,8 @@
 static void playlist_recalc_total_time(Playlist *);
 static gboolean playlist_entry_get_info(PlaylistEntry * entry);
 
+static void playlist_incr_serial(Playlist *playlist);
+
 static mowgli_heap_t *playlist_entry_heap = NULL;
 
 /* *********************** playlist entry code ********************** */
@@ -466,6 +468,7 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
     playlist_manager_update();
 }
 
@@ -525,6 +528,7 @@
     g_list_free_1(node);
 
     playlist_recalc_total_time_nolock(playlist);
+    playlist_incr_serial(playlist);
 }
 
 void
@@ -550,6 +554,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
 
     playlistwin_update_list(playlist);
     if (restart_playing) {
@@ -587,6 +592,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
     playlistwin_update_list(playlist);
 
     if (restart_playing) {
@@ -627,6 +633,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
 
     if (restart_playing) {
         if (playlist->position)
@@ -1021,6 +1028,7 @@
     g_free(path2);
 
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_manager_update();
@@ -1079,6 +1087,7 @@
     }
 
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
 
@@ -1113,7 +1122,7 @@
         }
     }
 
-//    playlist_recalc_total_time(playlist); //annoying --yaz
+    playlist_recalc_total_time(playlist);
 
     /* broadcast a PlaylistEventInfoChange message. */
     msg = g_new0(PlaylistEventInfoChange, 1);
@@ -2788,6 +2797,7 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
     playlist_manager_update();
 }
 
@@ -2907,6 +2917,7 @@
 
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
 
     playlist_manager_update();
 }
@@ -2926,6 +2937,11 @@
     PLAYLIST_UNLOCK(playlist);
 }
 
+static void
+playlist_incr_serial(Playlist *playlist)
+{
+    playlist->serial++;
+}
 
 static void
 playlist_recalc_total_time_nolock(Playlist *playlist)
@@ -2955,7 +2971,6 @@
                 playlist->pl_selection_more = TRUE;
         }
     }
-    playlist->serial++;
 }
 
 static void
@@ -3136,6 +3151,7 @@
 
     PLAYLIST_UNLOCK(playlist);
     playlist_recalc_total_time(playlist);
+    playlist_incr_serial(playlist);
 
     return num_of_entries_found;
 }
@@ -3153,7 +3169,7 @@
     }
 
     PLAYLIST_UNLOCK(playlist);
-//    playlist_recalc_total_time(playlist); //annoying --yaz
+    playlist_recalc_total_time(playlist);
 }
 
 void
@@ -3187,7 +3203,7 @@
     }
 
     PLAYLIST_UNLOCK(playlist);
-//    playlist_recalc_total_time(playlist); //annoying --yaz
+    playlist_recalc_total_time(playlist);
 
     return invert_ok;
 }