changeset 4686:a6d1b4056966

reset slider when at end of song
author mf0102 <0102@gmx.at>
date Sat, 05 Jul 2008 01:35:17 +0200
parents 06028c2c9068
children 9e70ca57b5dd
files src/audacious/ui_new.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_new.c	Sat Jul 05 01:17:05 2008 +0200
+++ b/src/audacious/ui_new.c	Sat Jul 05 01:35:17 2008 +0200
@@ -98,7 +98,10 @@
 update_song_info(gpointer hook_data, gpointer user_data)
 {
     if (!playback_get_playing())
+    {
+        gtk_range_set_value(GTK_RANGE(slider), (gdouble)0);
         return FALSE;
+    }
 
     gint time = playback_get_time();
     gint length = playback_get_length();
@@ -139,6 +142,12 @@
     }
 }
 
+static void
+ui_playback_end(gpointer hook_data, gpointer user_data)
+{
+    update_song_info(NULL, NULL);
+}
+
 static GtkToolItem *
 gtk_toolbar_button_add(GtkWidget *toolbar, void(*callback)(), const gchar *stock_id)
 {
@@ -231,6 +240,7 @@
     hook_associate("playback seek", (HookFunction) 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);
 
     slider_change_handler_id =
         g_signal_connect(slider, "change-value",