ocarina: Show the current audio position

This probably isn't a final placement of the widget, but for now drawing
in the widget is a good improvement.
This commit is contained in:
Bryan Schumaker 2011-11-02 08:21:01 -04:00
parent 0a216c38ce
commit 1018b0bc5b
1 changed files with 8 additions and 4 deletions

View File

@ -4,12 +4,14 @@
#include <libsaria/print.h>
#include "footer.h"
static GtkWidget *progress_box = NULL;
static GtkWidget *progress = NULL;
static GtkWidget *duration = NULL;
static GtkWidget *progress_box = NULL; /* gtk hbox */
static GtkWidget *position = NULL; /* gtk label */
static GtkWidget *progress = NULL; /* gtk hscale */
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_range_set_range(GTK_RANGE(progress), 0, libsaria::audio::duration() + 1);
gtk_range_set_value(GTK_RANGE(progress), libsaria::audio::position());
return TRUE;
@ -24,10 +26,12 @@ static void make_scale()
static void make_progress()
{
position = gtk_label_new("");
progress_box = gtk_hbox_new(FALSE, 0);
duration = gtk_label_new("");
duration = gtk_label_new("");
make_scale();
box_pack_start(progress_box, position, FALSE, FALSE, 0);
box_pack_start(progress_box, progress, TRUE, TRUE, 0);
box_pack_start(progress_box, duration, FALSE, FALSE, 0);
gtk_widget_show_all(progress_box);