summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-06 23:05:13 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-11-06 23:05:13 +0100
commit3de18efdd91724d6e728d7e1cfb7bc67d3c0f8c2 (patch)
treec014c957270c9e967336ded0444dd0aeaba53081
parent18128612d2787f06ac95c423b3f3b4dd8af6ec07 (diff)
gtkui: improved Return handling in search window
-rw-r--r--plugins/gtkui/callbacks.h4
-rw-r--r--plugins/gtkui/deadbeef.glade1
-rw-r--r--plugins/gtkui/interface.c3
-rw-r--r--plugins/gtkui/search.c24
4 files changed, 24 insertions, 8 deletions
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h
index 2773cc65..b38d5f2e 100644
--- a/plugins/gtkui/callbacks.h
+++ b/plugins/gtkui/callbacks.h
@@ -1304,3 +1304,7 @@ on_searchwin_key_press_event (GtkWidget *widget,
void
on_auto_size_columns_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
+
+void
+on_searchentry_activate (GtkEntry *entry,
+ gpointer user_data);
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index 320292c8..0d243423 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -982,6 +982,7 @@
<property name="invisible_char">•</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_searchentry_changed" last_modification_time="Sat, 08 Aug 2009 18:18:17 GMT"/>
+ <signal name="activate" handler="on_searchentry_activate" last_modification_time="Wed, 06 Nov 2013 22:01:38 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index 9fb82c26..04c0de89 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -860,6 +860,9 @@ create_searchwin (void)
g_signal_connect ((gpointer) searchentry, "changed",
G_CALLBACK (on_searchentry_changed),
NULL);
+ g_signal_connect ((gpointer) searchentry, "activate",
+ G_CALLBACK (on_searchentry_activate),
+ NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
GLADE_HOOKUP_OBJECT_NO_REF (searchwin, searchwin, "searchwin");
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");