gui: Move remaining buttons into gstreamer code

These buttons directly affect audio playback, so let's move them with
the rest of the audio buttons.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-01-14 08:21:07 -05:00
parent 9d84fdb8b7
commit e539a2d208
6 changed files with 34 additions and 31 deletions

View File

@ -28,30 +28,10 @@ void o_toggle()
audio :: play();
}
void o_next()
{
audio :: next();
audio :: play();
}
bool o_seek(Gtk::ScrollType type, double value)
{
audio :: seek_to(value);
return true;
}
void controls_init()
{
Gtk::Scale *pos_scale = lib :: get_widget<Gtk::Scale>("o_position_scale");
o_position = lib :: get_widget<Gtk::Label>("o_cur_position");
o_pos_bar = lib :: get_object<Gtk::Adjustment>("o_progress");
pos_scale->signal_change_value().connect(sigc::ptr_fun(o_seek));
connect_button("o_stop", audio::stop);
connect_button("o_prev", audio::prev);
connect_button("o_next", o_next);
lib :: schedule(on_timeout, 500);
}

View File

@ -12,8 +12,13 @@
static GstBus *gst_bus;
static GstElement *gst_player;
static Gtk::Button *o_play;
static Gtk::Button *o_next;
static Gtk::Button *o_pause;
static Gtk::Button *o_play;
static Gtk::Button *o_prev;
static Gtk::Scale *o_seek;
static Gtk::Button *o_stop;
static bool gst_change_state(GstState state)
@ -133,6 +138,18 @@ static gboolean on_gst_message(GstBus *bus, GstMessage *message, gpointer data)
return TRUE;
}
void on_next()
{
audio :: next();
audio :: play();
}
static bool on_seek(Gtk::ScrollType type, double value)
{
audio :: seek_to(value);
return true;
}
void init_gst(int *argc, char ***argv)
{
@ -142,12 +159,21 @@ void init_gst(int *argc, char ***argv)
gst_bus = gst_pipeline_get_bus(GST_PIPELINE(gst_player));
gst_driver = new GSTDriver();
o_play = lib :: get_widget<Gtk::Button>("o_play");
o_next = lib :: get_widget<Gtk::Button>("o_next");
o_pause = lib :: get_widget<Gtk::Button>("o_pause");
o_play = lib :: get_widget<Gtk::Button>("o_play");
o_prev = lib :: get_widget<Gtk::Button>("o_prev");
o_seek = lib :: get_widget<Gtk::Scale>("o_seek");
o_stop = lib :: get_widget<Gtk::Button>("o_stop");
o_next->signal_clicked().connect(sigc::ptr_fun(on_next));
o_pause->signal_clicked().connect(sigc::ptr_fun(audio :: pause));
o_play->signal_clicked().connect(sigc::ptr_fun(audio :: play));
o_prev->signal_clicked().connect(sigc::ptr_fun(audio :: prev));
o_seek->signal_change_value().connect(sigc::ptr_fun(on_seek));
o_stop->signal_clicked().connect(sigc::ptr_fun(audio :: stop));
gst_bus_add_watch(gst_bus, on_gst_message, NULL);
o_play->signal_clicked().connect(sigc::ptr_fun(audio :: play));
o_pause->signal_clicked().connect(sigc::ptr_fun(audio :: pause));
}
void quit_gst()

View File

@ -83,7 +83,7 @@ static void on_ban_toggled()
if (ban->get_active() == true) {
playlist :: add(audio :: current_track(), "Banned");
o_next();
on_next();
} else
playlist :: del(audio::current_track(), "Banned");
}

View File

@ -36,7 +36,7 @@ static bool on_window_key_pressed(GdkEventKey *event)
else if (key == "m")
notebook->set_current_page(deck::get_queues().size() + 3);
else if (key == "n")
o_next();
on_next();
else if (key == "N")
audio :: prev();
else if (key == "p")

View File

@ -4,11 +4,8 @@
#ifndef OCARINA_GUI_CONTROLS_H
#define OCARINA_GUI_CONTROLS_H
void o_fix_buttons();
void o_toggle();
void o_next();
void o_seek();
void on_next();
void controls_init();

View File

@ -1350,7 +1350,7 @@ Manager</property>
</packing>
</child>
<child>
<object class="GtkScale" id="o_position_scale">
<object class="GtkScale" id="o_seek">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="adjustment">o_progress</property>