core/audio: Trigger queue updates when changing tracks

I need to do this for temporary queues in addition to the collection for
bolding to work properly.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-06-07 08:59:43 -04:00
parent b2a61a60f3
commit a89aa5a201
3 changed files with 17 additions and 3 deletions

View File

@ -37,6 +37,7 @@ static bool __audio_change_state(GstState state)
/* Load a track, but don't add it to the history. */
static struct track *__audio_load_basic(struct track *track, GstState state)
{
struct track *prev = audio_track;
gchar *path, *uri;
if (!track)
@ -51,6 +52,10 @@ static struct track *__audio_load_basic(struct track *track, GstState state)
audio_ops->on_load(track);
__audio_change_state(state);
tempq_updated(prev);
queue_updated(collection_get_queue(), prev);
queue_updated(collection_get_queue(), audio_track);
__audio_save();
g_free(uri);
g_free(path);
@ -202,10 +207,8 @@ struct track *audio_prev()
struct track *audio_eos()
{
/* Mark current track as played */
if (audio_track) {
if (audio_track)
track_played(audio_track);
queue_updated(collection_get_queue(), audio_track);
}
/* Check pause count and pick the next track */
if (audio_pause_count >= 0) {

View File

@ -152,3 +152,11 @@ unsigned int tempq_count()
{
return g_slist_length(tempq_list);
}
void tempq_updated(struct track *track)
{
GSList *cur;
for (cur = tempq_list; cur; cur = g_slist_next(cur))
queue_updated((struct queue *)cur->data, track);
}

View File

@ -45,4 +45,7 @@ struct track *tempq_next();
/* Called to find the number of temporary queues currently allocated. */
unsigned int tempq_count();
/* Called to tell temporary queues that a track has been updated. */
void tempq_updated(struct track *);
#endif /* OCARINA_CORE_DECK_H */