gui: Update the repeat button

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-02-23 20:34:52 -05:00 committed by Anna Schumaker
parent 34de6874ff
commit 73c4de13be
3 changed files with 20 additions and 17 deletions

View File

@ -121,6 +121,7 @@ QueueTab :: QueueTab(Playqueue *pq, unsigned int num)
*/ */
tab_random = &q_random; tab_random = &q_random;
tab_repeat = &q_repeat;
tab_search = &q_search; tab_search = &q_search;
tab_size = &q_tab_size; tab_size = &q_tab_size;
tab_treeview = &q_treeview; tab_treeview = &q_treeview;
@ -152,6 +153,7 @@ QueueTab :: ~QueueTab()
void QueueTab :: on_post_init() void QueueTab :: on_post_init()
{ {
tab_init_random(); tab_init_random();
tab_init_repeat();
} }
void QueueTab :: tab_set_size() void QueueTab :: tab_set_size()

View File

@ -60,6 +60,13 @@ void Tab :: tab_init_random()
&Tab::on_random_toggled)); &Tab::on_random_toggled));
} }
void Tab :: tab_init_repeat()
{
tab_repeat->set_active(tab_pq->get_flags() & PQ_REPEAT);
tab_repeat->signal_toggled().connect(sigc::mem_fun(*this,
&Tab::on_repeat_toggled));
}
int Tab :: tab_page_num() int Tab :: tab_page_num()
{ {
Gtk::Notebook *notebook = get_widget<Gtk::Notebook>("o_notebook"); Gtk::Notebook *notebook = get_widget<Gtk::Notebook>("o_notebook");
@ -173,6 +180,14 @@ void Tab :: on_random_toggled()
tab_pq->unset_flag(PQ_RANDOM); tab_pq->unset_flag(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);
}
void Tab :: on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col) void Tab :: on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
{ {
Gtk::TreePath model_path = tab_filter->convert_path_to_child_path(path); Gtk::TreePath model_path = tab_filter->convert_path_to_child_path(path);
@ -549,23 +564,6 @@ void OcarinaPage::setup_columns()
} }
} }
void OcarinaPage::check_pq_flags()
{
if (init_flags & PQ_REPEAT) {
page_repeat.set_active(model->queue->get_flags() & PQ_REPEAT);
page_repeat.signal_toggled().connect(sigc::mem_fun(*this,
&OcarinaPage::on_repeat_toggled));
}
}
void OcarinaPage::on_repeat_toggled()
{
if (page_repeat.get_active())
model->queue->set_flag(PQ_REPEAT);
else
model->queue->unset_flag(PQ_REPEAT);
}
void OcarinaPage::on_column_clicked(unsigned int col_index) void OcarinaPage::on_column_clicked(unsigned int col_index)
{ {
Gtk::Label *sorting; Gtk::Label *sorting;

View File

@ -29,6 +29,7 @@ protected:
* Optional widgets that MAY be set * Optional widgets that MAY be set
*/ */
Gtk::ToggleButton *tab_random; Gtk::ToggleButton *tab_random;
Gtk::ToggleButton *tab_repeat;
Gtk::Label *tab_size; Gtk::Label *tab_size;
@ -36,6 +37,7 @@ protected:
* Class helper functions * Class helper functions
*/ */
void tab_init_random(); void tab_init_random();
void tab_init_repeat();
bool tab_is_cur(); bool tab_is_cur();
virtual void tab_set_size(); virtual void tab_set_size();
void tab_unmap(); void tab_unmap();
@ -66,6 +68,7 @@ public:
* GTK-MM callback functions * GTK-MM callback functions
*/ */
void on_random_toggled(); void on_random_toggled();
void on_repeat_toggled();
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *); void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
bool on_key_pressed(GdkEventKey *key); bool on_key_pressed(GdkEventKey *key);