gui: Generic toggle button function
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
73c4de13be
commit
bfcc94de21
18
gui/tabs.cpp
18
gui/tabs.cpp
|
@ -67,6 +67,14 @@ void Tab :: tab_init_repeat()
|
|||
&Tab::on_repeat_toggled));
|
||||
}
|
||||
|
||||
void Tab :: tab_toggle_button(Gtk::ToggleButton *button, playqueue_flags flag)
|
||||
{
|
||||
if (button->get_active())
|
||||
tab_pq->set_flag(flag);
|
||||
else
|
||||
tab_pq->unset_flag(flag);
|
||||
}
|
||||
|
||||
int Tab :: tab_page_num()
|
||||
{
|
||||
Gtk::Notebook *notebook = get_widget<Gtk::Notebook>("o_notebook");
|
||||
|
@ -174,18 +182,12 @@ bool Tab :: on_key_press_event(const std::string &key)
|
|||
|
||||
void Tab :: on_random_toggled()
|
||||
{
|
||||
if (tab_random->get_active())
|
||||
tab_pq->set_flag(PQ_RANDOM);
|
||||
else
|
||||
tab_pq->unset_flag(PQ_RANDOM);
|
||||
tab_toggle_button(tab_random, PQ_RANDOM);
|
||||
}
|
||||
|
||||
void Tab :: on_repeat_toggled()
|
||||
{
|
||||
if (tab_repeat->get_active())
|
||||
tab_pq->set_flag(PQ_REPEAT);
|
||||
else
|
||||
tab_pq->unset_flag(PQ_REPEAT);
|
||||
tab_toggle_button(tab_repeat, PQ_REPEAT);
|
||||
}
|
||||
|
||||
void Tab :: on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
|
||||
|
|
|
@ -38,6 +38,7 @@ protected:
|
|||
*/
|
||||
void tab_init_random();
|
||||
void tab_init_repeat();
|
||||
void tab_toggle_button(Gtk::ToggleButton *, playqueue_flags);
|
||||
bool tab_is_cur();
|
||||
virtual void tab_set_size();
|
||||
void tab_unmap();
|
||||
|
|
Loading…
Reference in New Issue