# HG changeset patch # User Tomasz Mon # Date 1184060017 -7200 # Node ID e3d7490ffd155424151c4146e005699c9df84d78 # Parent 6065d70cb79036a44cb196c374feac8e273d1d72# Parent 89b85a1b7fd223a1fc420a492be65e0971705704 branch merge diff -r 6065d70cb790 -r e3d7490ffd15 src/audacious/playback.c --- a/src/audacious/playback.c Tue Jul 10 11:32:54 2007 +0200 +++ b/src/audacious/playback.c Tue Jul 10 11:33:37 2007 +0200 @@ -52,6 +52,7 @@ #include "playback.h" +static int song_info_timeout_source = 0; gint playback_get_time(void) @@ -100,6 +101,11 @@ playlist_check_pos_current(playlist); mainwin_set_info_text(); + mainwin_update_song_info(); + + /* FIXME: use g_timeout_add_seconds when glib-2.14 is required */ + song_info_timeout_source = g_timeout_add(1000, + (GSourceFunc) mainwin_update_song_info, NULL); if (cfg.player_shaded) { gtk_widget_show(mainwin_stime_min); @@ -169,7 +175,10 @@ ip_data.buffering = FALSE; ip_data.playing = FALSE; - + + if (song_info_timeout_source) + g_source_remove(song_info_timeout_source); + g_return_if_fail(mainwin_playstatus != NULL); playstatus_set_status_buffering(mainwin_playstatus, FALSE); } diff -r 6065d70cb790 -r e3d7490ffd15 src/audacious/ui_main.c --- a/src/audacious/ui_main.c Tue Jul 10 11:32:54 2007 +0200 +++ b/src/audacious/ui_main.c Tue Jul 10 11:33:37 2007 +0200 @@ -2494,6 +2494,7 @@ set_timer_mode(TIMER_REMAINING); else set_timer_mode(TIMER_ELAPSED); + mainwin_update_song_info(); } static void @@ -2996,21 +2997,21 @@ mainwin_idle_func, NULL); } -static void -idle_func_update_song_info(gint time) +gboolean +mainwin_update_song_info(void) { + gint time = playback_get_time(); gint length, t; gchar stime_prefix; + if (!playback_get_playing() || time < 0) + return FALSE; + if (ab_position_a != -1 && ab_position_b != -1 && time > ab_position_b) playback_seek(ab_position_a/1000); length = playlist_get_current_length(playlist_get_active()); - if (playback_get_playing()) - playlistwin_set_time(time, length, cfg.timer_mode); - else - playlistwin_hide_timer(); - input_update_vis(time); + playlistwin_set_time(time, length, cfg.timer_mode); if (cfg.timer_mode == TIMER_REMAINING) { if (length != -1) { @@ -3070,6 +3071,8 @@ hslider_set_position(mainwin_position, 0); hslider_set_position(mainwin_sposition, 1); } + + return TRUE; } static gboolean @@ -3091,7 +3094,7 @@ break; default: - idle_func_update_song_info(time); + input_update_vis(time); /* nothing at this time */ } diff -r 6065d70cb790 -r e3d7490ffd15 src/audacious/ui_main.h --- a/src/audacious/ui_main.h Tue Jul 10 11:32:54 2007 +0200 +++ b/src/audacious/ui_main.h Tue Jul 10 11:33:37 2007 +0200 @@ -169,6 +169,7 @@ GtkWidget * widget); void mainwin_attach_idle_func(void); +gboolean mainwin_update_song_info(void); void mainwin_drag_data_received(GtkWidget * widget, GdkDragContext * context, gint x,