core/playlist: Add playlist_callbacks struct
This will be used to gradually phase out the queue_ops struct over the next several patches. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
93cb7145e6
commit
a87373f335
|
@ -28,7 +28,7 @@ void core_init(int *argc, char ***argv, struct core_init_data *init)
|
||||||
idle_init();
|
idle_init();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(init->playlist_ops);
|
playlist_init(init->playlist_ops, init->playlist_cb);
|
||||||
audio_init(argc, argv, init->audio_ops);
|
audio_init(argc, argv, init->audio_ops);
|
||||||
|
|
||||||
idle_schedule(IDLE_SYNC, core_defragment, NULL);
|
idle_schedule(IDLE_SYNC, core_defragment, NULL);
|
||||||
|
|
|
@ -33,8 +33,9 @@ static struct playlist *__playlist_saved(const gchar *s_type, const gchar *s_id)
|
||||||
return playlist_types[type]->pl_get(id);
|
return playlist_types[type]->pl_get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void playlist_init(struct queue_ops *ops)
|
void playlist_init(struct queue_ops *ops, struct playlist_callbacks *cb)
|
||||||
{
|
{
|
||||||
|
playlist_generic_set_callbacks(cb);
|
||||||
pl_system_init(ops);
|
pl_system_init(ops);
|
||||||
pl_artist_init(ops);
|
pl_artist_init(ops);
|
||||||
pl_user_init(ops);
|
pl_user_init(ops);
|
||||||
|
|
|
@ -4,10 +4,14 @@
|
||||||
#include <core/idle.h>
|
#include <core/idle.h>
|
||||||
#include <core/playlists/generic.h>
|
#include <core/playlists/generic.h>
|
||||||
|
|
||||||
|
static struct playlist_callbacks *callbacks = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
void playlist_generic_set_callbacks(struct playlist_callbacks *cb)
|
||||||
|
{
|
||||||
|
callbacks = cb;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Generic playlist operations.
|
|
||||||
*/
|
|
||||||
void playlist_generic_init(struct playlist *playlist, unsigned int flags,
|
void playlist_generic_init(struct playlist *playlist, unsigned int flags,
|
||||||
struct queue_ops *ops)
|
struct queue_ops *ops)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,8 +32,9 @@ const static gchar *OCARINA_APP = "org.gtk.ocarina-debug";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct core_init_data init_data = {
|
struct core_init_data init_data = {
|
||||||
&playlist_ops,
|
.playlist_cb = &playlist_cb,
|
||||||
&audio_ops,
|
.playlist_ops = &playlist_ops,
|
||||||
|
.audio_ops = &audio_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int startup_argc;
|
static int startup_argc;
|
||||||
|
|
|
@ -75,6 +75,9 @@ struct queue_ops playlist_ops = {
|
||||||
.qop_updated = __gui_playlist_updated,
|
.qop_updated = __gui_playlist_updated,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct playlist_callbacks playlist_cb = {
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void __gui_playlist_add_selected_to(struct playlist *playlist)
|
static void __gui_playlist_add_selected_to(struct playlist *playlist)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
struct core_init_data {
|
struct core_init_data {
|
||||||
|
struct playlist_callbacks *playlist_cb;
|
||||||
struct queue_ops *playlist_ops;
|
struct queue_ops *playlist_ops;
|
||||||
struct audio_ops *audio_ops;
|
struct audio_ops *audio_ops;
|
||||||
#ifdef CONFIG_TESTING
|
#ifdef CONFIG_TESTING
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Called to initialize the playlist manager. */
|
/* Called to initialize the playlist manager. */
|
||||||
void playlist_init(struct queue_ops *);
|
void playlist_init(struct queue_ops *, struct playlist_callbacks *);
|
||||||
|
|
||||||
/* Called to deinitialize the playlist manager. */
|
/* Called to deinitialize the playlist manager. */
|
||||||
void playlist_deinit();
|
void playlist_deinit();
|
||||||
|
|
|
@ -5,6 +5,13 @@
|
||||||
#define OCARINA_CORE_PLAYLISTS_GENERIC_H
|
#define OCARINA_CORE_PLAYLISTS_GENERIC_H
|
||||||
#include <core/playlists/playlist.h>
|
#include <core/playlists/playlist.h>
|
||||||
|
|
||||||
|
struct playlist_callbacks {
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Called to set playlist callbacks. */
|
||||||
|
void playlist_generic_set_callbacks(struct playlist_callbacks *);
|
||||||
|
|
||||||
/* Generic playlist init function. */
|
/* Generic playlist init function. */
|
||||||
void playlist_generic_init(struct playlist *, unsigned int, struct queue_ops *);
|
void playlist_generic_init(struct playlist *, unsigned int, struct queue_ops *);
|
||||||
|
|
||||||
|
|
|
@ -28,5 +28,7 @@ static inline GtkMenuItem *gui_rc_add_to_other()
|
||||||
/* Playlist operations passed to core_init() */
|
/* Playlist operations passed to core_init() */
|
||||||
extern struct queue_ops playlist_ops;
|
extern struct queue_ops playlist_ops;
|
||||||
|
|
||||||
|
/* Playlist callbacks passed to core_init() */
|
||||||
|
extern struct playlist_callbacks playlist_cb;
|
||||||
|
|
||||||
#endif /* OCARINA_GUI_PLAYLIST_H */
|
#endif /* OCARINA_GUI_PLAYLIST_H */
|
||||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, char **argv)
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(NULL);
|
playlist_init(NULL, NULL);
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
library = library_find("tests/Music");
|
library = library_find("tests/Music");
|
||||||
|
|
|
@ -63,7 +63,7 @@ int main(int argc, char **argv)
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(NULL);
|
playlist_init(NULL, NULL);
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
/* Add tracks to the collection. */
|
/* Add tracks to the collection. */
|
||||||
|
|
|
@ -113,7 +113,7 @@ int main(int argc, char **argv)
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(NULL);
|
playlist_init(NULL, NULL);
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
|
|
@ -362,7 +362,7 @@ int main(int argc, char **argv)
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(NULL);
|
playlist_init(NULL, NULL);
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
g_test_init(&argc, &argv, NULL);
|
||||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
||||||
idle_init_sync();
|
idle_init_sync();
|
||||||
settings_init();
|
settings_init();
|
||||||
tags_init();
|
tags_init();
|
||||||
playlist_init(NULL);
|
playlist_init(NULL, NULL);
|
||||||
while (idle_run_task()) {};
|
while (idle_run_task()) {};
|
||||||
|
|
||||||
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
playlist_new(PL_LIBRARY, "tests/Music/Hyrule Symphony");
|
||||||
|
|
Loading…
Reference in New Issue