core/queue: Remove Q_NO_SORT

This flag was only used by the History playlist, but we have a noop
function to handle this instead.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-09-07 09:21:31 -04:00
parent 186367afe0
commit 7e3e4194f3
5 changed files with 4 additions and 21 deletions

View File

@ -229,8 +229,7 @@ static struct sys_playlist sys_collection = {
static void sys_pl_history_init(struct playlist *playlist,
unsigned int flags, struct queue_ops *ops)
{
queue_init(&playlist->pl_queue,
Q_ENABLED | Q_REPEAT | Q_ADD_FRONT | Q_NO_SORT,
queue_init(&playlist->pl_queue, Q_ENABLED | Q_REPEAT | Q_ADD_FRONT,
ops, playlist);
}

View File

@ -365,8 +365,6 @@ void queue_sort(struct queue *queue, enum compare_t sort, bool reset)
GSList *cur = NULL;
int field;
if (queue_has_flag(queue, Q_NO_SORT))
return;
if (reset) {
g_slist_free(queue->q_sort);
queue->q_sort = NULL;

View File

@ -18,13 +18,13 @@ enum queue_flags {
Q_ENABLED = (1 << 0), /* Queue is enabled. */
Q_RANDOM = (1 << 1), /* Queue will pick songs randomly. */
Q_REPEAT = (1 << 2), /* Queue will not remove songs when picked. */
Q_NO_SORT = (1 << 3), /* Queue will not be sorted. */
Q_UNUSED_3 = (1 << 3), /* Removed: 6.5.4 */
Q_UNUSED_4 = (1 << 4), /* Removed: 6.5.4 */
Q_UNUSED_5 = (1 << 5), /* Removed: 6.5.4 */
Q_ADD_FRONT = (1 << 6), /* Queue will add new tracks at the front. */
};
#define Q_UNUSED_MASK (~(Q_UNUSED_4 | Q_UNUSED_5))
#define Q_UNUSED_MASK (~(Q_UNUSED_3 | Q_UNUSED_4 | Q_UNUSED_5))
struct queue_ops {

View File

@ -173,7 +173,6 @@ static void test_queued()
g_assert_nonnull(queue);
g_assert_false(queue_has_flag(queue, Q_ADD_FRONT));
g_assert_false(queue_has_flag(queue, Q_NO_SORT));
g_assert_false(queue_has_flag(queue, Q_REPEAT));
g_assert_cmpuint(g_slist_length(queue->q_sort), ==, 0);
@ -232,7 +231,6 @@ static void test_history()
g_assert_nonnull(queue);
g_assert_true(queue_has_flag(queue, Q_ADD_FRONT));
g_assert_true(queue_has_flag(queue, Q_NO_SORT));
g_assert_true(queue_has_flag(queue, Q_REPEAT));
__test_playlist_id("History", SYS_PL_HISTORY);
__test_playlist_noselect("History");

View File

@ -115,7 +115,7 @@ static void test_flags()
g_assert_false(queue_has_flag(&q, Q_ENABLED));
g_assert_false(queue_has_flag(&q, Q_RANDOM));
g_assert_false(queue_has_flag(&q, Q_REPEAT));
g_assert_false(queue_has_flag(&q, Q_NO_SORT));
g_assert_false(queue_has_flag(&q, Q_UNUSED_3));
g_assert_false(queue_has_flag(&q, Q_UNUSED_4));
g_assert_false(queue_has_flag(&q, Q_UNUSED_5));
g_assert_false(queue_has_flag(&q, Q_ADD_FRONT));
@ -129,18 +129,15 @@ static void test_flags()
queue_set_flag(&q, Q_ENABLED);
queue_set_flag(&q, Q_RANDOM);
queue_set_flag(&q, Q_REPEAT);
queue_set_flag(&q, Q_NO_SORT);
queue_set_flag(&q, Q_ADD_FRONT);
g_assert_true(queue_has_flag(&q, Q_ENABLED));
g_assert_true(queue_has_flag(&q, Q_RANDOM));
g_assert_true(queue_has_flag(&q, Q_REPEAT));
g_assert_true(queue_has_flag(&q, Q_NO_SORT));
g_assert_true(queue_has_flag(&q, Q_ADD_FRONT));
queue_unset_flag(&q, Q_ENABLED);
queue_unset_flag(&q, Q_RANDOM);
queue_unset_flag(&q, Q_REPEAT);
queue_unset_flag(&q, Q_NO_SORT);
queue_unset_flag(&q, Q_ADD_FRONT);
g_assert_cmpuint(q.q_flags, ==, 0);
}
@ -386,15 +383,6 @@ static void test_sorting()
g_assert_cmpuint(track->tr_track, ==, ex_count[i]);
}
queue_set_flag(&q, Q_NO_SORT);
queue_sort(&q, COMPARE_TITLE, true);
for (i = 0; i < 13; i++) {
track = queue_at(&q, i);
g_assert_nonnull(track);
g_assert_cmpuint(track->tr_track, ==, ex_count[i]);
}
queue_unset_flag(&q, Q_NO_SORT);
queue_sort(&q, COMPARE_TITLE, true);
for (i = 0; i < 13; i++) {
track = queue_at(&q, i);