aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-14 20:10:15 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-14 20:10:15 +0200
commit25acc644932fc8629941a8d9d96d253e15b393a2 (patch)
tree725a1a569596be73bb6d2c47a4476cf5d663666b /src
parenta202984cc9fdedb6ced326653b6790890211ae60 (diff)
downloadexperiment-player-25acc644932fc8629941a8d9d96d253e15b393a2.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/default.ui38
-rw-r--r--src/experiment-player.h16
-rw-r--r--src/main.c22
3 files changed, 76 insertions, 0 deletions
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 @@
<child>
<object class="GtkVlcPlayer" id="player_widget">
<property name="visible">True</property>
+ <signal name="time_changed" handler="player_widget_time_changed_cb" object="player_window_statusbar_time"/>
+ <signal name="length_changed" handler="player_widget_length_changed_cb" object="player_window_statusbar_length"/>
</object>
<packing>
<property name="position">1</property>
@@ -237,6 +239,42 @@ audio-volume-medium</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkStatusbar" id="player_window_statusbar">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkLabel" id="player_window_statusbar_time">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Time: 0:00</property>
+ <property name="width_chars">15</property>
+ <property name="single_line_mode">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="player_window_statusbar_length">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Length: 0:00</property>
+ <property name="width_chars">15</property>
+ <property name="single_line_mode">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
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,
@@ -97,6 +99,24 @@ help_menu_about_item_activate_cb(GtkWidget *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)
{
gboolean is_playing = gtk_vlc_player_toggle(GTK_VLC_PLAYER(widget));
@@ -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);