From 913b9f86305c456fecf4a6da066deaaa38806b61 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 6 Nov 2011 20:26:11 -0500 Subject: [PATCH] ocarina: Seek to different parts of the song by clicking Button 1 seeks by 10 seconds either forward or backward, button 2 seeks to an absolute position. I initally wanted to switch the behavior of these two buttons, but for now I'll just have to get used to the GTK defaults. --- ocarina/footer/progress.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ocarina/footer/progress.cpp b/ocarina/footer/progress.cpp index b4bc3ee5..e7d78fb0 100644 --- a/ocarina/footer/progress.cpp +++ b/ocarina/footer/progress.cpp @@ -17,11 +17,18 @@ static gboolean update_progress(gpointer data) return TRUE; } +static void slider_changed(GtkWidget *slider, GtkScrollType scroll, + gdouble value, gpointer data) +{ + libsaria::audio::seek_to(value); +} + static void make_scale() { - progress = gtk_hscale_new_with_range(0, 1, 1); + progress = gtk_hscale_new_with_range(0, 1, 1000000000); gtk_scale_set_draw_value(GTK_SCALE(progress), FALSE); gtk_timeout_add(100, update_progress, NULL); + GTK_CONNECT(progress, "change-value", slider_changed, NULL); } static void make_progress()