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:
Anna Schumaker 2015-10-23 14:19:42 -04:00
parent f41235e5b2
commit 47ab4c4b17
4 changed files with 11 additions and 15 deletions

View File

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

View File

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

View File

@ -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 */

View File

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