comparison src/audacious/playlist.c @ 4504:a47288ced5d5

- renamed some files to reflect their UI contents - use more hooks now to call stuff
author mf0102 <0102@gmx.at>
date Tue, 22 Apr 2008 10:55:35 +0200
parents 180996fcf12a
children a849b8af8db6
comparison
equal deleted inserted replaced
4503:2d20d4fa57f4 4504:a47288ced5d5
53 #else 53 #else
54 # include <regex.h> 54 # include <regex.h>
55 #endif 55 #endif
56 56
57 #include "input.h" 57 #include "input.h"
58 #include "main.h"
59 #include "ui_main.h" 58 #include "ui_main.h"
60 #include "util.h" 59 #include "util.h"
61 #include "configdb.h" 60 #include "configdb.h"
62 #include "vfs.h" 61 #include "vfs.h"
63 #include "playback.h" 62 #include "playback.h"
73 #include "hook.h" 72 #include "hook.h"
74 73
75 #include "pluginenum.h" 74 #include "pluginenum.h"
76 75
77 #include "playlist_evmessages.h" 76 #include "playlist_evmessages.h"
78 #include "playlist_evlisteners.h"
79 77
80 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b); 78 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
81 typedef void (*PlaylistSaveFunc) (FILE * file); 79 typedef void (*PlaylistSaveFunc) (FILE * file);
82 80
83 /* If we manually change the song, p_p_b_j will show us where to go back to */ 81 /* If we manually change the song, p_p_b_j will show us where to go back to */
290 /* FIXME: is this really necessary? REQUIRE_STATIC_LOCK(playlists); */ 288 /* FIXME: is this really necessary? REQUIRE_STATIC_LOCK(playlists); */
291 289
292 initial_pl = playlist_new(); 290 initial_pl = playlist_new();
293 291
294 playlist_add_playlist(initial_pl); 292 playlist_add_playlist(initial_pl);
295
296 playlist_evlistener_init();
297 } 293 }
298 294
299 void 295 void
300 playlist_add_playlist(Playlist *playlist) 296 playlist_add_playlist(Playlist *playlist)
301 { 297 {
315 /* users suppose playback will be stopped on removing playlist */ 311 /* users suppose playback will be stopped on removing playlist */
316 if (active && playback_get_playing()) { 312 if (active && playback_get_playing()) {
317 ip_data.stop = TRUE; 313 ip_data.stop = TRUE;
318 playback_stop(); 314 playback_stop();
319 ip_data.stop = FALSE; 315 ip_data.stop = FALSE;
320 mainwin_clear_song_info(); 316 hook_call("playlist end reached", NULL);
321 } 317 }
322 318
323 /* trying to free the last playlist simply clears and resets it */ 319 /* trying to free the last playlist simply clears and resets it */
324 if (g_list_length(playlists) < 2) { 320 if (g_list_length(playlists) < 2) {
325 playlist_clear(playlist); 321 playlist_clear(playlist);
589 playlistwin_update_list(playlist); 585 playlistwin_update_list(playlist);
590 if (restart_playing) { 586 if (restart_playing) {
591 if (playlist->position) 587 if (playlist->position)
592 playback_initiate(); 588 playback_initiate();
593 else 589 else
594 mainwin_clear_song_info(); 590 hook_call("playlist end reached", NULL);
595 } 591 }
596 592
597 playlist_manager_update(); 593 playlist_manager_update();
598 } 594 }
599 595
629 625
630 if (restart_playing) { 626 if (restart_playing) {
631 if (playlist->position) 627 if (playlist->position)
632 playback_initiate(); 628 playback_initiate();
633 else 629 else
634 mainwin_clear_song_info(); 630 hook_call("playlist end reached", NULL);
635 } 631 }
636 632
637 playlistwin_update_list(playlist); 633 playlistwin_update_list(playlist);
638 playlist_manager_update(); 634 playlist_manager_update();
639 } 635 }
1493 1489
1494 plist_pos_list = find_playlist_position_list(playlist); 1490 plist_pos_list = find_playlist_position_list(playlist);
1495 1491
1496 if (cfg.no_playlist_advance) { 1492 if (cfg.no_playlist_advance) {
1497 PLAYLIST_UNLOCK(playlist); 1493 PLAYLIST_UNLOCK(playlist);
1498 mainwin_clear_song_info();
1499 if (cfg.repeat) 1494 if (cfg.repeat)
1500 playback_initiate(); 1495 playback_initiate();
1496 else
1497 hook_call("playlist end reached", NULL);
1501 return; 1498 return;
1502 } 1499 }
1503 1500
1504 if (cfg.stopaftersong) { 1501 if (cfg.stopaftersong) {
1505 PLAYLIST_UNLOCK(playlist); 1502 PLAYLIST_UNLOCK(playlist);
1506 mainwin_clear_song_info(); 1503 hook_call("playlist end reached", NULL);
1507 mainwin_set_stopaftersong(FALSE); 1504 mainwin_set_stopaftersong(FALSE);
1508 return; 1505 return;
1509 } 1506 }
1510 1507
1511 if (playlist->queue != NULL) { 1508 if (playlist->queue != NULL) {
1519 else if (playlist->entries != NULL) 1516 else if (playlist->entries != NULL)
1520 playlist->position = playlist->entries->data; 1517 playlist->position = playlist->entries->data;
1521 1518
1522 if (!cfg.repeat) { 1519 if (!cfg.repeat) {
1523 PLAYLIST_UNLOCK(playlist); 1520 PLAYLIST_UNLOCK(playlist);
1524 hook_call("playlist end reached", playlist->position); 1521 hook_call("playlist end reached", NULL);
1525 mainwin_clear_song_info();
1526 return; 1522 return;
1527 } 1523 }
1528 } 1524 }
1529 else 1525 else
1530 playlist->position = g_list_next(plist_pos_list)->data; 1526 playlist->position = g_list_next(plist_pos_list)->data;