gui/queue: Stop space bar from selecting new tracks
From Josh: Single-clicking a track in the collection queue and pressing the space bar loads the selected track, but users would expect this to toggle the play / pause state instead. The solution is to watch for the on_key_press signal and tell GTK that we have handled it if we see that the space bar was pressed. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
7e306de007
commit
8e02001373
|
@ -27,6 +27,8 @@ void QueueWindow :: init(Queue *queue)
|
||||||
|
|
||||||
q_treeview->signal_row_activated().connect(sigc::mem_fun(*this,
|
q_treeview->signal_row_activated().connect(sigc::mem_fun(*this,
|
||||||
&QueueWindow :: on_row_activated));
|
&QueueWindow :: on_row_activated));
|
||||||
|
q_treeview->signal_key_press_event().connect(sigc::mem_fun(*this,
|
||||||
|
&QueueWindow :: on_key_press), false);
|
||||||
q_treeview->set_model(q_filter);
|
q_treeview->set_model(q_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +51,14 @@ bool QueueWindow :: filter_ids(const Gtk::TreeIter &iter)
|
||||||
return set_has(&_q_search_res, _queue->operator[](id)->dbe_index);
|
return set_has(&_q_search_res, _queue->operator[](id)->dbe_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueueWindow :: on_key_press(GdkEventKey *event)
|
||||||
|
{
|
||||||
|
std::string key = gdk_keyval_name(event->keyval);
|
||||||
|
if (key == "space")
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void QueueWindow :: on_row_activated(const Gtk::TreePath &path,
|
void QueueWindow :: on_row_activated(const Gtk::TreePath &path,
|
||||||
Gtk::TreeViewColumn *col)
|
Gtk::TreeViewColumn *col)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void filter(std::string &);
|
void filter(std::string &);
|
||||||
bool filter_ids(const Gtk::TreeIter &);
|
bool filter_ids(const Gtk::TreeIter &);
|
||||||
|
|
||||||
|
bool on_key_press(GdkEventKey *);
|
||||||
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
|
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue