gui: Move on_row_activated() into the QueueWindow

And out of the Tab class.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-04-18 09:27:54 -04:00
parent 83414ca3ad
commit c9ca2604ee
4 changed files with 14 additions and 10 deletions

View File

@ -20,8 +20,12 @@ void QueueWindow :: init(Queue *queue)
_queue = queue;
q_model = Glib::RefPtr<QueueModel>(new QueueModel(queue));
q_filter = Gtk::TreeModelFilter::create(q_model);
q_treeview->set_model(q_filter);
q_filter->set_visible_func(sigc::mem_fun(*this, &QueueWindow::filter_ids));
q_treeview->signal_row_activated().connect(sigc::mem_fun(*this,
&QueueWindow :: on_row_activated));
q_treeview->set_model(q_filter);
}
void QueueWindow :: filter(std::string &text)
@ -44,3 +48,10 @@ bool QueueWindow :: filter_ids(const Gtk::TreeIter &iter)
it = _q_search_res.find(_queue->operator[](id)->index());
return it != _q_search_res.end();
}
void QueueWindow :: on_row_activated(const Gtk::TreePath &path,
Gtk::TreeViewColumn *col)
{
Gtk::TreePath real_path = q_filter->convert_path_to_child_path(path);
q_model->on_path_selected(real_path);
}

View File

@ -37,8 +37,6 @@ Tab :: ~Tab() {}
void Tab :: tab_finish_init()
{
tab_treeview->signal_row_activated().connect(sigc::mem_fun(*this,
&Tab :: on_row_activated));
tab_treeview->signal_key_press_event().connect(sigc::mem_fun(*this,
&Tab :: on_key_pressed));
tab_treeview->signal_button_press_event().connect(sigc::mem_fun(*this,
@ -255,12 +253,6 @@ void Tab :: on_show_rc_menu()
*
*/
void Tab :: on_row_activated(const Gtk::TreePath &path, Gtk::TreeViewColumn *col)
{
Gtk::TreePath model_path = tab_filter->convert_path_to_child_path(path);
tab_model->on_path_selected(model_path);
}
bool Tab :: on_key_pressed(GdkEventKey *event)
{
std::string key = gdk_keyval_name(event->keyval);

View File

@ -27,6 +27,8 @@ public:
void filter(std::string &);
bool filter_ids(const Gtk::TreeIter &);
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
};
#endif /* OCARINA_GUI_QUEUE_WINDOW_H */

View File

@ -77,7 +77,6 @@ public:
* GTK-MM callback functions
*/
void on_repeat_toggled();
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
bool on_key_pressed(GdkEventKey *);
void on_column_clicked(unsigned int);
bool on_button_pressed(GdkEventButton *);