gui/playlist: Add Queued Tracks playlist

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-05-18 07:57:07 -04:00 committed by Anna Schumaker
parent eb1361248d
commit 017da02827
2 changed files with 14 additions and 1 deletions

View File

@ -181,6 +181,8 @@ static void *__playlist_init(struct queue *queue, void *data)
if (string_match(playlist->pl_name, "Collection"))
flags = GQ_CAN_RANDOM;
if (string_match(playlist->pl_name, "Queued Tracks"))
flags = GQ_CAN_RANDOM | GQ_CAN_REPEAT;
if (p_init_done && playlist->pl_type == PL_ARTIST)
gui_playlist_add_artist(artist_find(playlist->pl_name));
return gui_queue_alloc(playlist, queue, playlist->pl_name, flags);
@ -203,7 +205,8 @@ static bool __playlist_erase(struct queue *queue, struct track *track)
if (string_match(gui_playlist_cur(), "Collection"))
playlist_add(PL_SYSTEM, "Hidden", track);
else if (string_match(gui_playlist_cur(), "Favorites") ||
string_match(gui_playlist_cur(), "Hidden"))
string_match(gui_playlist_cur(), "Hidden") ||
string_match(gui_playlist_cur(), "Queued Tracks"))
playlist_remove(PL_SYSTEM, gui_playlist_cur(), track);
return false;
}
@ -231,6 +234,10 @@ void gui_playlist_init()
treeview = GTK_TREE_VIEW(gui_builder_widget("o_playlist_view"));
selection = gtk_tree_view_get_selection(treeview);
gtk_tree_store_insert(p_store, &parent, NULL, -1);
__playlist_set(&parent, "Queued Tracks", "audio-x-generic", PL_SYSTEM);
__playlist_set_size(&parent, "Queued Tracks");
gtk_tree_store_insert(p_store, &parent, NULL, -1);
__playlist_set(&parent, "Collection", "media-optical", PL_SYSTEM);
__playlist_set_size(&parent, "Collection");

View File

@ -29,6 +29,12 @@ static void test_playlist_sidebar()
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_selection_select_path(selection, path);
g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1);
g_assert_cmpstr(gui_playlist_cur(), ==, "Queued Tracks");
gtk_tree_path_next(path);
gtk_tree_selection_select_path(selection, path);
g_assert_cmpuint(gtk_tree_selection_count_selected_rows(selection), ==, 1);
gtk_tree_selection_unselect_all(selection);
g_assert_cmpstr(gui_playlist_cur(), ==, "Collection");
gtk_tree_path_next(path);