diff --git a/gui/controls.cpp b/gui/controls.cpp index 866ec539..7527e739 100644 --- a/gui/controls.cpp +++ b/gui/controls.cpp @@ -7,6 +7,8 @@ #include static Gtk::Label *o_position; +static Gtk::Button *o_play_button; +static Gtk::Button *o_pause_button; static Glib::RefPtr o_pos_bar; static inline bool audio_playing() @@ -14,19 +16,15 @@ static inline bool audio_playing() return driver :: get_driver()->is_playing(); } - -static void hide_show_buttons(const std::string &hide, const std::string &show) -{ - lib :: get_widget(hide)->hide(); - lib :: get_widget(show)->show(); -} - void o_fix_buttons() { - if (audio_playing()) - hide_show_buttons("o_play", "o_pause"); - else - hide_show_buttons("o_pause", "o_play"); + if (audio_playing()) { + o_play_button->hide(); + o_pause_button->show(); + } else { + o_play_button->show(); + o_pause_button->hide(); + } } /* @@ -84,6 +82,9 @@ void controls_init() o_position = lib :: get_widget("o_cur_position"); o_pos_bar = lib :: get_object("o_progress"); + o_play_button = lib :: get_widget("o_play"); + o_pause_button = lib :: get_widget("o_pause"); + pos_scale->signal_change_value().connect(sigc::ptr_fun(o_seek)); connect_button("o_play", o_play); connect_button("o_pause", o_pause);