From ac2b4ad52c85340cafb0c3ee46b9a95e3644100b Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 23 Oct 2015 14:10:59 -0400 Subject: [PATCH] core/tags/library: Remove library enabled() function Signed-off-by: Anna Schumaker --- core/library.cpp | 4 ++-- core/tags/library.cpp | 5 ----- gui/manager.cpp | 8 ++++---- include/core/tags/library.h | 7 ------- tests/core/tags/library.cpp | 6 +++--- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/core/library.cpp b/core/library.cpp index 2ceeebcc..2429f354 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -170,7 +170,7 @@ void collection :: init() for (unsigned int i = 0; i < tags :: track_size(); i++) { track = tags :: get_track(i); - if (track && (track->library()->enabled())) + if (track && (track->library()->li_enabled)) library_q.add(track); } } @@ -222,7 +222,7 @@ void collection :: set_enabled(struct library *library, bool enabled) { Track *track; - if (!library || (library->enabled() == enabled)) + if (!library || (library->li_enabled == enabled)) return; library_set_enabled(library, enabled); diff --git a/core/tags/library.cpp b/core/tags/library.cpp index c10f8dab..cd92d45e 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -40,11 +40,6 @@ void library :: write(file &file) file_writef(&file, "%d %s", li_enabled, li_path.c_str()); } -const bool library :: enabled() -{ - return li_enabled; -} - const unsigned int library :: size() { return li_size; diff --git a/gui/manager.cpp b/gui/manager.cpp index a6295271..ce01b1c1 100644 --- a/gui/manager.cpp +++ b/gui/manager.cpp @@ -36,7 +36,7 @@ static void list_path(struct library *lib) if (lib) { row = *(c_list->append()); row[c_cols.c_id] = lib->index(); - row[c_cols.c_enabled] = lib->enabled(); + row[c_cols.c_enabled] = lib->li_enabled; row[c_cols.c_size] = lib->size(); row[c_cols.c_path] = lib->primary_key(); } @@ -164,9 +164,9 @@ static void on_toggled(const Glib::ustring &str) Gtk::TreeModel::Row row; struct library *lib = get_library_and_row(Gtk::TreePath(str), row); - collection :: set_enabled(lib, !lib->enabled()); - row[c_cols.c_enabled] = lib->enabled(); - if (lib->enabled()) + collection :: set_enabled(lib, !lib->li_enabled); + row[c_cols.c_enabled] = lib->li_enabled; + if (lib->li_enabled) remove_banned_tracks(); } diff --git a/include/core/tags/library.h b/include/core/tags/library.h index ca0240f6..904cd135 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -54,13 +54,6 @@ struct library : public DatabaseEntry { void write(file &); - /** - * Called to check if this library path is currently enabled. - * - * @return Library::_enabled. - */ - const bool enabled(); - /** * Called to access the number of tracks in this library. * diff --git a/tests/core/tags/library.cpp b/tests/core/tags/library.cpp index 7883abee..d6fd7fd7 100644 --- a/tests/core/tags/library.cpp +++ b/tests/core/tags/library.cpp @@ -7,21 +7,21 @@ static void test_verify_empty(struct library *library) { test_equal(library->primary_key(), ""); - test_equal(library->enabled(), false); + test_equal(library->li_enabled, false); test_equal(library->size(), 0); } static void test_verify_zelda(struct library *library) { test_equal(library->primary_key(), "/home/Zelda/Music"); - test_equal(library->enabled(), true); + test_equal(library->li_enabled, true); test_equal(library->size(), 0); } static void test_verify_link(struct library *library) { test_equal(library->primary_key(), "/home/Link/Music"); - test_equal(library->enabled(), false); + test_equal(library->li_enabled, false); test_equal(library->size(), 0); }