Mercurial > audlegacy
comparison src/audacious/playlist.c @ 4297:40a991213507
check if playlistwin_list is UiSkinnedPlaylist before accessing it contents
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Fri, 22 Feb 2008 22:18:20 +0100 |
parents | 3ff4aef1e401 |
children | 6a87d1c1da32 |
comparison
equal
deleted
inserted
replaced
4296:f0b9b3c82e01 | 4297:40a991213507 |
---|---|
75 | 75 |
76 #include "pluginenum.h" | 76 #include "pluginenum.h" |
77 | 77 |
78 #include "playlist_evmessages.h" | 78 #include "playlist_evmessages.h" |
79 #include "playlist_evlisteners.h" | 79 #include "playlist_evlisteners.h" |
80 #include "ui_skinned_playlist.h" | |
81 | 80 |
82 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b); | 81 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b); |
83 typedef void (*PlaylistSaveFunc) (FILE * file); | 82 typedef void (*PlaylistSaveFunc) (FILE * file); |
84 | 83 |
85 /* If we manually change the song, p_p_b_j will show us where to go back to */ | 84 /* If we manually change the song, p_p_b_j will show us where to go back to */ |
1188 | 1187 |
1189 if (!playlist) | 1188 if (!playlist) |
1190 return; | 1189 return; |
1191 | 1190 |
1192 PLAYLIST_LOCK(playlist); | 1191 PLAYLIST_LOCK(playlist); |
1193 if (!playlist->position || !playlistwin_list) { | 1192 if (!playlist->position) { |
1194 PLAYLIST_UNLOCK(playlist); | 1193 PLAYLIST_UNLOCK(playlist); |
1195 return; | 1194 return; |
1196 } | 1195 } |
1197 | 1196 |
1198 pos = g_list_index(playlist->entries, playlist->position); | 1197 pos = g_list_index(playlist->entries, playlist->position); |
1200 if (playlistwin_item_visible(pos)) { | 1199 if (playlistwin_item_visible(pos)) { |
1201 PLAYLIST_UNLOCK(playlist); | 1200 PLAYLIST_UNLOCK(playlist); |
1202 return; | 1201 return; |
1203 } | 1202 } |
1204 | 1203 |
1205 bottom = MAX(0, playlist_get_length(playlist) - | 1204 bottom = MAX(0, playlist_get_length(playlist) - playlistwin_list_get_visible_count()); |
1206 UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible); | 1205 row = CLAMP(pos - playlistwin_list_get_visible_count() / 2, 0, bottom); |
1207 row = CLAMP(pos - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible / 2, 0, bottom); | |
1208 PLAYLIST_UNLOCK(playlist); | 1206 PLAYLIST_UNLOCK(playlist); |
1209 playlistwin_set_toprow(row); | 1207 playlistwin_set_toprow(row); |
1210 g_cond_signal(cond_scan); | 1208 g_cond_signal(cond_scan); |
1211 } | 1209 } |
1212 | 1210 |