changeset 2145:e2c6696c1d9a trunk

[svn] added enter keypress shortcut for search-in-playlist dialog
author giacomo
date Sat, 16 Dec 2006 11:20:00 -0800
parents b76039eeb6f0
children e0e50e151bab
files ChangeLog audacious/ui_playlist.c
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Dec 16 10:44:25 2006 -0800
+++ b/ChangeLog	Sat Dec 16 11:20:00 2006 -0800
@@ -1,3 +1,10 @@
+2006-12-16 18:44:25 +0000  Giacomo Lozito <james@develia.org>
+  revision [3293]
+  - added auto-enqueue option for search-in-playlist
+  trunk/audacious/ui_playlist.c |   31 +++++++++++++++++++++++++++++--
+  1 file changed, 29 insertions(+), 2 deletions(-)
+
+
 2006-12-16 15:56:32 +0000  Giacomo Lozito <james@develia.org>
   revision [3291]
   - changed playlist_shuffle_list to pick a playlist as parameter instead of calling playlist_get_active
--- a/audacious/ui_playlist.c	Sat Dec 16 10:44:25 2006 -0800
+++ b/audacious/ui_playlist.c	Sat Dec 16 11:20:00 2006 -0800
@@ -119,6 +119,8 @@
 
 static void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt ,
                                               gpointer other_cbt );
+static gboolean playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
+                                                 gpointer searchdlg_win );
 
 static GtkItemFactoryEntry playlistwin_popup_menu_entries[] = {
     {N_("/View Track Details"), NULL,
@@ -715,18 +717,26 @@
     searchdlg_label_track_name = gtk_label_new( _("Track name: ") );
     searchdlg_entry_track_name = gtk_entry_new();
     gtk_misc_set_alignment( GTK_MISC(searchdlg_label_track_name) , 0 , 0.5 );
+    g_signal_connect( G_OBJECT(searchdlg_entry_track_name) , "key-press-event" ,
+      G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
     /* album name */
     searchdlg_label_album_name = gtk_label_new( _("Album name: ") );
     searchdlg_entry_album_name = gtk_entry_new();
     gtk_misc_set_alignment( GTK_MISC(searchdlg_label_album_name) , 0 , 0.5 );
+    g_signal_connect( G_OBJECT(searchdlg_entry_album_name) , "key-press-event" ,
+      G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
     /* artist */
     searchdlg_label_performer = gtk_label_new( _("Artist: ") );
     searchdlg_entry_performer = gtk_entry_new();
     gtk_misc_set_alignment( GTK_MISC(searchdlg_label_performer) , 0 , 0.5 );
+    g_signal_connect( G_OBJECT(searchdlg_entry_performer) , "key-press-event" ,
+      G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
     /* file name */
     searchdlg_label_file_name = gtk_label_new( _("Filename: ") );
     searchdlg_entry_file_name = gtk_entry_new();
     gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 );
+    g_signal_connect( G_OBJECT(searchdlg_entry_file_name) , "key-press-event" ,
+      G_CALLBACK(playlistwin_select_search_kp_cb) , searchdlg_win );
     /* some options that control behaviour */
     searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label(
       _("Clear previous selection before searching") );
@@ -2289,3 +2299,17 @@
         gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(other_cbt) , FALSE );
     return;
 }
+
+static gboolean
+playlistwin_select_search_kp_cb( GtkWidget *entry , GdkEventKey *event ,
+                                 gpointer searchdlg_win )
+{
+    switch (event->keyval)
+    {
+        case GDK_Return:
+            gtk_dialog_response( GTK_DIALOG(searchdlg_win) , GTK_RESPONSE_ACCEPT );
+            return TRUE;
+        default:
+            return FALSE;
+    }
+}