changeset 3923:e9fd46b0893b

- redefine playlist_incr_serial as a macro. - refine serial notification.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sat, 10 Nov 2007 15:55:12 +0900
parents 23e5b148ae7c
children 6c85469949af
files src/audacious/playlist.c src/audacious/playlist.h
diffstat 2 files changed, 21 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Sat Nov 10 00:47:40 2007 +0900
+++ b/src/audacious/playlist.c	Sat Nov 10 15:55:12 2007 +0900
@@ -143,8 +143,6 @@
 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 ********************** */
@@ -468,7 +466,7 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
     playlist_manager_update();
 }
 
@@ -528,7 +526,7 @@
     g_list_free_1(node);
 
     playlist_recalc_total_time_nolock(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
 }
 
 void
@@ -554,7 +552,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
 
     playlistwin_update_list(playlist);
     if (restart_playing) {
@@ -592,7 +590,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
     playlistwin_update_list(playlist);
 
     if (restart_playing) {
@@ -633,7 +631,7 @@
     PLAYLIST_UNLOCK(playlist);
 
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
 
     if (restart_playing) {
         if (playlist->position)
@@ -666,6 +664,7 @@
     playlist_get_info_scan_active = TRUE;
     g_mutex_unlock(mutex_scan);
     g_cond_signal(cond_scan);
+    PLAYLIST_INCR_SERIAL(playlist);
 }
 
 static void
@@ -758,6 +757,7 @@
         g_mutex_unlock(mutex_scan);
         g_cond_signal(cond_scan);
     }
+    PLAYLIST_INCR_SERIAL(playlist);
 }
 
 gboolean
@@ -1028,7 +1028,6 @@
     g_free(path2);
 
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_manager_update();
@@ -1087,7 +1086,7 @@
     }
 
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist); //probably necessary because there is no underlying __playlist_ins --yaz
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
 
@@ -1152,6 +1151,7 @@
     }
 
     playlist_recalc_total_time(playlist);
+    PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz
 
     mainwin_set_song_info(rate, freq, nch);
 
@@ -1853,7 +1853,10 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_manager_update();
-    playlist->serial++;
+
+    playlist_recalc_total_time(playlist); //tentative --yaz
+    PLAYLIST_INCR_SERIAL(playlist);
+
     return new_len - old_len;
 }
 
@@ -2797,7 +2800,7 @@
     playlist_generate_shuffle_list(playlist);
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
     playlist_manager_update();
 }
 
@@ -2917,7 +2920,7 @@
 
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+    PLAYLIST_INCR_SERIAL(playlist);
 
     playlist_manager_update();
 }
@@ -2938,12 +2941,6 @@
 }
 
 static void
-playlist_incr_serial(Playlist *playlist)
-{
-    playlist->serial++;
-}
-
-static void
 playlist_recalc_total_time_nolock(Playlist *playlist)
 {
     GList *list;
@@ -3151,7 +3148,7 @@
 
     PLAYLIST_UNLOCK(playlist);
     playlist_recalc_total_time(playlist);
-    playlist_incr_serial(playlist);
+//    PLAYLIST_INCR_SERIAL(playlist); //unnecessary? --yaz
 
     return num_of_entries_found;
 }
@@ -3265,6 +3262,7 @@
 
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
+    PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz
 
     return retval;
 }
@@ -3287,6 +3285,7 @@
 
     playlistwin_update_list(playlist);
     playlist_recalc_total_time(playlist);
+    PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz
 }
 
 Playlist *
--- a/src/audacious/playlist.h	Sat Nov 10 00:47:40 2007 +0900
+++ b/src/audacious/playlist.h	Sat Nov 10 15:55:12 2007 +0900
@@ -224,8 +224,9 @@
 
 gboolean is_playlist_name(const gchar * filename);
 
-#define PLAYLIST_LOCK(pl)    g_mutex_lock(pl->mutex)
-#define PLAYLIST_UNLOCK(pl)  g_mutex_unlock(pl->mutex)
+#define PLAYLIST_LOCK(pl)    g_mutex_lock((pl)->mutex)
+#define PLAYLIST_UNLOCK(pl)  g_mutex_unlock((pl)->mutex)
+#define PLAYLIST_INCR_SERIAL(pl)    (pl)->serial++
 
 G_LOCK_EXTERN(playlists);