gui: Play tracks when rows are selected
Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
6659f18de3
commit
8ab973cd85
|
@ -4,6 +4,7 @@
|
|||
* See the example at:
|
||||
* https://git.gnome.org/browse/gtkmm-documentation/tree/examples/others/treemodelcustom
|
||||
*/
|
||||
#include <audio.h>
|
||||
#include <ocarina.h>
|
||||
#include <sstream>
|
||||
|
||||
|
@ -33,6 +34,12 @@ void PlayqueueModel::on_row_deleted(unsigned int row)
|
|||
row_deleted(path);
|
||||
}
|
||||
|
||||
void PlayqueueModel::on_path_selected(const Gtk::TreePath &path)
|
||||
{
|
||||
audio :: load_trackid(queue->operator[](path[0]));
|
||||
audio :: play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -114,6 +114,7 @@ public:
|
|||
void on_row_deleted(unsigned int);
|
||||
void on_runtime_changed();
|
||||
void on_random_toggled();
|
||||
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,6 +151,8 @@ OcarinaPage::OcarinaPage(const std::string &name, const std::string &icon,
|
|||
page_view.append_column("Count", queue_cols.q_col_count);
|
||||
page_view.append_column("Played", queue_cols.q_col_played);
|
||||
|
||||
page_view.signal_row_activated().connect(sigc::mem_fun(*this,
|
||||
&OcarinaPage::on_row_activated));
|
||||
page_view.set_model(model);
|
||||
page_view.set_rules_hint();
|
||||
page_scroll.add(page_view);
|
||||
|
@ -232,6 +235,11 @@ void OcarinaPage::on_random_toggled()
|
|||
model->queue->unset_flag(PQ_RANDOM);
|
||||
}
|
||||
|
||||
void OcarinaPage::on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
|
||||
{
|
||||
model->on_path_selected(path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
|
||||
void on_row_inserted(unsigned int);
|
||||
void on_row_deleted(unsigned int);
|
||||
void on_path_selected(const Gtk::TreePath &);
|
||||
};
|
||||
|
||||
/* tabs.cpp */
|
||||
|
|
Loading…
Reference in New Issue