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:
parent
cfeca9ae4b
commit
6e02f75262
|
@ -11,9 +11,10 @@ static struct library *__library_alloc(gchar *path, bool enabled)
|
||||||
struct library *library = g_malloc(sizeof(struct library));
|
struct library *library = g_malloc(sizeof(struct library));
|
||||||
|
|
||||||
dbe_init(&library->li_dbe, library);
|
dbe_init(&library->li_dbe, library);
|
||||||
library->li_size = 0;
|
library->li_size = 0;
|
||||||
library->li_enabled = enabled;
|
library->li_enabled = enabled;
|
||||||
library->li_path = path;
|
library->li_path = path;
|
||||||
|
library->li_playlist = NULL;
|
||||||
|
|
||||||
return library;
|
return library;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
#include <core/database.h>
|
#include <core/database.h>
|
||||||
|
|
||||||
struct library {
|
struct library {
|
||||||
unsigned int li_size; /* This library's track count. */
|
unsigned int li_size; /* This library's track count. */
|
||||||
bool li_enabled;/* True if this library is enabled. */
|
bool li_enabled; /* True if this library is enabled. */
|
||||||
gchar *li_path; /* This library's root path. */
|
gchar *li_path; /* This library's root path. */
|
||||||
struct db_entry li_dbe;
|
void *li_playlist; /* This library's associated playlist. */
|
||||||
|
struct db_entry li_dbe;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))
|
#define LIBRARY(dbe) ((struct library *)DBE_DATA(dbe))
|
||||||
|
|
|
@ -9,6 +9,7 @@ static void test_verify_zelda(struct library *library)
|
||||||
const struct db_ops *library_ops = test_library_ops();
|
const struct db_ops *library_ops = test_library_ops();
|
||||||
test_equal(library->li_enabled, (bool)true);
|
test_equal(library->li_enabled, (bool)true);
|
||||||
test_equal(library->li_size, 0);
|
test_equal(library->li_size, 0);
|
||||||
|
test_equal(library->li_playlist, NULL);
|
||||||
test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Zelda/Music");
|
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();
|
const struct db_ops *library_ops = test_library_ops();
|
||||||
test_equal(library->li_enabled, (bool)false);
|
test_equal(library->li_enabled, (bool)false);
|
||||||
test_equal(library->li_size, 0);
|
test_equal(library->li_size, 0);
|
||||||
|
test_equal(library->li_playlist, NULL);
|
||||||
test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Link/Music");
|
test_equal(library_ops->dbe_key(&library->li_dbe), "/home/Link/Music");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue