diff options
author | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-11-06 23:05:13 +0100 |
---|---|---|
committer | Alexey Yakovenko <waker@users.sourceforge.net> | 2013-11-06 23:05:13 +0100 |
commit | 3de18efdd91724d6e728d7e1cfb7bc67d3c0f8c2 (patch) | |
tree | c014c957270c9e967336ded0444dd0aeaba53081 /plugins/gtkui/search.c | |
parent | 18128612d2787f06ac95c423b3f3b4dd8af6ec07 (diff) |
gtkui: improved Return handling in search window
Diffstat (limited to 'plugins/gtkui/search.c')
-rw-r--r-- | plugins/gtkui/search.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c index b6572aac..ed0d69e6 100644 --- a/plugins/gtkui/search.c +++ b/plugins/gtkui/search.c @@ -167,6 +167,21 @@ on_searchheader_motion_notify_event (GtkWidget *widget, ///////// searchwin playlist navigation and rendering +void +on_searchentry_activate (GtkEntry *entry, + gpointer user_data) +{ + if (deadbeef->pl_getcount (PL_SEARCH) > 0) { + int row = deadbeef->pl_get_cursor (PL_SEARCH); + DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (max (row, 0), PL_SEARCH); + if (it) { + deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, deadbeef->pl_get_idx_of (it), 0); + deadbeef->pl_item_unref (it); + } + } +} + + gboolean on_searchwin_key_press_event (GtkWidget *widget, GdkEventKey *event, @@ -177,14 +192,7 @@ on_searchwin_key_press_event (GtkWidget *widget, gtk_widget_hide (widget); } else if (event->keyval == GDK_Return) { - if (deadbeef->pl_getcount (PL_SEARCH) > 0) { - int row = deadbeef->pl_get_cursor (PL_SEARCH); - DB_playItem_t *it = deadbeef->pl_get_for_idx_and_iter (max (row, 0), PL_SEARCH); - if (it) { - deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, deadbeef->pl_get_idx_of (it), 0); - deadbeef->pl_item_unref (it); - } - } + on_searchentry_activate (NULL, 0); } else if (event->keyval != GDK_Delete && event->keyval != GDK_Home && event->keyval != GDK_End){ GtkWidget *pl = lookup_widget (searchwin, "searchlist"); |