61
|
1 /* XMMS - Cross-platform multimedia player
|
|
2 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
|
|
3 * Copyright (C) 1999,2000 Håvard Kvålen
|
|
4 * Copyright (C) 2002,2003,2004,2005 Daisuke Shimamura
|
|
5 *
|
|
6 * This program is free software; you can redistribute it and/or modify
|
|
7 * it under the terms of the GNU General Public License as published by
|
|
8 * the Free Software Foundation; either version 2 of the License, or
|
|
9 * (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 * GNU General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
19 */
|
|
20
|
|
21 #include <stdlib.h>
|
|
22 #include <string.h> /* for strlen() */
|
|
23 #include <sys/types.h>
|
|
24 #include <sys/stat.h>
|
|
25 #include <unistd.h>
|
|
26 #include <stdarg.h>
|
|
27 #include <gtk/gtk.h>
|
|
28
|
|
29 #include "FLAC/metadata.h"
|
|
30 #include "charset.h"
|
|
31 #include "configure.h"
|
|
32 #include "plugin_common/tags.h"
|
|
33 #include "plugin_common/locale_hack.h"
|
|
34
|
|
35 static GtkWidget *window = NULL;
|
|
36 static GList *genre_list = NULL;
|
|
37 static GtkWidget *filename_entry, *tag_frame;
|
|
38 static GtkWidget *title_entry, *artist_entry, *album_entry, *date_entry, *tracknum_entry, *comment_entry;
|
|
39 static GtkWidget *genre_combo;
|
|
40 static GtkWidget *flac_samplerate, *flac_channels, *flac_bits_per_sample, *flac_blocksize, *flac_filesize, *flac_samples, *flac_bitrate;
|
|
41
|
|
42 static gchar *current_filename = NULL;
|
|
43 static FLAC__StreamMetadata *tags_ = NULL;
|
|
44
|
|
45 static const gchar *vorbis_genres[] =
|
|
46 {
|
|
47 N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"),
|
|
48 N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"),
|
|
49 N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"),
|
|
50 N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"),
|
|
51 N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"),
|
|
52 N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"),
|
|
53 N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"),
|
|
54 N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"),
|
|
55 N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"),
|
|
56 N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("Alt"),
|
|
57 N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"),
|
|
58 N_("Meditative"), N_("Instrumental Pop"),
|
|
59 N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"),
|
|
60 N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"),
|
|
61 N_("Pop-Folk"), N_("Eurodance"), N_("Dream"),
|
|
62 N_("Southern Rock"), N_("Comedy"), N_("Cult"),
|
|
63 N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"),
|
|
64 N_("Pop/Funk"), N_("Jungle"), N_("Native American"),
|
|
65 N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"),
|
|
66 N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"),
|
|
67 N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"),
|
|
68 N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"),
|
|
69 N_("Folk/Rock"), N_("National Folk"), N_("Swing"),
|
|
70 N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"),
|
|
71 N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"),
|
|
72 N_("Gothic Rock"), N_("Progressive Rock"),
|
|
73 N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"),
|
|
74 N_("Big Band"), N_("Chorus"), N_("Easy Listening"),
|
|
75 N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"),
|
|
76 N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"),
|
|
77 N_("Booty Bass"), N_("Primus"), N_("Porn Groove"),
|
|
78 N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"),
|
|
79 N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"),
|
|
80 N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"),
|
|
81 N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"),
|
|
82 N_("Euro-House"), N_("Dance Hall"), N_("Goa"),
|
|
83 N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"),
|
|
84 N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"),
|
|
85 N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"),
|
|
86 N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"),
|
|
87 N_("Contemporary Christian"), N_("Christian Rock"),
|
|
88 N_("Merengue"), N_("Salsa"), N_("Thrash Metal"),
|
|
89 N_("Anime"), N_("JPop"), N_("Synthpop")
|
|
90 };
|
|
91
|
|
92 static void label_set_text(GtkWidget * label, char *str, ...)
|
|
93 {
|
|
94 va_list args;
|
|
95 gchar *tempstr;
|
|
96
|
|
97 va_start(args, str);
|
|
98 tempstr = g_strdup_vprintf(str, args);
|
|
99 va_end(args);
|
|
100
|
|
101 gtk_label_set_text(GTK_LABEL(label), tempstr);
|
|
102 g_free(tempstr);
|
|
103 }
|
|
104
|
|
105 static void set_entry_tag(GtkEntry * entry, const char * utf8)
|
|
106 {
|
|
107 if(utf8) {
|
|
108 if(flac_cfg.title.convert_char_set) {
|
|
109 char *text = convert_from_utf8_to_user(utf8);
|
|
110 gtk_entry_set_text(entry, text);
|
|
111 free(text);
|
|
112 }
|
|
113 else
|
|
114 gtk_entry_set_text(entry, utf8);
|
|
115 }
|
|
116 else
|
|
117 gtk_entry_set_text(entry, "");
|
|
118 }
|
|
119
|
|
120 static void get_entry_tag(GtkEntry * entry, const char *name)
|
|
121 {
|
|
122 gchar *text;
|
|
123 char *utf8;
|
|
124
|
248
|
125 text = g_strdup(gtk_entry_get_text(entry));
|
|
126 if (!text || strlen(text) == 0)
|
|
127 {
|
|
128 g_free(text);
|
61
|
129 return;
|
248
|
130 }
|
61
|
131 if(flac_cfg.title.convert_char_set)
|
|
132 utf8 = convert_from_user_to_utf8(text);
|
|
133 else
|
|
134 utf8 = text;
|
|
135
|
|
136 FLAC_plugin__tags_add_tag_utf8(tags_, name, utf8, /*separator=*/0);
|
|
137
|
|
138 if(flac_cfg.title.convert_char_set)
|
|
139 free(utf8);
|
248
|
140 g_free(text);
|
61
|
141 }
|
|
142
|
|
143 static void show_tag()
|
|
144 {
|
|
145 set_entry_tag(GTK_ENTRY(title_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TITLE"));
|
|
146 set_entry_tag(GTK_ENTRY(artist_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ARTIST"));
|
|
147 set_entry_tag(GTK_ENTRY(album_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ALBUM"));
|
|
148 set_entry_tag(GTK_ENTRY(date_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DATE"));
|
|
149 set_entry_tag(GTK_ENTRY(tracknum_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TRACKNUMBER"));
|
|
150 set_entry_tag(GTK_ENTRY(comment_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DESCRIPTION"));
|
|
151 set_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), FLAC_plugin__tags_get_tag_utf8(tags_, "GENRE"));
|
|
152 }
|
|
153
|
|
154 static void save_tag(GtkWidget * w, gpointer data)
|
|
155 {
|
|
156 (void)w;
|
|
157 (void)data;
|
|
158
|
|
159 FLAC_plugin__tags_delete_tag(tags_, "TITLE");
|
|
160 FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
|
|
161 FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
|
|
162 FLAC_plugin__tags_delete_tag(tags_, "DATE");
|
|
163 FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
|
|
164 FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
|
|
165 FLAC_plugin__tags_delete_tag(tags_, "GENRE");
|
|
166
|
|
167 get_entry_tag(GTK_ENTRY(title_entry) , "TITLE");
|
|
168 get_entry_tag(GTK_ENTRY(artist_entry) , "ARTIST");
|
|
169 get_entry_tag(GTK_ENTRY(album_entry) , "ALBUM");
|
|
170 get_entry_tag(GTK_ENTRY(date_entry) , "DATE");
|
|
171 get_entry_tag(GTK_ENTRY(tracknum_entry) , "TRACKNUMBER");
|
|
172 get_entry_tag(GTK_ENTRY(comment_entry) , "DESCRIPTION");
|
|
173 get_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), "GENRE");
|
|
174
|
|
175 FLAC_plugin__tags_set(current_filename, tags_);
|
|
176 gtk_widget_destroy(window);
|
|
177 }
|
|
178
|
|
179 static void remove_tag(GtkWidget * w, gpointer data)
|
|
180 {
|
|
181 (void)w;
|
|
182 (void)data;
|
|
183
|
|
184 FLAC_plugin__tags_delete_tag(tags_, "TITLE");
|
|
185 FLAC_plugin__tags_delete_tag(tags_, "ARTIST");
|
|
186 FLAC_plugin__tags_delete_tag(tags_, "ALBUM");
|
|
187 FLAC_plugin__tags_delete_tag(tags_, "DATE");
|
|
188 FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER");
|
|
189 FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION");
|
|
190 FLAC_plugin__tags_delete_tag(tags_, "GENRE");
|
|
191
|
|
192 FLAC_plugin__tags_set(current_filename, tags_);
|
|
193 gtk_widget_destroy(window);
|
|
194 }
|
|
195
|
|
196 static void show_file_info()
|
|
197 {
|
|
198 FLAC__StreamMetadata streaminfo;
|
|
199 struct stat _stat;
|
|
200
|
|
201 gtk_label_set_text(GTK_LABEL(flac_samplerate), "");
|
|
202 gtk_label_set_text(GTK_LABEL(flac_channels), "");
|
|
203 gtk_label_set_text(GTK_LABEL(flac_bits_per_sample), "");
|
|
204 gtk_label_set_text(GTK_LABEL(flac_blocksize), "");
|
|
205 gtk_label_set_text(GTK_LABEL(flac_filesize), "");
|
|
206 gtk_label_set_text(GTK_LABEL(flac_samples), "");
|
|
207 gtk_label_set_text(GTK_LABEL(flac_bitrate), "");
|
|
208
|
|
209 if(!FLAC__metadata_get_streaminfo(current_filename, &streaminfo)) {
|
|
210 return;
|
|
211 }
|
|
212
|
|
213 label_set_text(flac_samplerate, _("Samplerate: %d Hz"), streaminfo.data.stream_info.sample_rate);
|
|
214 label_set_text(flac_channels, _("Channels: %d"), streaminfo.data.stream_info.channels);
|
|
215 label_set_text(flac_bits_per_sample, _("Bits/Sample: %d"), streaminfo.data.stream_info.bits_per_sample);
|
|
216 if(streaminfo.data.stream_info.min_blocksize == streaminfo.data.stream_info.max_blocksize)
|
|
217 label_set_text(flac_blocksize, _("Blocksize: %d"), streaminfo.data.stream_info.min_blocksize);
|
|
218 else
|
|
219 label_set_text(flac_blocksize, _("Blocksize: variable\n min/max: %d/%d"), streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize);
|
|
220
|
|
221 if (streaminfo.data.stream_info.total_samples)
|
|
222 label_set_text(flac_samples, _("Samples: %llu\nLength: %d:%.2d"),
|
|
223 streaminfo.data.stream_info.total_samples,
|
|
224 (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate / 60),
|
|
225 (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60));
|
|
226
|
|
227 if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) {
|
|
228 label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size);
|
|
229 if (streaminfo.data.stream_info.total_samples)
|
|
230 label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/s\nCompression ratio: %.1f%%"),
|
|
231 8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate),
|
|
232 100.0 * (float)_stat.st_size / (float)(streaminfo.data.stream_info.bits_per_sample / 8 * streaminfo.data.stream_info.channels * streaminfo.data.stream_info.total_samples));
|
|
233 }
|
|
234 }
|
|
235
|
|
236 void FLAC_XMMS__file_info_box(char *filename)
|
|
237 {
|
|
238 unsigned i;
|
|
239 gchar *title;
|
|
240
|
|
241 if (!window)
|
|
242 {
|
|
243 GtkWidget *vbox, *hbox, *left_vbox, *table;
|
|
244 GtkWidget *flac_frame, *flac_box;
|
|
245 GtkWidget *label, *filename_hbox;
|
|
246 GtkWidget *bbox, *save, *remove, *cancel;
|
|
247
|
|
248 #warning FIX ME WAS GTK_WINDOW_DIALOG
|
|
249 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
250 gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
|
|
251 gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window);
|
|
252 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
|
|
253
|
|
254 vbox = gtk_vbox_new(FALSE, 10);
|
|
255 gtk_container_add(GTK_CONTAINER(window), vbox);
|
|
256
|
|
257 filename_hbox = gtk_hbox_new(FALSE, 5);
|
|
258 gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0);
|
|
259
|
|
260 label = gtk_label_new(_("Filename:"));
|
|
261 gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0);
|
|
262 filename_entry = gtk_entry_new();
|
|
263 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
|
|
264 gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0);
|
|
265
|
|
266 hbox = gtk_hbox_new(FALSE, 10);
|
|
267 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
|
|
268
|
|
269 left_vbox = gtk_vbox_new(FALSE, 10);
|
|
270 gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0);
|
|
271
|
|
272 tag_frame = gtk_frame_new(_("Tag:"));
|
|
273 gtk_box_pack_start(GTK_BOX(left_vbox), tag_frame, FALSE, FALSE, 0);
|
|
274
|
|
275 table = gtk_table_new(5, 5, FALSE);
|
|
276 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
|
|
277 gtk_container_add(GTK_CONTAINER(tag_frame), table);
|
|
278
|
|
279 label = gtk_label_new(_("Title:"));
|
|
280 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
281 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 5);
|
|
282
|
|
283 title_entry = gtk_entry_new();
|
|
284 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
285
|
|
286 label = gtk_label_new(_("Artist:"));
|
|
287 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
288 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 5, 5);
|
|
289
|
|
290 artist_entry = gtk_entry_new();
|
|
291 gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
292
|
|
293 label = gtk_label_new(_("Album:"));
|
|
294 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
295 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 5, 5);
|
|
296
|
|
297 album_entry = gtk_entry_new();
|
|
298 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
299
|
|
300 label = gtk_label_new(_("Comment:"));
|
|
301 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
302 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 5, 5);
|
|
303
|
|
304 comment_entry = gtk_entry_new();
|
|
305 gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
306
|
|
307 label = gtk_label_new(_("Date:"));
|
|
308 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
309 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 5, 5);
|
|
310
|
|
311 date_entry = gtk_entry_new();
|
|
312 gtk_widget_set_usize(date_entry, 40, -1);
|
|
313 gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
314
|
|
315 label = gtk_label_new(_("Track number:"));
|
|
316 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
317 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 5, 5);
|
|
318
|
|
319 tracknum_entry = gtk_entry_new();
|
|
320 gtk_widget_set_usize(tracknum_entry, 40, -1);
|
|
321 gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
322
|
|
323 label = gtk_label_new(_("Genre:"));
|
|
324 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
|
|
325 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 5, 5);
|
|
326
|
|
327 genre_combo = gtk_combo_new();
|
|
328 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), TRUE);
|
|
329
|
|
330 if (!genre_list)
|
|
331 {
|
|
332 for (i = 0; i < sizeof(vorbis_genres) / sizeof(*vorbis_genres) ; i++)
|
|
333 genre_list = g_list_prepend(genre_list, (char *)vorbis_genres[i]);
|
|
334 genre_list = g_list_prepend(genre_list, "");
|
|
335 genre_list = g_list_sort(genre_list, (GCompareFunc)g_strcasecmp);
|
|
336 }
|
|
337 gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list);
|
|
338
|
|
339 gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
|
|
340
|
|
341 bbox = gtk_hbutton_box_new();
|
|
342 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
|
343 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
|
|
344 gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0);
|
|
345
|
|
346 save = gtk_button_new_with_label(_("Save"));
|
|
347 gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_tag), NULL);
|
|
348 GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT);
|
|
349 gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0);
|
|
350 gtk_widget_grab_default(save);
|
|
351
|
|
352 remove= gtk_button_new_with_label(_("Remove Tag"));
|
|
353 gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(remove_tag), NULL);
|
|
354 GTK_WIDGET_SET_FLAGS(remove, GTK_CAN_DEFAULT);
|
|
355 gtk_box_pack_start(GTK_BOX(bbox), remove, TRUE, TRUE, 0);
|
|
356
|
|
357 cancel = gtk_button_new_with_label(_("Cancel"));
|
|
358 gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window));
|
|
359 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
|
|
360 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
|
|
361
|
|
362 flac_frame = gtk_frame_new(_("FLAC Info:"));
|
|
363 gtk_box_pack_start(GTK_BOX(hbox), flac_frame, FALSE, FALSE, 0);
|
|
364
|
|
365 flac_box = gtk_vbox_new(FALSE, 5);
|
|
366 gtk_container_add(GTK_CONTAINER(flac_frame), flac_box);
|
|
367 gtk_container_set_border_width(GTK_CONTAINER(flac_box), 10);
|
|
368 gtk_box_set_spacing(GTK_BOX(flac_box), 0);
|
|
369
|
|
370 flac_samplerate = gtk_label_new("");
|
|
371 gtk_misc_set_alignment(GTK_MISC(flac_samplerate), 0, 0);
|
|
372 gtk_label_set_justify(GTK_LABEL(flac_samplerate), GTK_JUSTIFY_LEFT);
|
|
373 gtk_box_pack_start(GTK_BOX(flac_box), flac_samplerate, FALSE, FALSE, 0);
|
|
374
|
|
375 flac_channels = gtk_label_new("");
|
|
376 gtk_misc_set_alignment(GTK_MISC(flac_channels), 0, 0);
|
|
377 gtk_label_set_justify(GTK_LABEL(flac_channels), GTK_JUSTIFY_LEFT);
|
|
378 gtk_box_pack_start(GTK_BOX(flac_box), flac_channels, FALSE, FALSE, 0);
|
|
379
|
|
380 flac_bits_per_sample = gtk_label_new("");
|
|
381 gtk_misc_set_alignment(GTK_MISC(flac_bits_per_sample), 0, 0);
|
|
382 gtk_label_set_justify(GTK_LABEL(flac_bits_per_sample), GTK_JUSTIFY_LEFT);
|
|
383 gtk_box_pack_start(GTK_BOX(flac_box), flac_bits_per_sample, FALSE, FALSE, 0);
|
|
384
|
|
385 flac_blocksize = gtk_label_new("");
|
|
386 gtk_misc_set_alignment(GTK_MISC(flac_blocksize), 0, 0);
|
|
387 gtk_label_set_justify(GTK_LABEL(flac_blocksize), GTK_JUSTIFY_LEFT);
|
|
388 gtk_box_pack_start(GTK_BOX(flac_box), flac_blocksize, FALSE, FALSE, 0);
|
|
389
|
|
390 flac_filesize = gtk_label_new("");
|
|
391 gtk_misc_set_alignment(GTK_MISC(flac_filesize), 0, 0);
|
|
392 gtk_label_set_justify(GTK_LABEL(flac_filesize), GTK_JUSTIFY_LEFT);
|
|
393 gtk_box_pack_start(GTK_BOX(flac_box), flac_filesize, FALSE, FALSE, 0);
|
|
394
|
|
395 flac_samples = gtk_label_new("");
|
|
396 gtk_misc_set_alignment(GTK_MISC(flac_samples), 0, 0);
|
|
397 gtk_label_set_justify(GTK_LABEL(flac_samples), GTK_JUSTIFY_LEFT);
|
|
398 gtk_box_pack_start(GTK_BOX(flac_box), flac_samples, FALSE, FALSE, 0);
|
|
399
|
|
400 flac_bitrate = gtk_label_new("");
|
|
401 gtk_misc_set_alignment(GTK_MISC(flac_bitrate), 0, 0);
|
|
402 gtk_label_set_justify(GTK_LABEL(flac_bitrate), GTK_JUSTIFY_LEFT);
|
|
403 gtk_box_pack_start(GTK_BOX(flac_box), flac_bitrate, FALSE, FALSE, 0);
|
|
404
|
|
405 gtk_widget_show_all(window);
|
|
406 }
|
|
407
|
|
408 if(current_filename)
|
|
409 g_free(current_filename);
|
|
410 if(!(current_filename = g_strdup(filename)))
|
|
411 return;
|
|
412
|
|
413 title = g_strdup_printf(_("File Info - %s"), g_basename(filename));
|
|
414 gtk_window_set_title(GTK_WINDOW(window), title);
|
|
415 g_free(title);
|
|
416
|
|
417 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename);
|
|
418 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
|
|
419
|
|
420 if(tags_)
|
|
421 FLAC_plugin__tags_destroy(&tags_);
|
|
422
|
|
423 FLAC_plugin__tags_get(current_filename, &tags_);
|
|
424
|
|
425 show_tag();
|
|
426 show_file_info();
|
|
427
|
|
428 gtk_widget_set_sensitive(tag_frame, TRUE);
|
|
429 }
|