From e539a2d208ace9ae8bb305e53b4fe52f2fa654a8 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 14 Jan 2015 08:21:07 -0500 Subject: [PATCH] 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 --- gui/controls.cpp | 20 -------------------- gui/gst.cpp | 34 ++++++++++++++++++++++++++++++---- gui/gui.cpp | 2 +- gui/window.cpp | 2 +- include/gui/controls.h | 5 +---- share/ocarina/ocarina6.glade | 2 +- 6 files changed, 34 insertions(+), 31 deletions(-) diff --git a/gui/controls.cpp b/gui/controls.cpp index aa0a9dfb..5306fde6 100644 --- a/gui/controls.cpp +++ b/gui/controls.cpp @@ -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("o_position_scale"); - o_position = lib :: get_widget("o_cur_position"); o_pos_bar = lib :: get_object("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); } diff --git a/gui/gst.cpp b/gui/gst.cpp index 8e4641ac..bc0d51ef 100644 --- a/gui/gst.cpp +++ b/gui/gst.cpp @@ -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("o_play"); + o_next = lib :: get_widget("o_next"); o_pause = lib :: get_widget("o_pause"); + o_play = lib :: get_widget("o_play"); + o_prev = lib :: get_widget("o_prev"); + o_seek = lib :: get_widget("o_seek"); + o_stop = lib :: get_widget("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() diff --git a/gui/gui.cpp b/gui/gui.cpp index b29f0beb..47409d81 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -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"); } diff --git a/gui/window.cpp b/gui/window.cpp index 0457bca3..442068e2 100644 --- a/gui/window.cpp +++ b/gui/window.cpp @@ -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") diff --git a/include/gui/controls.h b/include/gui/controls.h index 427b7236..33be8bbd 100644 --- a/include/gui/controls.h +++ b/include/gui/controls.h @@ -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(); diff --git a/share/ocarina/ocarina6.glade b/share/ocarina/ocarina6.glade index 7de5029c..9f389549 100644 --- a/share/ocarina/ocarina6.glade +++ b/share/ocarina/ocarina6.glade @@ -1350,7 +1350,7 @@ Manager - + True False o_progress