ocarina: Set duration on every refresh

The progress bar should stay in sync now.  I got annoyed that it never
did when pausing after the current track.
This commit is contained in:
Bryan Schumaker 2011-12-23 20:38:00 -05:00
parent 7711b354cb
commit 5e20a26dbf
3 changed files with 1 additions and 7 deletions

View File

@ -40,5 +40,4 @@ void put_footer()
void change_footer(Track &track)
{
set_now_playing(track);
set_duration(track);
}

View File

@ -8,6 +8,5 @@ GtkWidget *get_nowplaying();
GtkWidget *get_progress();
void set_now_playing(Track &);
void set_duration(Track &);
#endif /* OCARINA_FOOTER_PRIVATE_H */

View File

@ -12,6 +12,7 @@ static GtkWidget *duration = NULL; /* gtk label */
static gboolean update_progress(gpointer data)
{
gtk_label_set_text(GTK_LABEL(position), libsaria::audio::posstr().c_str());
gtk_label_set_text(GTK_LABEL(duration), libsaria::audio::durstr().c_str());
gtk_range_set_range(GTK_RANGE(progress), 0, libsaria::audio::duration() + 1);
gtk_range_set_value(GTK_RANGE(progress), libsaria::audio::position());
return TRUE;
@ -50,8 +51,3 @@ GtkWidget *get_progress()
make_progress();
return progress_box;
}
void set_duration(Track &track)
{
gtk_label_set_text(GTK_LABEL(duration), track.get_lenstr().c_str());
}