Mercurial > audlegacy
comparison src/audacious/ui_fileinfo.c @ 4163:a12876b41f01
Turn the genre box into an editable dropdown list.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 10 Jan 2008 05:30:59 -0600 |
parents | 0b00f1d21270 |
children | 2a6d9dd09ec1 |
comparison
equal
deleted
inserted
replaced
4162:0b00f1d21270 | 4163:a12876b41f01 |
---|---|
86 | 86 |
87 static gchar *current_file = NULL; | 87 static gchar *current_file = NULL; |
88 static InputPlugin *current_ip = NULL; | 88 static InputPlugin *current_ip = NULL; |
89 static gboolean something_changed = FALSE; | 89 static gboolean something_changed = FALSE; |
90 | 90 |
91 /* stolen from Audacious 1.4 vorbis plugin. --nenolod */ | |
92 static const gchar *genre_table[] = { | |
93 N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"), | |
94 N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"), | |
95 N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"), | |
96 N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"), | |
97 N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"), | |
98 N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"), | |
99 N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"), | |
100 N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"), | |
101 N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"), | |
102 N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("AlternRock"), | |
103 N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"), | |
104 N_("Meditative"), N_("Instrumental Pop"), | |
105 N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"), | |
106 N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"), | |
107 N_("Pop-Folk"), N_("Eurodance"), N_("Dream"), | |
108 N_("Southern Rock"), N_("Comedy"), N_("Cult"), | |
109 N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"), | |
110 N_("Pop/Funk"), N_("Jungle"), N_("Native American"), | |
111 N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"), | |
112 N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"), | |
113 N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"), | |
114 N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"), | |
115 N_("Folk/Rock"), N_("National Folk"), N_("Swing"), | |
116 N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"), | |
117 N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"), | |
118 N_("Gothic Rock"), N_("Progressive Rock"), | |
119 N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"), | |
120 N_("Big Band"), N_("Chorus"), N_("Easy Listening"), | |
121 N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"), | |
122 N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"), | |
123 N_("Booty Bass"), N_("Primus"), N_("Porn Groove"), | |
124 N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"), | |
125 N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"), | |
126 N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"), | |
127 N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"), | |
128 N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"), | |
129 N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"), | |
130 N_("Euro-House"), N_("Dance Hall"), N_("Goa"), | |
131 N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"), | |
132 N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"), | |
133 N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"), | |
134 N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"), | |
135 N_("Contemporary Christian"), N_("Christian Rock"), | |
136 N_("Merengue"), N_("Salsa"), N_("Thrash Metal"), | |
137 N_("Anime"), N_("JPop"), N_("Synthpop") | |
138 }; | |
139 | |
140 static GList *genre_list = NULL; | |
141 | |
91 static void | 142 static void |
92 fileinfo_entry_set_text(GtkWidget *widget, const char *text) | 143 fileinfo_entry_set_text(GtkWidget *widget, const char *text) |
93 { | 144 { |
94 if (widget == NULL) | 145 if (widget == NULL) |
95 return; | 146 return; |
213 /* Clear it out. */ | 264 /* Clear it out. */ |
214 fileinfo_entry_set_text(entry_title, ""); | 265 fileinfo_entry_set_text(entry_title, ""); |
215 fileinfo_entry_set_text(entry_artist, ""); | 266 fileinfo_entry_set_text(entry_artist, ""); |
216 fileinfo_entry_set_text(entry_album, ""); | 267 fileinfo_entry_set_text(entry_album, ""); |
217 fileinfo_entry_set_text(entry_comment, ""); | 268 fileinfo_entry_set_text(entry_comment, ""); |
218 fileinfo_entry_set_text(entry_genre, ""); | 269 fileinfo_entry_set_text(gtk_bin_get_child(GTK_BIN(entry_genre)), ""); |
219 fileinfo_entry_set_text(entry_year, ""); | 270 fileinfo_entry_set_text(entry_year, ""); |
220 fileinfo_entry_set_text(entry_track, ""); | 271 fileinfo_entry_set_text(entry_track, ""); |
221 fileinfo_entry_set_text(entry_location, ""); | 272 fileinfo_entry_set_text(entry_location, ""); |
222 | 273 |
223 fileinfo_label_set_text(label_format_name, NULL); | 274 fileinfo_label_set_text(label_format_name, NULL); |
293 if (fd != NULL) { | 344 if (fd != NULL) { |
294 set_field_str_from_entry(tuple, FIELD_TITLE, entry_title); | 345 set_field_str_from_entry(tuple, FIELD_TITLE, entry_title); |
295 set_field_str_from_entry(tuple, FIELD_ARTIST, entry_artist); | 346 set_field_str_from_entry(tuple, FIELD_ARTIST, entry_artist); |
296 set_field_str_from_entry(tuple, FIELD_ALBUM, entry_album); | 347 set_field_str_from_entry(tuple, FIELD_ALBUM, entry_album); |
297 set_field_str_from_entry(tuple, FIELD_COMMENT, entry_comment); | 348 set_field_str_from_entry(tuple, FIELD_COMMENT, entry_comment); |
298 set_field_str_from_entry(tuple, FIELD_GENRE, entry_genre); | 349 set_field_str_from_entry(tuple, FIELD_GENRE, gtk_bin_get_child(GTK_BIN(entry_genre))); |
299 | 350 |
300 set_field_int_from_entry(tuple, FIELD_YEAR, entry_year); | 351 set_field_int_from_entry(tuple, FIELD_YEAR, entry_year); |
301 set_field_int_from_entry(tuple, FIELD_TRACK_NUMBER, entry_track); | 352 set_field_int_from_entry(tuple, FIELD_TRACK_NUMBER, entry_track); |
302 | 353 |
303 if(current_ip->update_song_tuple(tuple, fd)) { | 354 if(current_ip->update_song_tuple(tuple, fd)) { |
417 GtkWidget *table1; | 468 GtkWidget *table1; |
418 GtkWidget *bbox_close; | 469 GtkWidget *bbox_close; |
419 GtkWidget *btn_close; | 470 GtkWidget *btn_close; |
420 GtkWidget *alignment; | 471 GtkWidget *alignment; |
421 GtkWidget *separator; | 472 GtkWidget *separator; |
473 gint i; | |
422 | 474 |
423 fileinfo_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | 475 fileinfo_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
424 gtk_container_set_border_width(GTK_CONTAINER(fileinfo_win), 6); | 476 gtk_container_set_border_width(GTK_CONTAINER(fileinfo_win), 6); |
425 gtk_window_set_title(GTK_WINDOW(fileinfo_win), _("Track Information")); | 477 gtk_window_set_title(GTK_WINDOW(fileinfo_win), _("Track Information")); |
426 gtk_window_set_position(GTK_WINDOW(fileinfo_win), GTK_WIN_POS_CENTER); | 478 gtk_window_set_position(GTK_WINDOW(fileinfo_win), GTK_WIN_POS_CENTER); |
562 gtk_misc_set_alignment(GTK_MISC(label_genre), 0, 0.5); | 614 gtk_misc_set_alignment(GTK_MISC(label_genre), 0, 0.5); |
563 | 615 |
564 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); | 616 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
565 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); | 617 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
566 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); | 618 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 6, 0, 0); |
567 entry_genre = gtk_entry_new(); | 619 entry_genre = gtk_combo_box_entry_new_text(); |
620 | |
621 if (!genre_list) { | |
622 GList *iter; | |
623 | |
624 for (i = 0; i < G_N_ELEMENTS(genre_table); i++) | |
625 genre_list = g_list_prepend(genre_list, _(genre_table[i])); | |
626 genre_list = g_list_sort(genre_list, (GCompareFunc) g_ascii_strcasecmp); | |
627 | |
628 MOWGLI_ITER_FOREACH(iter, genre_list) | |
629 gtk_combo_box_append_text(GTK_COMBO_BOX(entry_genre), iter->data); | |
630 } | |
631 | |
568 gtk_container_add(GTK_CONTAINER(alignment), entry_genre); | 632 gtk_container_add(GTK_CONTAINER(alignment), entry_genre); |
569 g_signal_connect(G_OBJECT(entry_genre), "changed", (GCallback) entry_changed, NULL); | 633 g_signal_connect(G_OBJECT(entry_genre), "changed", (GCallback) entry_changed, NULL); |
570 | 634 |
571 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); | 635 alignment = gtk_alignment_new(0.5, 0.5, 1, 1); |
572 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); | 636 gtk_box_pack_start(GTK_BOX(vbox2), alignment, FALSE, FALSE, 0); |
660 | 724 |
661 set_entry_str_from_field(entry_title, tuple, FIELD_TITLE, updating_enabled); | 725 set_entry_str_from_field(entry_title, tuple, FIELD_TITLE, updating_enabled); |
662 set_entry_str_from_field(entry_artist, tuple, FIELD_ARTIST, updating_enabled); | 726 set_entry_str_from_field(entry_artist, tuple, FIELD_ARTIST, updating_enabled); |
663 set_entry_str_from_field(entry_album, tuple, FIELD_ALBUM, updating_enabled); | 727 set_entry_str_from_field(entry_album, tuple, FIELD_ALBUM, updating_enabled); |
664 set_entry_str_from_field(entry_comment, tuple, FIELD_COMMENT, updating_enabled); | 728 set_entry_str_from_field(entry_comment, tuple, FIELD_COMMENT, updating_enabled); |
665 set_entry_str_from_field(entry_genre, tuple, FIELD_GENRE, updating_enabled); | 729 set_entry_str_from_field(gtk_bin_get_child(GTK_BIN(entry_genre)), tuple, FIELD_GENRE, updating_enabled); |
666 | 730 |
667 tmp = g_strdup_printf("%s/%s", | 731 tmp = g_strdup_printf("%s/%s", |
668 tuple_get_string(tuple, FIELD_FILE_PATH, NULL), | 732 tuple_get_string(tuple, FIELD_FILE_PATH, NULL), |
669 tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); | 733 tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); |
670 if(tmp){ | 734 if(tmp){ |