diff --git a/gui/gst.cpp b/gui/gst.cpp index dbab72b0..13735941 100644 --- a/gui/gst.cpp +++ b/gui/gst.cpp @@ -124,6 +124,8 @@ static gboolean on_gst_message(GstBus *bus, GstMessage *message, gpointer data) break; case GST_MESSAGE_EOS: gst_driver->eos(); + on_pause_count_changed(audio :: pause_enabled(), + audio :: pause_count()); break; default: break; diff --git a/gui/gui.cpp b/gui/gui.cpp index fec0d712..3ec6fcaa 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -2,7 +2,6 @@ * Copyright 2014 (c) Anna Schumaker. */ #include -#include #include #include #include @@ -16,20 +15,24 @@ static sigc::connection fav_connection; static sigc::connection ban_connection; +Gtk::SpinButton *count; +Gtk::CheckButton *enabled; /* * Control functions */ -static void on_config_pause() +static void on_config_pause_enabled() { - Gtk::SpinButton *count = lib :: get_widget("o_pause_count"); - Gtk::CheckButton *enabled = lib :: get_widget("o_pause_enabled"); - audio :: pause_after(enabled->get_active(), count->get_value()); } +static void on_config_pause_count() +{ + enabled->set_active(true); +} + static void set_label_text(Gtk::Label *label, const std::string &size, const std::string &text) { @@ -64,7 +67,7 @@ void on_track_loaded(Track *track) fav_connection.unblock(); } -static void on_pause_count_changed(bool enabled, unsigned int count) +void on_pause_count_changed(bool enabled, unsigned int count) { Gtk::CheckButton *p_enabled = lib :: get_widget("o_pause_enabled"); Gtk::SpinButton *p_count = lib :: get_widget("o_pause_count");; @@ -108,16 +111,12 @@ void connect_button(const std::string &name, void (*func)()) Gtk::Window *setup_gui() { - struct Callbacks *cb = get_callbacks(); - /* Controls */ - Gtk::SpinButton *count = lib :: get_widget("o_pause_count"); - Gtk::CheckButton *enabled = lib :: get_widget("o_pause_enabled"); + count = lib :: get_widget("o_pause_count"); + enabled = lib :: get_widget("o_pause_enabled"); - cb->on_pause_count_changed = on_pause_count_changed; - - count->signal_changed().connect(sigc::ptr_fun(on_config_pause)); - enabled->signal_toggled().connect(sigc::ptr_fun(on_config_pause)); + count->signal_changed().connect(sigc::ptr_fun(on_config_pause_count)); + enabled->signal_toggled().connect(sigc::ptr_fun(on_config_pause_enabled)); /* Favorite and ban buttons */ diff --git a/include/gui/ocarina.h b/include/gui/ocarina.h index 6b4f18db..8bc61237 100644 --- a/include/gui/ocarina.h +++ b/include/gui/ocarina.h @@ -18,6 +18,7 @@ Gtk::Window *ocarina_init(int *, char ***); /* gui.cpp */ void connect_button(const std::string &, void (*func)()); +void on_pause_count_changed(bool, unsigned int); Gtk::Window *setup_gui(); void on_pq_created(Queue *, unsigned int);