diff --git a/core/playlist.c b/core/playlist.c index 229dfbb9..cc38c22a 100644 --- a/core/playlist.c +++ b/core/playlist.c @@ -97,6 +97,11 @@ struct playlist *playlist_get(enum playlist_type_t type, unsigned int id) return playlist_types[type]->pl_get(id); } +struct playlist *playlist_current(void) +{ + return current; +} + bool playlist_select(struct playlist *playlist) { if (!playlist || (playlist == current)) @@ -207,11 +212,6 @@ struct track *playlist_prev(void) return playlist_types[PL_SYSTEM]->pl_next("History"); } -struct playlist *playlist_cur(void) -{ - return current; -} - struct queue *playlist_get_queue(enum playlist_type_t type, const gchar *name) { struct playlist *playlist = playlist_lookup(type, name); diff --git a/gui/playlist.c b/gui/playlist.c index a879697a..a73dadde 100644 --- a/gui/playlist.c +++ b/gui/playlist.c @@ -214,11 +214,11 @@ bool __gui_playlist_button_press(GtkTreeView *treeview, GdkEventButton *event, void __gui_playlist_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) { - struct playlist *prev = playlist_cur(); + struct playlist *prev = playlist_current(); gui_sidebar_filter_path_select(path); __gui_playlist_update_size(prev); - __gui_playlist_update_size(playlist_cur()); + __gui_playlist_update_size(playlist_current()); } void __gui_playlist_row_collapsed(GtkTreeView *treeview, GtkTreeIter *iter, @@ -235,7 +235,7 @@ void __gui_playlist_row_expanded(GtkTreeView *treeview, GtkTreeIter *iter, bool __gui_playlist_init_idle() { - struct playlist *playlist = playlist_cur(); + struct playlist *playlist = playlist_current(); GtkTreeModel *filter = GTK_TREE_MODEL(gui_sidebar_filter()); GtkTreeIter iter; diff --git a/gui/sidebar.c b/gui/sidebar.c index edad8466..615c958b 100644 --- a/gui/sidebar.c +++ b/gui/sidebar.c @@ -24,7 +24,7 @@ static gchar *__gui_sidebar_size_str(struct playlist *playlist) return NULL; size = playlist_size(playlist); - if (playlist_cur() == playlist) + if (playlist_current() == playlist) fmt = "%s\n%d track%s"; return g_markup_printf_escaped(fmt, playlist->pl_name, size, (size != 1) ? "s" : ""); diff --git a/include/core/playlist.h b/include/core/playlist.h index 2aa2dbf5..fd46e065 100644 --- a/include/core/playlist.h +++ b/include/core/playlist.h @@ -36,6 +36,9 @@ bool playlist_delete(struct playlist *); struct playlist *playlist_lookup(enum playlist_type_t, const gchar *); struct playlist *playlist_get(enum playlist_type_t, unsigned int); +/* Called to access the current playlist. */ +struct playlist *playlist_current(void); + /* Called to select the current playlist. */ bool playlist_select(struct playlist *); @@ -75,9 +78,6 @@ struct track *playlist_next(void); struct track *playlist_prev(void); -/* Called to access the current playlist. */ -struct playlist *playlist_cur(void); - /* Called to access the playlist queue. */ struct queue *playlist_get_queue(enum playlist_type_t, const gchar *); diff --git a/tests/core/playlist.c b/tests/core/playlist.c index ebd2b56a..bd1bb984 100644 --- a/tests/core/playlist.c +++ b/tests/core/playlist.c @@ -16,9 +16,9 @@ static void test_null() g_assert_null(playlist_lookup(PL_MAX_TYPE, NULL)); g_assert_null(playlist_get(PL_MAX_TYPE, 0)); - g_assert(playlist_cur() == playlist_lookup(PL_SYSTEM, "Collection")); + g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection")); g_assert_false(playlist_select(NULL)); - g_assert(playlist_cur() == playlist_lookup(PL_SYSTEM, "Collection")); + g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection")); g_assert_false(playlist_add(NULL, NULL)); g_assert_false(playlist_add(NULL, track_get(0))); diff --git a/tests/core/playlists/artist.c b/tests/core/playlists/artist.c index 991b9d41..16bfe3c2 100644 --- a/tests/core/playlists/artist.c +++ b/tests/core/playlists/artist.c @@ -37,11 +37,11 @@ void test_artist() g_assert_false(playlist_remove(playlist, track_get(0))); g_assert_cmpuint(playlist_size(playlist), ==, 2); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); g_assert_true(playlist_select(playlist)); g_assert_cmpuint(settings_get("core.playlist.cur.type"), ==, PL_ARTIST); g_assert_cmpuint(settings_get("core.playlist.cur.id"), ==, 0); - g_assert(playlist_cur() == playlist); + g_assert(playlist_current() == playlist); g_assert_false(playlist_select(playlist)); g_assert_false(playlist_delete(playlist)); diff --git a/tests/core/playlists/library.c b/tests/core/playlists/library.c index f3d19dd3..4f7490f7 100644 --- a/tests/core/playlists/library.c +++ b/tests/core/playlists/library.c @@ -39,11 +39,11 @@ void test_library() ==, 48); playlist = playlist_lookup(PL_LIBRARY, "tests/Music"); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); g_assert_true(playlist_select(playlist)); g_assert_cmpuint(settings_get("core.playlist.cur.type"), ==, PL_LIBRARY); g_assert_cmpuint(settings_get("core.playlist.cur.id"), ==, 0); - g_assert(playlist_cur() == playlist); + g_assert(playlist_current() == playlist); g_assert_false(playlist_select(playlist)); g_assert_false(playlist_add(playlist, track_get(0))); diff --git a/tests/core/playlists/system.c b/tests/core/playlists/system.c index 6cfad071..0e8faf21 100644 --- a/tests/core/playlists/system.c +++ b/tests/core/playlists/system.c @@ -92,7 +92,7 @@ static void test_init() struct playlist *playlist; unsigned int i; - g_assert(playlist_cur() == __test_pl_collection()); + g_assert(playlist_current() == __test_pl_collection()); for (i = 0; i < SYS_PL_NUM_PLAYLISTS; i++) { playlist = playlist_get(PL_SYSTEM, i); @@ -428,11 +428,11 @@ static void test_add() case SYS_PL_QUEUED: g_assert_true( playlist_select(playlist)); g_assert_false(playlist_select(playlist)); - g_assert(playlist_cur() == playlist); + g_assert(playlist_current() == playlist); break; default: g_assert_false(playlist_select(playlist)); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); } } } @@ -496,12 +496,12 @@ static void test_remove() case SYS_PL_QUEUED: case SYS_PL_HISTORY: g_assert_false(playlist_select(playlist)); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); break; default: g_assert_true( playlist_select(playlist)); g_assert_false(playlist_select(playlist)); - g_assert(playlist_cur() == playlist); + g_assert(playlist_current() == playlist); } } } diff --git a/tests/core/playlists/user.c b/tests/core/playlists/user.c index ddcbb362..d9ff272d 100644 --- a/tests/core/playlists/user.c +++ b/tests/core/playlists/user.c @@ -30,9 +30,9 @@ void test_user() g_assert_cmpuint(playlist_get_id(PL_USER, "No Playlist"), ==, (unsigned int)-1); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); g_assert_false(playlist_select(playlist)); - g_assert(playlist_cur() != playlist); + g_assert(playlist_current() != playlist); g_assert_cmpuint(playlist_size(playlist), ==, 0); g_assert_false(playlist_has(playlist, track_get(0))); @@ -42,7 +42,7 @@ void test_user() g_assert_cmpuint(playlist_size(playlist), ==, 1); g_assert_true(playlist_select(playlist)); - g_assert(playlist_cur() == playlist); + g_assert(playlist_current() == playlist); g_assert_false(playlist_select(playlist)); g_assert_false(playlist_select(NULL)); diff --git a/tests/gui/playlist.c b/tests/gui/playlist.c index dcd3413f..6ad76abc 100644 --- a/tests/gui/playlist.c +++ b/tests/gui/playlist.c @@ -28,7 +28,7 @@ static void test_playlist() g_assert_true(gui_sidebar_iter_first(&iter)); path = gtk_tree_model_get_path(gui_sidebar_model(), &iter); gtk_tree_view_row_activated(gui_sidebar_treeview(), path, NULL); - g_assert_true(playlist_cur() == playlist_lookup(PL_SYSTEM, "Collection")); + g_assert_true(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection")); gtk_tree_path_free(path); g_assert_false(settings_has("gui.sidebar.expand.Playlists")); @@ -52,7 +52,7 @@ static void test_playlist() &iter); g_assert_nonnull(path); gtk_tree_view_row_activated(gui_sidebar_treeview(), path, NULL); - g_assert_true(playlist_cur() == playlist_lookup(PL_SYSTEM, "Favorites")); + g_assert_true(playlist_current() == playlist_lookup(PL_SYSTEM, "Favorites")); gtk_tree_path_free(path); } diff --git a/tests/gui/sidebar.c b/tests/gui/sidebar.c index 22b01c46..0df98af1 100644 --- a/tests/gui/sidebar.c +++ b/tests/gui/sidebar.c @@ -125,7 +125,7 @@ static void test_sidebar_selection() playlist_set_random(collection, true); g_assert_true(playlist_select(playlist_lookup(PL_SYSTEM, "Favorites"))); - g_assert(playlist_cur() == playlist_lookup(PL_SYSTEM, "Favorites")); + g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Favorites")); g_assert_true(gui_sidebar_iter_first(&iter)); path = gtk_tree_model_get_path(gui_sidebar_model(), &iter); @@ -157,7 +157,7 @@ static void test_sidebar_selection() } gui_sidebar_filter_path_select(path); - g_assert(playlist_cur() == playlist_lookup(PL_SYSTEM, "Collection")); + g_assert(playlist_current() == playlist_lookup(PL_SYSTEM, "Collection")); gtk_tree_selection_unselect_all(selection); gui_sidebar_iter_next(&iter);