48 lines
921 B
C++
48 lines
921 B
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/playlist.h>
|
|
#include <lib/lib.h>
|
|
#include <lib/plist.h>
|
|
|
|
|
|
class PlaylistColumns : public Gtk::TreeModelColumnRecord {
|
|
public:
|
|
Gtk::TreeModelColumn<Glib::ustring> p_name;
|
|
|
|
PlaylistColumns()
|
|
{
|
|
add(p_name);
|
|
}
|
|
};
|
|
|
|
|
|
static PlaylistColumns p_cols;
|
|
static Glib::RefPtr<Gtk::ListStore> p_list;
|
|
|
|
|
|
void plist :: init()
|
|
{
|
|
p_list = lib :: get_object<Gtk::ListStore>("plist_list");
|
|
}
|
|
|
|
Glib::ustring plist :: get_path(const Gtk::TreePath &path)
|
|
{
|
|
Gtk::TreeModel::Row row = *(p_list->get_iter(path));
|
|
return row[p_cols.p_name];
|
|
}
|
|
|
|
void plist :: select_path(const Gtk::TreePath &path)
|
|
{
|
|
playlist :: select(get_path(path));
|
|
}
|
|
|
|
void plist :: del_path_ids(const Gtk::TreePath &path,
|
|
std::vector<unsigned int> &ids)
|
|
{
|
|
std::string name = plist :: get_path(path);
|
|
|
|
for (unsigned int i = 0; i < ids.size(); i++)
|
|
playlist :: del(tags :: get_track(ids[i]), name);
|
|
}
|