core/playlist: Rename playlist_cur() -> playlist_current()

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-09-12 16:02:46 -04:00
parent 5c215df0bf
commit b5c1af263a
11 changed files with 30 additions and 30 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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 = "<b>%s\n%d track%s</b>";
return g_markup_printf_escaped(fmt, playlist->pl_name, size,
(size != 1) ? "s" : "");

View File

@ -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 *);

View File

@ -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)));

View File

@ -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));

View File

@ -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)));

View File

@ -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);
}
}
}

View File

@ -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));

View File

@ -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);
}

View File

@ -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);