playqueue: Change cur when tracks are directly selected

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-01-29 22:11:03 -05:00 committed by Anna Schumaker
parent e9416e6ace
commit d240ff44bc
4 changed files with 6 additions and 5 deletions

View File

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

View File

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

View File

@ -167,7 +167,7 @@ void audio :: next()
cur_trackid = id; cur_trackid = id;
o_recently_played.add_front(id); o_recently_played.add_front(id);
o_recently_played.reset_cur(); o_recently_played.set_cur(0);
} }
void audio :: previous() void audio :: previous()
@ -198,7 +198,7 @@ void audio :: load_trackid(unsigned int track_id)
cur_trackid = track_id; cur_trackid = track_id;
o_recently_played.add_front(track_id); o_recently_played.add_front(track_id);
o_recently_played.reset_cur(); o_recently_played.set_cur(0);
} }
unsigned int audio :: current_trackid() unsigned int audio :: current_trackid()

View File

@ -361,9 +361,9 @@ unsigned int Playqueue :: next()
return res; return res;
} }
void Playqueue :: reset_cur() void Playqueue :: set_cur(unsigned int c)
{ {
cur = 0; cur = c;
} }
#ifdef CONFIG_TEST #ifdef CONFIG_TEST