core/tags/library: Move library_set_enabled() out of the library struct
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
f41235e5b2
commit
47ab4c4b17
|
@ -225,7 +225,7 @@ void collection :: set_enabled(struct library *library, bool enabled)
|
||||||
if (!library || (library->enabled() == enabled))
|
if (!library || (library->enabled() == enabled))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
library->set_enabled(enabled);
|
library_set_enabled(library, enabled);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < tags :: track_size(); i++) {
|
for (unsigned int i = 0; i < tags :: track_size(); i++) {
|
||||||
track = tags :: get_track(i);
|
track = tags :: get_track(i);
|
||||||
|
|
|
@ -45,12 +45,6 @@ const bool library :: enabled()
|
||||||
return li_enabled;
|
return li_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void library :: set_enabled(bool enabled)
|
|
||||||
{
|
|
||||||
li_enabled = enabled;
|
|
||||||
db_save(&library_db);
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned int library :: size()
|
const unsigned int library :: size()
|
||||||
{
|
{
|
||||||
return li_size;
|
return li_size;
|
||||||
|
@ -98,3 +92,9 @@ void library_remove(struct library *library)
|
||||||
if (library)
|
if (library)
|
||||||
db_remove(&library_db, library);
|
db_remove(&library_db, library);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void library_set_enabled(struct library *library, bool enabled)
|
||||||
|
{
|
||||||
|
library->li_enabled = enabled;
|
||||||
|
db_save(&library_db);
|
||||||
|
}
|
||||||
|
|
|
@ -61,13 +61,6 @@ struct library : public DatabaseEntry {
|
||||||
*/
|
*/
|
||||||
const bool enabled();
|
const bool enabled();
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to set if this library path is enabled.
|
|
||||||
*
|
|
||||||
* @param enabled True if this path should be enabled, false otherwise.
|
|
||||||
*/
|
|
||||||
void set_enabled(bool);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to access the number of tracks in this library.
|
* Called to access the number of tracks in this library.
|
||||||
*
|
*
|
||||||
|
@ -105,4 +98,7 @@ struct library *library_get(const unsigned int);
|
||||||
/* Called to remove a specific library tag. */
|
/* Called to remove a specific library tag. */
|
||||||
void library_remove(struct library *);
|
void library_remove(struct library *);
|
||||||
|
|
||||||
|
/* Called to configure if the library tag is enabled. */
|
||||||
|
void library_set_enabled(struct library *, bool);
|
||||||
|
|
||||||
#endif /* OCARINA_CORE_TAGS_LIBRARY_H */
|
#endif /* OCARINA_CORE_TAGS_LIBRARY_H */
|
||||||
|
|
|
@ -32,7 +32,7 @@ static void test_library()
|
||||||
struct library *library = new struct library();
|
struct library *library = new struct library();
|
||||||
file f;
|
file f;
|
||||||
|
|
||||||
link->set_enabled(false);
|
library_set_enabled(link, false);
|
||||||
test_verify_link(link);
|
test_verify_link(link);
|
||||||
test_verify_zelda(zelda);
|
test_verify_zelda(zelda);
|
||||||
test_verify_empty(library);
|
test_verify_empty(library);
|
||||||
|
|
Loading…
Reference in New Issue