core/tags/library: Move library_get() out of the tags namespace
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
ffa5e65ba7
commit
e1093f7eab
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue