From e1093f7eaba4b2de5aba4fe9e535d473ac8bd5f2 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 28 Sep 2015 10:08:11 -0400 Subject: [PATCH] core/tags/library: Move library_get() out of the tags namespace Signed-off-by: Anna Schumaker --- core/library.cpp | 2 +- core/tags/library.cpp | 2 +- core/tags/track.cpp | 2 +- gui/manager.cpp | 6 +++--- include/core/tags/library.h | 12 ++++-------- tests/core/library.cpp | 4 ++-- tests/core/tags/library.cpp | 6 +++--- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/core/library.cpp b/core/library.cpp index 92cd8a64..6d4532b0 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -215,7 +215,7 @@ void collection :: update_all() struct library *library; for (unsigned int i = 0; i < tags :: library_size(); i++) { - library = tags :: get_library(i); + library = library_get(i); if (library) update(library); } diff --git a/core/tags/library.cpp b/core/tags/library.cpp index 10f25585..01693029 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -78,7 +78,7 @@ struct library *tags :: get_library(const std::string &path) return db_find(&library_db, path.c_str()); } -struct library *tags :: get_library(const unsigned int index) +struct library *library_get(const unsigned int index) { return db_at(&library_db, index); } diff --git a/core/tags/track.cpp b/core/tags/track.cpp index 73318747..20e393a8 100644 --- a/core/tags/track.cpp +++ b/core/tags/track.cpp @@ -120,7 +120,7 @@ void Track :: read(file &file) _path = path; g_free(path); - _library = tags :: get_library(library_id); + _library = library_get(library_id); _artist = artist_get(artist_id); _album = album_get(album_id); _genre = genre_get(genre_id); diff --git a/gui/manager.cpp b/gui/manager.cpp index 971ef8b2..553b7202 100644 --- a/gui/manager.cpp +++ b/gui/manager.cpp @@ -46,7 +46,7 @@ static struct library *get_library_and_row(const Gtk::TreePath &path, Gtk::TreeModel::Row &row) { row = *(c_list->get_iter(path)); - return tags :: get_library(row[c_cols.c_id]); + return library_get(row[c_cols.c_id]); } static struct library *get_library(const Gtk::TreePath &path) @@ -80,7 +80,7 @@ void update_paths() Gtk::TreeModel::Children::iterator it; for (it = c_list->children().begin(); it != c_list->children().end(); it++) { - lib = tags :: get_library((*it)[c_cols.c_id]); + lib = library_get((*it)[c_cols.c_id]); if (lib) (*it)[c_cols.c_size] = lib->size(); } @@ -193,5 +193,5 @@ void manager :: init() c_treeview->signal_key_press_event().connect(sigc::ptr_fun(on_key_pressed)); for (unsigned int i = 0; i < tags :: library_size(); i++) - list_path(tags :: get_library(i)); + list_path(library_get(i)); } diff --git a/include/core/tags/library.h b/include/core/tags/library.h index d1f4a0b0..ff408908 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -102,14 +102,6 @@ namespace tags */ struct library *get_library(const std::string &); - /** - * Called to look up a Library tag by tag index. - * - * @param index The index of the Library tag. - * @return A matching Library tag. - */ - struct library *get_library(const unsigned int); - /** * Called to remove a specific Library tag. * @@ -126,4 +118,8 @@ namespace tags unsigned int library_size(); } + +/* Called to get a library tag with a specific index. */ +struct library *library_get(const unsigned int); + #endif /* OCARINA_CORE_TAGS_LIBRARY_H */ diff --git a/tests/core/library.cpp b/tests/core/library.cpp index 0b6acb4e..7e7126a5 100644 --- a/tests/core/library.cpp +++ b/tests/core/library.cpp @@ -29,7 +29,7 @@ static void test_init() static void test_enable() { Queue *q = collection :: get_queue(); - struct library *library = tags :: get_library(0); + struct library *library = library_get(0); collection :: set_enabled(LIB_NULL, true); test_equal(q->size(), (unsigned)24); @@ -53,7 +53,7 @@ static void test_enable() static void test_remove() { Queue *q = collection :: get_queue(); - struct library *library = tags :: get_library(0); + struct library *library = library_get(0); collection :: remove(LIB_NULL); test_equal(q->size(), (unsigned)24); diff --git a/tests/core/tags/library.cpp b/tests/core/tags/library.cpp index 1fb1243e..fd77130d 100644 --- a/tests/core/tags/library.cpp +++ b/tests/core/tags/library.cpp @@ -79,8 +79,8 @@ static void test_library_db() test_equal(tags :: library_size(), 1); test_equal(tags :: get_library("/home/Zelda/Music"), library); - test_equal(tags :: get_library(0), library); - test_equal(tags :: get_library(1), (struct library *)NULL); + test_equal(library_get(0), library); + test_equal(library_get(1), (struct library *)NULL); db_init(&library_db, "library.db", false); db_load(&library_db); @@ -92,7 +92,7 @@ static void test_library_db() test_verify_zelda(library2); tags :: remove_library(library); - test_equal(tags :: get_library(0), (struct library *)NULL); + test_equal(library_get(0), (struct library *)NULL); test_equal(tags :: library_size(), 1); db_deinit(&library_db);