From 47ab4c4b17c802c1d8a119b5bb656fa5fb4b8e6c Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 23 Oct 2015 14:19:42 -0400 Subject: [PATCH] core/tags/library: Move library_set_enabled() out of the library struct Signed-off-by: Anna Schumaker --- core/library.cpp | 2 +- core/tags/library.cpp | 12 ++++++------ include/core/tags/library.h | 10 +++------- tests/core/tags/library.cpp | 2 +- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/core/library.cpp b/core/library.cpp index 51111526..2ceeebcc 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -225,7 +225,7 @@ void collection :: set_enabled(struct library *library, bool enabled) if (!library || (library->enabled() == enabled)) return; - library->set_enabled(enabled); + library_set_enabled(library, enabled); for (unsigned int i = 0; i < tags :: track_size(); i++) { track = tags :: get_track(i); diff --git a/core/tags/library.cpp b/core/tags/library.cpp index 44da68e0..c10f8dab 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -45,12 +45,6 @@ const bool library :: enabled() return li_enabled; } -void library :: set_enabled(bool enabled) -{ - li_enabled = enabled; - db_save(&library_db); -} - const unsigned int library :: size() { return li_size; @@ -98,3 +92,9 @@ void library_remove(struct library *library) if (library) db_remove(&library_db, library); } + +void library_set_enabled(struct library *library, bool enabled) +{ + library->li_enabled = enabled; + db_save(&library_db); +} diff --git a/include/core/tags/library.h b/include/core/tags/library.h index 963589f0..ca0240f6 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -61,13 +61,6 @@ struct library : public DatabaseEntry { */ 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. * @@ -105,4 +98,7 @@ struct library *library_get(const unsigned int); /* Called to remove a specific library tag. */ 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 */ diff --git a/tests/core/tags/library.cpp b/tests/core/tags/library.cpp index 377f5718..7883abee 100644 --- a/tests/core/tags/library.cpp +++ b/tests/core/tags/library.cpp @@ -32,7 +32,7 @@ static void test_library() struct library *library = new struct library(); file f; - link->set_enabled(false); + library_set_enabled(link, false); test_verify_link(link); test_verify_zelda(zelda); test_verify_empty(library);