ocarina: Added a rewind button

Pressing the rewind button rewinds the song by 5 seconds.
This commit is contained in:
Bryan Schumaker 2011-09-03 23:06:13 -04:00
parent ded2c559af
commit c2c3a1eea9
3 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,7 @@ using namespace std;
#include <ocarina/button.h>
#include <libsaria/controls.h>
#include <libsaria/progress.h>
static list<GtkWidget *> play_buttons;
static list<GtkWidget *> pause_buttons;
@ -77,4 +78,15 @@ GtkWidget *make_stop_button(GtkIconSize size)
true);
}
static void on_click_rewind(GtkWidget *b, GdkEvent *e, gpointer d)
{
libsaria_seek(-5);
}
GtkWidget *make_rewind_button(GtkIconSize size)
{
return make_button(GTK_STOCK_MEDIA_REWIND,
size,
on_click_rewind,
true);
}

View File

@ -9,6 +9,7 @@
void ocarina_init(int argc, char **argv)
{
GtkWidget *open;
GtkWidget *rewind;
GtkWidget *play;
GtkWidget *pause;
GtkWidget *stop;
@ -21,12 +22,14 @@ void ocarina_init(int argc, char **argv)
hbox = gtk_hbox_new(FALSE, 0);
open = make_open_button(GTK_ICON_SIZE_MENU);
rewind = make_rewind_button(GTK_ICON_SIZE_MENU);
play = make_play_button(GTK_ICON_SIZE_MENU);
pause = make_pause_button(GTK_ICON_SIZE_MENU);
stop = make_stop_button(GTK_ICON_SIZE_MENU);
volume = make_volume_button();
box_pack_start(hbox, open, FALSE, FALSE, 0);
box_pack_start(hbox, rewind, FALSE, FALSE, 0);
box_pack_start(hbox, play, FALSE, FALSE, 0);
box_pack_start(hbox, pause , FALSE, FALSE, 0);
box_pack_start(hbox, stop, FALSE, FALSE, 0);

View File

@ -14,6 +14,8 @@ GtkWidget *make_button(const gchar *stockid,
GtkWidget *make_play_button(GtkIconSize);
GtkWidget *make_pause_button(GtkIconSize);
GtkWidget *make_stop_button(GtkIconSize);
GtkWidget *make_rewind_button(GtkIconSize);
GtkWidget *make_open_button(GtkIconSize);
GtkWidget *make_volume_button();