# HG changeset patch # User Tomasz Mon # Date 1215265323 -7200 # Node ID b3e2ea3f9297c73846624f5426f6c3e588f11811 # Parent 9e70ca57b5ddeb9b0db3e2fbd3d9844185107c17 display what would be played if user presses play button diff -r 9e70ca57b5dd -r b3e2ea3f9297 src/audacious/ui_new.c --- a/src/audacious/ui_new.c Sat Jul 05 14:49:22 2008 +0200 +++ b/src/audacious/ui_new.c Sat Jul 05 15:42:03 2008 +0200 @@ -85,18 +85,24 @@ } static void -set_song_title(gpointer hook_data, gpointer user_data) +ui_set_current_song_title(gchar *text, gpointer user_data) { - gchar *title = - g_strdup_printf("%s", - playlist_get_info_text(playlist_get_active())); + gchar *title = g_strdup_printf("%s", text); gtk_label_set_text(GTK_LABEL(label_current), title); g_object_set(G_OBJECT(label_current), "use-markup", TRUE, NULL); g_free(title); } +static void +ui_playlist_update(Playlist *playlist, gpointer user_data) +{ + gchar *text = playlist_get_info_text(playlist); + ui_set_current_song_title(text, NULL); + g_free(text); +} + static gboolean -update_song_info(gpointer hook_data, gpointer user_data) +ui_update_song_info(gpointer hook_data, gpointer user_data) { if (!playback_get_playing()) { @@ -145,9 +151,9 @@ static void ui_playback_begin(gpointer hook_data, gpointer user_data) { - update_song_info(NULL, NULL); + ui_update_song_info(NULL, NULL); update_song_timeout_source = - g_timeout_add_seconds(1, (GSourceFunc) update_song_info, NULL); + g_timeout_add_seconds(1, (GSourceFunc) ui_update_song_info, NULL); } static void @@ -162,7 +168,7 @@ static void ui_playback_end(gpointer hook_data, gpointer user_data) { - update_song_info(NULL, NULL); + ui_update_song_info(NULL, NULL); } static GtkToolItem * @@ -254,11 +260,12 @@ gtk_range_set_update_policy(GTK_RANGE(slider), GTK_UPDATE_DELAYED); gtk_box_pack_end(GTK_BOX(cvbox), slider, TRUE, TRUE, 0); - hook_associate("title change", set_song_title, NULL); - hook_associate("playback seek", (HookFunction) update_song_info, NULL); + hook_associate("title change", (HookFunction) ui_set_current_song_title, NULL); + hook_associate("playback seek", (HookFunction) ui_update_song_info, NULL); hook_associate("playback begin", (HookFunction) ui_playback_begin, NULL); hook_associate("playback stop", (HookFunction) ui_playback_stop, NULL); hook_associate("playback end", (HookFunction) ui_playback_end, NULL); + hook_associate("playlist update", (HookFunction) ui_playlist_update, NULL); slider_change_handler_id = g_signal_connect(slider, "value-changed", @@ -269,6 +276,8 @@ g_signal_connect(slider, "button-release-event", G_CALLBACK(ui_slider_button_release_cb), NULL); + ui_playlist_update(playlist_get_active(), NULL); + gtk_widget_show_all(window); gtk_main();