ocarina: Respond to "slash" keypress
This allows easier access to the filter entry, since clicking it is too slow. Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
a2e0375ac9
commit
be67f81782
|
@ -30,6 +30,7 @@ void init_window();
|
|||
|
||||
/* playlist.cpp */
|
||||
bool playlist_entry_focused();
|
||||
void playlist_focus_entry();
|
||||
void update_playlist(notify_t, libsaria::PlaylistNotification *);
|
||||
void init_playlist();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ struct PlaylistWidgets {
|
|||
GtkListStore *liststore;
|
||||
GtkTreeModel *filter;
|
||||
GtkLabel *label;
|
||||
GtkEntry *entry;
|
||||
};
|
||||
|
||||
PlaylistWidgets library_widgets;
|
||||
|
@ -109,6 +110,11 @@ bool playlist_entry_focused()
|
|||
return gtk_widget_is_focus(focused_entry);
|
||||
}
|
||||
|
||||
void playlist_focus_entry()
|
||||
{
|
||||
gtk_widget_grab_focus(GTK_WIDGET(current_widgets()->entry));
|
||||
}
|
||||
|
||||
static void track_selected(GtkWidget *treeview, GtkTreePath *path,
|
||||
GtkTreeViewColumn *col, gpointer data)
|
||||
{
|
||||
|
@ -228,6 +234,7 @@ static void init_playlist_tab(struct PlaylistWidgets *widgets,
|
|||
widgets->filter = gtk_tree_model_filter_new(
|
||||
GTK_TREE_MODEL(widgets->liststore), NULL);
|
||||
widgets->label = GTK_LABEL(get_widget(label_name));
|
||||
widgets->entry = GTK_ENTRY(get_widget(entry_name));
|
||||
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(get_widget(view_name)),
|
||||
GTK_TREE_MODEL(widgets->filter));
|
||||
|
|
|
@ -76,6 +76,8 @@ static gboolean key_pressed(GtkWidget *widget, GdkEvent *event, gpointer data)
|
|||
libsaria::deck::next();
|
||||
else if (key == "N")
|
||||
libsaria::deck::prev();
|
||||
else if (key == "slash")
|
||||
playlist_focus_entry();
|
||||
else if (key == "space")
|
||||
libsaria::audio::toggle_play();
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue