playqueue: Add a path_selected function

This is called by the GUI to tell the playqueue that a track has been
selected.  This gives the PQ a chance to (possibly) remove it.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-02-06 20:06:58 -05:00 committed by Anna Schumaker
parent 04ffffb4e8
commit 5f582e639b
3 changed files with 11 additions and 1 deletions

View File

@ -58,7 +58,7 @@ void PlayqueueModel::on_row_changed(unsigned int row)
void PlayqueueModel::on_path_selected(const Gtk::TreePath &path)
{
audio :: load_trackid(path_to_id(path));
queue->set_cur(path[0]);
queue->path_selected(path[0]);
audio :: play();
}

View File

@ -73,6 +73,7 @@ public:
unsigned int operator[](unsigned int);
unsigned int next();
void set_cur(unsigned int);
void path_selected(unsigned int);
#ifdef CONFIG_TEST
void reset();
#endif /* CONFIG_TEST */

View File

@ -374,6 +374,15 @@ void Playqueue :: set_cur(unsigned int c)
cur = c;
}
void Playqueue :: path_selected(unsigned int id)
{
cur = id;
if (!(flags &PQ_REPEAT)) {
del(cur);
cur--;
}
}
#ifdef CONFIG_TEST
void Playqueue :: reset()
{