
#include <sstream>
using namespace std;

#include <ocarina/gtk.h>
#include <ocarina/songlist.h>
#include <libsaria/library.h>
#include <libsaria/print.h>
#include "songlist.h"

void songlist_row_activated(GtkTreeView *treeview, GtkTreePath *path,
				   GtkTreeViewColumn *column, gpointer data)
{
	GtkTreeIter iter;
	ino_t inode;
	GtkTreeModel *model = gtk_tree_view_get_model(treeview);
	gtk_tree_model_get_iter(model, &iter, path);
	gtk_tree_model_get(model, &iter, 0, &inode, -1);
	print("Double click! ");
	println(inode);
	libsaria::library::play_id(inode);
}

GtkWidget *SongList::get_window()
{
	return window;
}

GtkWidget *SongList::get_label()
{
	return label;
}

void SongList::set_label_text()
{
	string res;
	stringstream stream;

	stream << name << " (";
	stream << list_funcs->size() << ")";
	res = stream.str();

	gtk_label_set_text(GTK_LABEL(label), res.c_str());
}
