core/tags/library: Add a pointer to store a playlist

I decided to set this as a void pointer to keep other layers from using
the playlist without our knowledge.  The only user of this variable
should be the playlist code.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-05-06 10:18:28 -04:00 committed by Anna Schumaker
parent cfeca9ae4b
commit 6e02f75262
3 changed files with 11 additions and 7 deletions

View File

@ -11,9 +11,10 @@ static struct library *__library_alloc(gchar *path, bool enabled)
struct library *library = g_malloc(sizeof(struct library));
dbe_init(&library->li_dbe, library);
library->li_size = 0;
library->li_enabled = enabled;
library->li_path = path;
library->li_size = 0;
library->li_enabled = enabled;
library->li_path = path;
library->li_playlist = NULL;
return library;
}

View File

@ -16,10 +16,11 @@
#include <core/database.h>
struct library {
unsigned int li_size; /* This library's track count. */
bool li_enabled;/* True if this library is enabled. */
gchar *li_path; /* This library's root path. */
struct db_entry li_dbe;
unsigned int li_size; /* This library's track count. */
bool li_enabled; /* True if this library is enabled. */
gchar *li_path; /* This library's root path. */
void *li_playlist; /* This library's associated playlist. */
struct db_entry li_dbe;
};
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))

View File

@ -9,6 +9,7 @@ static void test_verify_zelda(struct library *library)
const struct db_ops *library_ops = test_library_ops();
test_equal(library->li_enabled, (bool)true);
test_equal(library->li_size, 0);
test_equal(library->li_playlist, NULL);
test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Zelda/Music");
}
@ -17,6 +18,7 @@ static void test_verify_link(struct library *library)
const struct db_ops *library_ops = test_library_ops();
test_equal(library->li_enabled, (bool)false);
test_equal(library->li_size, 0);
test_equal(library->li_playlist, NULL);
test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Link/Music");
}