changeset 2096:25e91bba434d trunk

[svn] - avoid a crash
author nenolod
date Mon, 11 Dec 2006 05:29:44 -0800
parents 855bba3f364e
children 75100f6b216a
files ChangeLog audacious/playlist.c
diffstat 2 files changed, 22 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 11 05:09:02 2006 -0800
+++ b/ChangeLog	Mon Dec 11 05:29:44 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-11 13:09:02 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [3195]
+  - update playlist UI
+  
+  trunk/audacious/ui_playlist.c |  172 ++++++++++++++++++++++++------------------
+  1 file changed, 100 insertions(+), 72 deletions(-)
+
+
 2006-12-11 12:56:46 +0000  Kiyoshi Aman <kiyoshi.aman@gmail.com>
   revision [3193]
   Update equalizer.c to new API
--- a/audacious/playlist.c	Mon Dec 11 05:09:02 2006 -0800
+++ b/audacious/playlist.c	Mon Dec 11 05:29:44 2006 -0800
@@ -60,7 +60,6 @@
 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
 typedef void (*PlaylistSaveFunc) (FILE * file);
 
-PlaylistEntry *playlist_position;
 /* If we manually change the song, p_p_b_j will show us where to go back to */
 PlaylistEntry *playlist_position_before_jump = NULL;
 G_LOCK_DEFINE(playlists);
@@ -387,7 +386,7 @@
 
     playlistwin_update_list();
     if (restart_playing) {
-        if (playlist_position) {
+        if (playlist->position) {
             bmp_playback_initiate();
         }
         else {
@@ -427,7 +426,7 @@
     playlistwin_update_list();
 
     if (restart_playing) {
-        if (playlist_position) {
+        if (playlist->position) {
             bmp_playback_initiate();
         }
         else {
@@ -474,7 +473,7 @@
     }
 
     if (restart_playing) {
-        if (playlist_position) {
+        if (playlist->position) {
             bmp_playback_initiate();
         }
         else {
@@ -975,7 +974,7 @@
     
     if ((playlist_position_before_jump != NULL) && playlist->queue == NULL)
     {
-        playlist_position = playlist_position_before_jump;
+        playlist->position = playlist_position_before_jump;
         playlist_position_before_jump = NULL;
     }
 
@@ -998,18 +997,18 @@
 
     plist_pos_list = find_playlist_position_list(playlist);
     if (g_list_previous(plist_pos_list)) {
-        playlist_position = g_list_previous(plist_pos_list)->data;
+        playlist->position = g_list_previous(plist_pos_list)->data;
     }
     else if (cfg.repeat) {
         GList *node;
-        playlist_position = NULL;
+        playlist->position = NULL;
         playlist_generate_shuffle_list_nolock(playlist);
         if (cfg.shuffle)
             node = g_list_last(playlist->shuffle);
         else
             node = g_list_last(playlist->entries);
         if (node)
-            playlist_position = node->data;
+            playlist->position = node->data;
     }
 
     PLAYLIST_UNLOCK();
@@ -1337,7 +1336,7 @@
     else
         numbers = g_strdup("");
 
-    if (playlist_position->length != -1)
+    if (playlist->position->length != -1)
         length = g_strdup_printf(" (%d:%-2.2d)",
                                  playlist->position->length / 60000,
                                  (playlist->position->length / 1000) % 60);
@@ -1557,7 +1556,7 @@
 gint
 playlist_get_position_nolock(Playlist *playlist)
 {
-    if (playlist && playlist_position)
+    if (playlist && playlist->position)
         return g_list_index(playlist->entries, playlist->position);
     return 0;
 }
@@ -2240,6 +2239,7 @@
     GList *node;
     gboolean update_playlistwin = FALSE;
     gboolean update_mainwin = FALSE;
+    Playlist *playlist = playlist_get_active();
 
     while (playlist_get_info_is_going()) {
         PlaylistEntry *entry;
@@ -2266,7 +2266,7 @@
                 }
                 else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) {
                     update_playlistwin = TRUE;
-                    if (entry == playlist_position)
+                    if (entry == playlist->position)
                         update_mainwin = TRUE;
                     break;
                 }
@@ -2318,7 +2318,7 @@
                     }
                     else if ((entry->tuple != NULL || entry->title != NULL) && entry->length != -1) {
                         update_playlistwin = TRUE;
-                        if (entry == playlist_position)
+                        if (entry == playlist->position)
                             update_mainwin = TRUE;
 			// no need for break here since this iteration is very short.
                     }
@@ -2415,7 +2415,7 @@
         if (vfs_file_test(entry->filename, G_FILE_TEST_EXISTS))  
             continue;
 
-        if (entry == playlist_position) {
+        if (entry == playlist->position) {
             /* Don't remove the currently playing song */
             if (bmp_playback_get_playing())
                 continue;
@@ -2542,7 +2542,7 @@
             /* compare using the chosen dups_compare_func */
             if ( !dups_compare_func( entry , entry_cmp ) ) {
 
-                if (entry_cmp == playlist_position) {
+                if (entry_cmp == playlist->position) {
                     /* Don't remove the currently playing song */
                     if (bmp_playback_get_playing())
                         continue;