ocarina: Use the iterators to fill the library list
I keep the old way around for the queue until I can change that, too.
This commit is contained in:
parent
2fd41ff4d7
commit
5dcfac8be2
|
@ -27,6 +27,9 @@ struct SongListFuncs
|
|||
{
|
||||
void (*for_each)(libsaria::SourceModel *);
|
||||
unsigned int (*size)();
|
||||
void (*iter_reset)();
|
||||
libsaria::Track *(*iter_next)();
|
||||
bool (*iter_end)();
|
||||
};
|
||||
|
||||
class SongList : public libsaria::SourceModel
|
||||
|
|
|
@ -47,8 +47,11 @@ namespace ocarina
|
|||
void library::init()
|
||||
{
|
||||
library_menu.push_back(MenuItem("Add to Queue", add_to_queue_event));
|
||||
library_funcs.for_each = libsaria::library::for_each;
|
||||
library_funcs.for_each = NULL;
|
||||
library_funcs.size = libsaria::library::size;
|
||||
library_funcs.iter_reset = libsaria::library::iter::reset;
|
||||
library_funcs.iter_next = libsaria::library::iter::next;
|
||||
library_funcs.iter_end = libsaria::library::iter::end;
|
||||
|
||||
register_shortcut("q", add_to_queue);
|
||||
|
||||
|
|
|
@ -38,7 +38,13 @@ void SongList::fill()
|
|||
{
|
||||
freeze();
|
||||
ins_next = 0;
|
||||
list_funcs->for_each(this);
|
||||
if (list_funcs->for_each)
|
||||
list_funcs->for_each(this);
|
||||
else {
|
||||
list_funcs->iter_reset();
|
||||
while (list_funcs->iter_end() == false)
|
||||
insert(list_funcs->iter_next());
|
||||
}
|
||||
thaw();
|
||||
set_label_text();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue