From 25acc644932fc8629941a8d9d96d253e15b393a2 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 14 Jun 2012 20:10:15 +0200 Subject: status bar to display current time and video length * currently, when video is stopped or paused and time is changed there are no time updates --- src/default.ui | 38 ++++++++++++++++++++++++++++++++++++++ src/experiment-player.h | 16 ++++++++++++++++ src/main.c | 22 ++++++++++++++++++++++ 3 files changed, 76 insertions(+) (limited to 'src') diff --git a/src/default.ui b/src/default.ui index 923a0c5..fd07709 100644 --- a/src/default.ui +++ b/src/default.ui @@ -145,6 +145,8 @@ True + + 1 @@ -237,6 +239,42 @@ audio-volume-medium 2 + + + True + 2 + + + True + 0 + Time: 0:00 + 15 + True + + + False + 0 + + + + + True + 0 + Length: 0:00 + 15 + True + + + False + 1 + + + + + False + 3 + + diff --git a/src/experiment-player.h b/src/experiment-player.h index 7c7a620..5775592 100644 --- a/src/experiment-player.h +++ b/src/experiment-player.h @@ -58,6 +58,8 @@ extern GtkWidget *player_widget, *playpause_button, *volume_button; +extern GtkWidget *player_window_statusbar; + extern GtkWidget *transcript_table, *transcript_wizard_widget, *transcript_proband_widget, @@ -229,4 +231,18 @@ path_strip_extension(const gchar *filename) return ret; } +/** @public */ +static inline const gchar * +format_timepoint(const gchar *prefix, gint64 timept) +{ + static gchar buf[255]; + + g_snprintf(buf, sizeof(buf), + "%s%" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT, + prefix != NULL ? prefix : "", + timept / (1000*60), (timept/1000) % 60); + + return buf; +} + #endif \ No newline at end of file diff --git a/src/main.c b/src/main.c index 4a45237..3e09a8b 100644 --- a/src/main.c +++ b/src/main.c @@ -61,6 +61,8 @@ GtkWidget *player_widget, *playpause_button, *volume_button; +GtkWidget *player_window_statusbar; + GtkWidget *transcript_table, *transcript_wizard_widget, *transcript_proband_widget, @@ -95,6 +97,24 @@ help_menu_about_item_activate_cb(GtkWidget *widget, gtk_widget_hide(widget); } +/** @private */ +void +player_widget_length_changed_cb(GtkWidget *widget, gint64 new_length, + gpointer data __attribute__((unused))) +{ + gtk_label_set_text(GTK_LABEL(widget), + format_timepoint("Length: ", new_length)); +} + +/** @private */ +void +player_widget_time_changed_cb(GtkWidget *widget, gint64 new_time, + gpointer data __attribute__((unused))) +{ + gtk_label_set_text(GTK_LABEL(widget), + format_timepoint("Time: ", new_time)); +} + /** @private */ void playpause_button_clicked_cb(GtkWidget *widget, gpointer data) @@ -381,6 +401,8 @@ main(int argc, char *argv[]) BUILDER_INIT(builder, playpause_button); BUILDER_INIT(builder, volume_button); + BUILDER_INIT(builder, player_window_statusbar); + BUILDER_INIT(builder, quickopen_menu); BUILDER_INIT(builder, quickopen_menu_empty_item); -- cgit v1.2.3