Mercurial > audlegacy
diff src/audacious/playlist.c @ 3159:a2d552ea48f0 trunk
Use message passing to make sure the UI is updated in the main thread.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Tue, 24 Jul 2007 01:05:57 -0500 |
parents | c5568d294a8a |
children | 8775dfc57ead |
line wrap: on
line diff
--- a/src/audacious/playlist.c Mon Jul 23 19:35:59 2007 -0500 +++ b/src/audacious/playlist.c Tue Jul 24 01:05:57 2007 -0500 @@ -71,6 +71,9 @@ #include "hook.h" +#include "playlist_evmessages.h" +#include "playlist_evlisteners.h" + typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b); typedef void (*PlaylistSaveFunc) (FILE * file); @@ -260,6 +263,8 @@ initial_pl = playlist_new(); playlist_add_playlist(initial_pl); + + playlist_evlistener_init(); } void @@ -1039,6 +1044,7 @@ gint freq, gint nch) { Playlist *playlist = playlist_get_active(); + PlaylistEventInfoChange *msg; g_return_if_fail(playlist != NULL); @@ -1058,7 +1064,13 @@ playlist_recalc_total_time(playlist); - mainwin_set_song_info(rate, freq, nch); + /* broadcast a PlaylistEventInfoChange message. */ + msg = g_new0(PlaylistEventInfoChange, 1); + msg->bitrate = rate; + msg->samplerate = freq; + msg->channels = nch; + + event_queue("playlist info change", msg); if ( playlist->position ) hook_call( "playlist set info" , playlist->position );