comparison audacious/ui_playlist.c @ 2144:b76039eeb6f0 trunk

[svn] - added auto-enqueue option for search-in-playlist
author giacomo
date Sat, 16 Dec 2006 10:44:25 -0800
parents 299651a8f107
children e2c6696c1d9a
comparison
equal deleted inserted replaced
2143:f7eeb54c6467 2144:b76039eeb6f0
114 GtkWidget * w); 114 GtkWidget * w);
115 static void playlistwin_sub_menu_callback(gpointer cb_data, guint action, 115 static void playlistwin_sub_menu_callback(gpointer cb_data, guint action,
116 GtkWidget * w); 116 GtkWidget * w);
117 static void playlistwin_popup_menu_callback(gpointer cb_data, guint action, 117 static void playlistwin_popup_menu_callback(gpointer cb_data, guint action,
118 GtkWidget * w); 118 GtkWidget * w);
119
120 static void playlistwin_select_search_cbt_cb( GtkWidget *called_cbt ,
121 gpointer other_cbt );
119 122
120 static GtkItemFactoryEntry playlistwin_popup_menu_entries[] = { 123 static GtkItemFactoryEntry playlistwin_popup_menu_entries[] = {
121 {N_("/View Track Details"), NULL, 124 {N_("/View Track Details"), NULL,
122 playlistwin_popup_menu_callback, 125 playlistwin_popup_menu_callback,
123 MISC_FILEINFO, "<ImageItem>", my_pixbuf}, 126 MISC_FILEINFO, "<ImageItem>", my_pixbuf},
689 GtkWidget *searchdlg_entry_album_name, *searchdlg_label_album_name; 692 GtkWidget *searchdlg_entry_album_name, *searchdlg_label_album_name;
690 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name; 693 GtkWidget *searchdlg_entry_file_name, *searchdlg_label_file_name;
691 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer; 694 GtkWidget *searchdlg_entry_performer, *searchdlg_label_performer;
692 GtkWidget *searchdlg_checkbt_clearprevsel; 695 GtkWidget *searchdlg_checkbt_clearprevsel;
693 GtkWidget *searchdlg_checkbt_newplaylist; 696 GtkWidget *searchdlg_checkbt_newplaylist;
697 GtkWidget *searchdlg_checkbt_autoenqueue;
694 gint result; 698 gint result;
695 699
696 /* create dialog */ 700 /* create dialog */
697 searchdlg_win = gtk_dialog_new_with_buttons( 701 searchdlg_win = gtk_dialog_new_with_buttons(
698 "Search entries in active playlist" , GTK_WINDOW(mainwin) , 702 "Search entries in active playlist" , GTK_WINDOW(mainwin) ,
725 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 ); 729 gtk_misc_set_alignment( GTK_MISC(searchdlg_label_file_name) , 0 , 0.5 );
726 /* some options that control behaviour */ 730 /* some options that control behaviour */
727 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label( 731 searchdlg_checkbt_clearprevsel = gtk_check_button_new_with_label(
728 _("Clear previous selection before searching") ); 732 _("Clear previous selection before searching") );
729 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE ); 733 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_clearprevsel) , TRUE );
734 searchdlg_checkbt_autoenqueue = gtk_check_button_new_with_label(
735 _("Automatically toggle queue for matching entries") );
736 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue) , FALSE );
730 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label( 737 searchdlg_checkbt_newplaylist = gtk_check_button_new_with_label(
731 _("Create a new playlist with matching entries") ); 738 _("Create a new playlist with matching entries") );
732 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE ); 739 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist) , FALSE );
740 g_signal_connect( G_OBJECT(searchdlg_checkbt_autoenqueue) , "clicked" ,
741 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_newplaylist );
742 g_signal_connect( G_OBJECT(searchdlg_checkbt_newplaylist) , "clicked" ,
743 G_CALLBACK(playlistwin_select_search_cbt_cb) , searchdlg_checkbt_autoenqueue );
733 /* place fields in searchdlg_table */ 744 /* place fields in searchdlg_table */
734 searchdlg_table = gtk_table_new( 7 , 2 , FALSE ); 745 searchdlg_table = gtk_table_new( 8 , 2 , FALSE );
735 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 ); 746 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 0 , 8 );
736 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 ); 747 gtk_table_set_row_spacing( GTK_TABLE(searchdlg_table) , 4 , 8 );
737 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox , 748 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_hbox ,
738 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); 749 0 , 2 , 0 , 1 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
739 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_track_name , 750 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_label_track_name ,
752 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 ); 763 0 , 1 , 4 , 5 , GTK_FILL , GTK_FILL | GTK_EXPAND , 0 , 2 );
753 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name , 764 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_entry_file_name ,
754 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 ); 765 1 , 2 , 4 , 5 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 2 );
755 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel , 766 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_clearprevsel ,
756 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); 767 0 , 2 , 5 , 6 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
768 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_autoenqueue ,
769 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
757 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist , 770 gtk_table_attach( GTK_TABLE(searchdlg_table) , searchdlg_checkbt_newplaylist ,
758 0 , 2 , 6 , 7 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 ); 771 0 , 2 , 7 , 8 , GTK_FILL | GTK_EXPAND , GTK_FILL | GTK_EXPAND , 0 , 1 );
759 772
760 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 ); 773 gtk_container_set_border_width( GTK_CONTAINER(searchdlg_table) , 5 );
761 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table ); 774 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(searchdlg_win)->vbox) , searchdlg_table );
762 gtk_widget_show_all( searchdlg_win ); 775 gtk_widget_show_all( searchdlg_win );
763 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) ); 776 result = gtk_dialog_run( GTK_DIALOG(searchdlg_win) );
790 g_free( tuple ); 803 g_free( tuple );
791 playlistwin_update_list(playlist_get_active()); 804 playlistwin_update_list(playlist_get_active());
792 /* check if a new playlist should be created after searching */ 805 /* check if a new playlist should be created after searching */
793 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE ) 806 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_newplaylist)) == TRUE )
794 playlist_new_from_selected(); 807 playlist_new_from_selected();
808 /* check if matched entries should be queued */
809 else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(searchdlg_checkbt_autoenqueue)) == TRUE )
810 playlist_queue(playlist_get_active());
795 break; 811 break;
796 } 812 }
797 default: 813 default:
798 break; 814 break;
799 } 815 }
2260 } 2276 }
2261 break; 2277 break;
2262 2278
2263 } 2279 }
2264 } 2280 }
2281
2282
2283 /* playlistwin_select_search callback functions
2284 placed here to avoid making the code messier :) */
2285 static void
2286 playlistwin_select_search_cbt_cb( GtkWidget *called_cbt , gpointer other_cbt )
2287 {
2288 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(called_cbt) ) == TRUE )
2289 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(other_cbt) , FALSE );
2290 return;
2291 }