changeset 3021:e3d7490ffd15 trunk

branch merge
author Tomasz Mon <desowin@gmail.com>
date Tue, 10 Jul 2007 11:33:37 +0200
parents 6065d70cb790 (current diff) 89b85a1b7fd2 (diff)
children 5e470f0b4f53
files src/audacious/playback.c src/audacious/ui_main.c src/audacious/ui_main.h
diffstat 3 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }
--- 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 */
     }
 
--- 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,