45 lines
842 B
C++
45 lines
842 B
C++
|
|
#include <ocarina/songlist.h>
|
|
|
|
void SongList::freeze()
|
|
{
|
|
gtk_widget_freeze_child_notify(treeview);
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), NULL);
|
|
}
|
|
|
|
void SongList::thaw()
|
|
{
|
|
gtk_widget_thaw_child_notify(treeview);
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(liststore));
|
|
}
|
|
|
|
void SongList::clear()
|
|
{
|
|
freeze();
|
|
gtk_list_store_clear(liststore);
|
|
thaw();
|
|
}
|
|
|
|
void SongList::insert(Track &track)
|
|
{
|
|
gtk_list_store_insert_with_values(liststore, NULL, ins_next,
|
|
0, track.get_inode(),
|
|
1, track.get_track(),
|
|
2, track.get_title().c_str(),
|
|
3, track.get_lenstr().c_str(),
|
|
4, track.get_artist().c_str(),
|
|
5, track.get_album().c_str(),
|
|
6, track.get_year(),
|
|
-1);
|
|
ins_next++;
|
|
}
|
|
|
|
void SongList::fill()
|
|
{
|
|
freeze();
|
|
ins_next = 0;
|
|
list_funcs->for_each(list_funcs->insert_track);
|
|
thaw();
|
|
set_label_text();
|
|
}
|