core/collection: Move collection_remove() out of the collection
namespace Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
6e39e17060
commit
0cb16f5c64
|
@ -184,10 +184,10 @@ struct library *collection_add(const gchar *path)
|
|||
return library;
|
||||
}
|
||||
|
||||
void collection :: remove(struct library *library)
|
||||
void collection_remove(struct library *library)
|
||||
{
|
||||
if (library) {
|
||||
set_enabled(library, false);
|
||||
collection :: set_enabled(library, false);
|
||||
track_remove_all(library);
|
||||
library_remove(library);
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ static bool on_key_pressed(GdkEventKey *event)
|
|||
return false;
|
||||
|
||||
lib = current_library_and_row(row);
|
||||
collection :: remove(lib);
|
||||
collection_remove(lib);
|
||||
c_list->erase(row);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,14 +26,6 @@ namespace collection
|
|||
|
||||
void save(struct queue *, enum queue_flags);
|
||||
|
||||
/**
|
||||
* Remove a Library tag from the database along with every
|
||||
* Track associated with this library.
|
||||
*
|
||||
* @param library The library path that should be removed.
|
||||
*/
|
||||
void remove(struct library *);
|
||||
|
||||
/**
|
||||
* First, scan over every Track in the database and remove
|
||||
* tracks that no longer exist in the filesystem.
|
||||
|
@ -77,4 +69,7 @@ void collection_init(struct queue_ops *);
|
|||
/* Called to add a new library directory to the collection manager. */
|
||||
struct library *collection_add(const gchar *);
|
||||
|
||||
/* Called to remove a library directory from the collection manager. */
|
||||
void collection_remove(struct library *);
|
||||
|
||||
#endif /* OCARINA_CORE_LIBRARY_H */
|
||||
|
|
|
@ -61,6 +61,19 @@ static void test_add()
|
|||
test_equal(queue_size(q), 48);
|
||||
}
|
||||
|
||||
static void test_remove()
|
||||
{
|
||||
struct queue *q = collection :: get_queue();
|
||||
|
||||
collection_remove(NULL);
|
||||
test_equal(track_db_get()->db_size, 48);
|
||||
|
||||
collection_remove(library_get(0));
|
||||
test_equal(track_db_get()->db_size, 0);
|
||||
test_equal(library_get(0), NULL);
|
||||
test_equal(queue_size(q), 0);
|
||||
}
|
||||
|
||||
|
||||
static void test_enable()
|
||||
{
|
||||
|
@ -91,21 +104,6 @@ static void test_enable()
|
|||
test_equal(queue_size(q), (unsigned)24);
|
||||
}
|
||||
|
||||
static void test_remove()
|
||||
{
|
||||
queue *q = collection :: get_queue();
|
||||
struct library *library = library_get(0);
|
||||
|
||||
collection :: remove(LIB_NULL);
|
||||
test_equal(queue_size(q), (unsigned)24);
|
||||
|
||||
collection :: remove(library);
|
||||
test_equal(queue_size(q), (unsigned)0);
|
||||
|
||||
collection :: remove(library);
|
||||
test_equal(queue_size(q), (unsigned)0);
|
||||
}
|
||||
|
||||
static void test_update()
|
||||
{
|
||||
queue *q = collection :: get_queue();
|
||||
|
@ -134,7 +132,7 @@ static void test_update()
|
|||
DECLARE_UNIT_TESTS(
|
||||
UNIT_TEST("Collection Initialization", test_init),
|
||||
UNIT_TEST("Collection Add Path", test_add),
|
||||
UNIT_TEST("Collection Remove Path", test_remove),
|
||||
UNIT_TEST("Library Enable and Disable", test_enable),
|
||||
UNIT_TEST("Library Delete Path", test_remove),
|
||||
UNIT_TEST("Library Update Path", test_update),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue