Mercurial > audlegacy
annotate Plugins/Input/mpg123/fileinfo.c @ 1121:75ac6ae39225 trunk
[svn] - add section concerning the MP3 patents and commercial use
author | nenolod |
---|---|
date | Tue, 30 May 2006 23:28:14 -0700 |
parents | 4be4d74db123 |
children | f12d7e208b43 |
rev | line source |
---|---|
61 | 1 /* BMP - Cross-platform multimedia player |
2 * Copyright (C) 2003-2004 BMP development team. | |
3 * | |
4 * Based on XMMS: | |
5 * Copyright (C) 1998-2003 XMMS development team. | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 */ | |
21 | |
22 #include "mpg123.h" | |
23 | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
24 #include <tag_c.h> |
964 | 25 #include "tag_c_hacked.h" |
61 | 26 |
27 #include <glib.h> | |
28 #include <glib/gi18n.h> | |
29 #include <gtk/gtk.h> | |
30 #include <gdk/gdkkeysyms.h> | |
31 #include <stdio.h> | |
32 #include <stdlib.h> | |
33 #include <string.h> | |
34 #include <stdarg.h> | |
35 | |
36 #include <unistd.h> | |
37 #include <fcntl.h> | |
38 #include <errno.h> | |
39 | |
40 #include "audacious/util.h" | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
41 #include "libaudacious/util.h" |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
42 #include "libaudacious/vfs.h" |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
43 #include "libaudacious/xentry.h" |
61 | 44 |
45 #include "mp3.xpm" | |
46 | |
47 static GtkWidget *window = NULL; | |
48 static GtkWidget *filename_entry, *id3_frame; | |
49 static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry, | |
50 *tracknum_entry, *comment_entry; | |
51 static GtkWidget *genre_combo; | |
52 static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags, | |
993
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
53 *mpeg_error, *mpeg_copy, *mpeg_orig, *mpeg_emph, *mpeg_filesize; |
61 | 54 static GtkWidget *mpeg_level_val, *mpeg_bitrate_val, *mpeg_samplerate_val, |
55 *mpeg_error_val, *mpeg_copy_val, *mpeg_orig_val, *mpeg_emph_val, | |
993
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
56 *mpeg_filesize_val, *mpeg_flags_val; |
61 | 57 |
58 GtkWidget *vbox, *hbox, *left_vbox, *table; | |
59 GtkWidget *mpeg_frame, *mpeg_box; | |
60 GtkWidget *label, *filename_vbox; | |
61 GtkWidget *bbox; | |
62 GtkWidget *remove_id3, *cancel, *save; | |
63 GtkWidget *boxx; | |
64 | |
65 VFSFile *fh; | |
66 const gchar *emphasis[4]; | |
67 const gchar *bool_label[2]; | |
68 | |
69 static GList *genre_list = NULL; | |
70 static gchar *current_filename = NULL; | |
71 | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
72 extern gchar *mpgdec_filename; |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
73 extern gint mpgdec_bitrate, mpgdec_frequency, mpgdec_layer, mpgdec_lsf, |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
74 mpgdec_mode; |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
75 extern gboolean mpgdec_stereo, mpgdec_mpeg25; |
61 | 76 |
77 glong info_rate; | |
78 | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
79 static TagLib_File *taglib_file; |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
80 static TagLib_Tag *taglib_tag; |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
81 static const TagLib_AudioProperties *taglib_ap; |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
82 |
61 | 83 void fill_entries(GtkWidget * w, gpointer data); |
84 | |
85 #define MAX_STR_LEN 100 | |
86 | |
87 static gint | |
88 genre_comp_func(gconstpointer a, gconstpointer b) | |
89 { | |
90 return strcasecmp(a, b); | |
91 } | |
92 | |
93 static gboolean | |
94 fileinfo_keypress_cb(GtkWidget * widget, | |
95 GdkEventKey * event, | |
96 gpointer data) | |
97 { | |
98 if (!event) | |
99 return FALSE; | |
100 | |
101 switch (event->keyval) { | |
102 case GDK_Escape: | |
103 gtk_widget_destroy(window); | |
104 break; | |
105 default: | |
106 return FALSE; | |
107 } | |
108 | |
109 return TRUE; | |
110 } | |
111 | |
112 static void | |
113 save_cb(GtkWidget * w, gpointer data) | |
114 { | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
115 int result; |
61 | 116 |
117 if (str_has_prefix_nocase(current_filename, "http://")) | |
118 return; | |
119 | |
964 | 120 taglib_set_strings_unicode(1); |
121 | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
122 taglib_file = taglib_file_new(current_filename); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
123 if(taglib_file) { |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
124 taglib_tag = taglib_file_tag(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
125 taglib_ap = taglib_file_audioproperties(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
126 } else return; |
61 | 127 |
964 | 128 taglib_set_id3v2_default_text_encoding(); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
129 taglib_tag_set_title(taglib_tag, gtk_entry_get_text(GTK_ENTRY(title_entry))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
130 taglib_tag_set_artist(taglib_tag, gtk_entry_get_text(GTK_ENTRY(artist_entry))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
131 taglib_tag_set_album(taglib_tag, gtk_entry_get_text(GTK_ENTRY(album_entry))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
132 taglib_tag_set_comment(taglib_tag, gtk_entry_get_text(GTK_ENTRY(comment_entry))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
133 taglib_tag_set_year(taglib_tag, atoi(gtk_entry_get_text(GTK_ENTRY(year_entry)))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
134 taglib_tag_set_track(taglib_tag, atoi(gtk_entry_get_text(GTK_ENTRY(tracknum_entry)))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
135 taglib_tag_set_genre(taglib_tag, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry))); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
136 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
137 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
61 | 138 |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
139 result = taglib_file_save(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
140 taglib_file_free(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
141 taglib_tag_free_strings(); |
61 | 142 } |
143 | |
144 static void | |
145 label_set_text(GtkWidget * label, gchar * str, ...) | |
146 { | |
147 va_list args; | |
148 gchar tempstr[MAX_STR_LEN]; | |
149 | |
150 va_start(args, str); | |
151 g_vsnprintf(tempstr, MAX_STR_LEN, str, args); | |
152 va_end(args); | |
153 | |
154 gtk_label_set_text(GTK_LABEL(label), tempstr); | |
155 } | |
156 | |
157 static void | |
158 remove_id3_cb(GtkWidget * w, gpointer data) | |
159 { | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
160 int result; |
61 | 161 |
162 if (str_has_prefix_nocase(current_filename, "http://")) | |
163 return; | |
164 | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
165 taglib_file = taglib_file_new(current_filename); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
166 if(taglib_file) { |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
167 taglib_tag = taglib_file_tag(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
168 taglib_ap = taglib_file_audioproperties(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
169 } else return; |
61 | 170 |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
171 taglib_tag_set_title(taglib_tag, ""); |
61 | 172 gtk_entry_set_text(GTK_ENTRY(title_entry), ""); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
173 taglib_tag_set_artist(taglib_tag, ""); |
61 | 174 gtk_entry_set_text(GTK_ENTRY(artist_entry), ""); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
175 taglib_tag_set_album(taglib_tag, ""); |
61 | 176 gtk_entry_set_text(GTK_ENTRY(album_entry), ""); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
177 taglib_tag_set_comment(taglib_tag, ""); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
178 gtk_entry_set_text(GTK_ENTRY(comment_entry), ""); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
179 taglib_tag_set_year(taglib_tag, 0); |
61 | 180 gtk_entry_set_text(GTK_ENTRY(year_entry), ""); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
181 taglib_tag_set_track(taglib_tag, 0); |
61 | 182 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
183 taglib_tag_set_genre(taglib_tag, ""); |
61 | 184 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), ""); |
185 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE); | |
186 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
187 |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
188 result = taglib_file_save(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
189 taglib_file_free(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
190 taglib_tag_free_strings(); |
61 | 191 } |
192 | |
193 static void | |
194 set_mpeg_level_label(gboolean mpeg25, gint lsf, gint layer) | |
195 { | |
196 if (mpeg25) | |
197 label_set_text(mpeg_level_val, "MPEG-2.5 Layer %d", layer); | |
198 else | |
199 label_set_text(mpeg_level_val, "MPEG-%d Layer %d", lsf + 1, layer); | |
200 } | |
201 | |
202 static const gchar * | |
203 channel_mode_name(gint mode) | |
204 { | |
205 static const gchar *channel_mode[] = { N_("Stereo"), N_("Joint stereo"), | |
206 N_("Dual channel"), N_("Single channel") | |
207 }; | |
208 if (mode < 0 || mode > 3) | |
209 return ""; | |
210 | |
211 return gettext(channel_mode[mode]); | |
212 } | |
213 | |
214 static void | |
215 file_info_http(gchar * filename) | |
216 { | |
217 gtk_widget_set_sensitive(id3_frame, FALSE); | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
218 if (mpgdec_filename && !strcmp(filename, mpgdec_filename) && |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
219 mpgdec_bitrate != 0) { |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
220 set_mpeg_level_label(mpgdec_mpeg25, mpgdec_lsf, mpgdec_layer); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
221 label_set_text(mpeg_bitrate_val, _("%d KBit/s"), mpgdec_bitrate); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
222 label_set_text(mpeg_samplerate_val, _("%ld Hz"), mpgdec_frequency); |
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
223 label_set_text(mpeg_flags, "%s", channel_mode_name(mpgdec_mode)); |
61 | 224 } |
225 } | |
226 | |
227 static void | |
228 change_buttons(GtkObject * object) | |
229 { | |
230 gtk_widget_set_sensitive(GTK_WIDGET(object), TRUE); | |
231 } | |
232 | |
233 void | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
234 mpgdec_file_info_box(gchar * filename) |
61 | 235 { |
236 gint i; | |
237 gchar *title, *filename_utf8; | |
238 | |
239 emphasis[0] = _("None"); | |
240 emphasis[1] = _("50/15 ms"); | |
241 emphasis[2] = ""; | |
242 emphasis[3] = _("CCIT J.17"); | |
243 bool_label[0] = _("No"); | |
244 bool_label[1] = _("Yes"); | |
245 | |
246 if (!window) { | |
247 GtkWidget *pixmapwid; | |
248 GdkPixbuf *pixbuf; | |
249 PangoAttrList *attrs; | |
250 PangoAttribute *attr; | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
251 GtkWidget *test_table = gtk_table_new(2, 11, FALSE); |
61 | 252 GtkWidget *urk, *blark; |
253 | |
254 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
255 gtk_window_set_type_hint(GTK_WINDOW(window), | |
256 GDK_WINDOW_TYPE_HINT_DIALOG); | |
257 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); | |
258 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); | |
259 g_signal_connect(G_OBJECT(window), "destroy", | |
260 G_CALLBACK(gtk_widget_destroyed), &window); | |
261 gtk_container_set_border_width(GTK_CONTAINER(window), 10); | |
262 | |
263 vbox = gtk_vbox_new(FALSE, 10); | |
264 gtk_container_add(GTK_CONTAINER(window), vbox); | |
265 | |
266 | |
267 filename_vbox = gtk_hbox_new(FALSE, 5); | |
268 gtk_box_pack_start(GTK_BOX(vbox), filename_vbox, FALSE, TRUE, 0); | |
269 | |
270 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) | |
271 gnome_mime_audio_xpm); | |
272 pixmapwid = gtk_image_new_from_pixbuf(pixbuf); | |
273 g_object_unref(pixbuf); | |
274 gtk_misc_set_alignment(GTK_MISC(pixmapwid), 0, 0); | |
275 gtk_box_pack_start(GTK_BOX(filename_vbox), pixmapwid, FALSE, FALSE, | |
276 0); | |
277 | |
278 label = gtk_label_new(NULL); | |
279 | |
280 attrs = pango_attr_list_new(); | |
281 | |
282 attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); | |
283 attr->start_index = 0; | |
284 attr->end_index = -1; | |
285 pango_attr_list_insert(attrs, attr); | |
286 | |
287 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
288 gtk_label_set_text(GTK_LABEL(label), _("Name:")); | |
289 gtk_box_pack_start(GTK_BOX(filename_vbox), label, FALSE, FALSE, 0); | |
290 | |
291 filename_entry = gtk_entry_new(); | |
292 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); | |
293 gtk_box_pack_start(GTK_BOX(filename_vbox), filename_entry, TRUE, | |
294 TRUE, 0); | |
295 | |
296 hbox = gtk_hbox_new(FALSE, 10); | |
297 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); | |
298 | |
299 left_vbox = gtk_table_new(2, 4, FALSE); | |
300 gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); | |
301 | |
302 /* MPEG-Info window */ | |
303 | |
304 mpeg_frame = gtk_frame_new(_(" MPEG Info ")); | |
305 gtk_table_attach(GTK_TABLE(left_vbox), mpeg_frame, 0, 2, 0, 1, | |
306 GTK_FILL, GTK_FILL, 0, 4); | |
307 | |
308 mpeg_box = gtk_vbox_new(FALSE, 5); | |
309 gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_box); | |
310 gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); | |
311 gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); | |
312 | |
313 /* MPEG Layer Info */ | |
314 | |
315 /* FIXME: Obvious... */ | |
316 gtk_container_set_border_width(GTK_CONTAINER(test_table), 0); | |
317 gtk_container_add(GTK_CONTAINER(mpeg_box), test_table); | |
318 | |
319 mpeg_level = gtk_label_new(_("MPEG Level:")); | |
320 gtk_misc_set_alignment(GTK_MISC(mpeg_level), 1, 0.5); | |
321 gtk_label_set_justify(GTK_LABEL(mpeg_level), GTK_JUSTIFY_RIGHT); | |
322 gtk_label_set_attributes(GTK_LABEL(mpeg_level), attrs); | |
323 gtk_table_attach(GTK_TABLE(test_table), mpeg_level, 0, 1, 0, 1, | |
324 GTK_FILL, GTK_FILL, 5, 2); | |
325 | |
326 mpeg_level_val = gtk_label_new(""); | |
327 gtk_misc_set_alignment(GTK_MISC(mpeg_level_val), 0, 0); | |
328 gtk_label_set_justify(GTK_LABEL(mpeg_level_val), GTK_JUSTIFY_LEFT); | |
329 gtk_table_attach(GTK_TABLE(test_table), mpeg_level_val, 1, 2, 0, 1, | |
330 GTK_FILL, GTK_FILL, 10, 2); | |
331 | |
332 mpeg_bitrate = gtk_label_new(_("Bit rate:")); | |
333 gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 1, 0.5); | |
334 gtk_label_set_justify(GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_RIGHT); | |
335 gtk_label_set_attributes(GTK_LABEL(mpeg_bitrate), attrs); | |
336 gtk_table_attach(GTK_TABLE(test_table), mpeg_bitrate, 0, 1, 1, 2, | |
337 GTK_FILL, GTK_FILL, 5, 2); | |
338 | |
339 mpeg_bitrate_val = gtk_label_new(""); | |
340 gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate_val), 0, 0); | |
341 gtk_label_set_justify(GTK_LABEL(mpeg_bitrate_val), GTK_JUSTIFY_LEFT); | |
342 gtk_table_attach(GTK_TABLE(test_table), mpeg_bitrate_val, 1, 2, 1, | |
343 2, GTK_FILL, GTK_FILL, 10, 2); | |
344 | |
345 mpeg_samplerate = gtk_label_new(_("Sample rate:")); | |
346 gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 1, 0.5); | |
347 gtk_label_set_justify(GTK_LABEL(mpeg_samplerate), GTK_JUSTIFY_RIGHT); | |
348 gtk_label_set_attributes(GTK_LABEL(mpeg_samplerate), attrs); | |
349 gtk_table_attach(GTK_TABLE(test_table), mpeg_samplerate, 0, 1, 2, | |
350 3, GTK_FILL, GTK_FILL, 5, 2); | |
351 | |
352 mpeg_samplerate_val = gtk_label_new(""); | |
353 gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate_val), 0, 0); | |
354 gtk_label_set_justify(GTK_LABEL(mpeg_samplerate_val), | |
355 GTK_JUSTIFY_LEFT); | |
356 gtk_table_attach(GTK_TABLE(test_table), mpeg_samplerate_val, 1, 2, | |
357 2, 3, GTK_FILL, GTK_FILL, 10, 2); | |
358 | |
359 mpeg_filesize = gtk_label_new(_("File size:")); | |
360 gtk_misc_set_alignment(GTK_MISC(mpeg_filesize), 1, 0.5); | |
361 gtk_label_set_justify(GTK_LABEL(mpeg_filesize), GTK_JUSTIFY_RIGHT); | |
362 gtk_label_set_attributes(GTK_LABEL(mpeg_filesize), attrs); | |
363 gtk_table_attach(GTK_TABLE(test_table), mpeg_filesize, 0, 1, 4, 5, | |
364 GTK_FILL, GTK_FILL, 5, 2); | |
365 | |
366 mpeg_filesize_val = gtk_label_new(""); | |
367 gtk_misc_set_alignment(GTK_MISC(mpeg_filesize_val), 0, 0); | |
368 gtk_label_set_justify(GTK_LABEL(mpeg_filesize_val), GTK_JUSTIFY_LEFT); | |
369 gtk_table_attach(GTK_TABLE(test_table), mpeg_filesize_val, 1, 2, 4, | |
370 5, GTK_FILL, GTK_FILL, 10, 2); | |
371 | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
372 mpeg_flags = gtk_label_new(_("Mode:")); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
373 gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 1, 0.5); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
374 gtk_label_set_justify(GTK_LABEL(mpeg_flags), GTK_JUSTIFY_RIGHT); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
375 gtk_label_set_attributes(GTK_LABEL(mpeg_flags), attrs); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
376 gtk_table_attach(GTK_TABLE(test_table), mpeg_flags, 0, 1, 5, 6, |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
377 GTK_FILL, GTK_FILL, 5, 2); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
378 |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
379 mpeg_flags_val = gtk_label_new(""); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
380 gtk_misc_set_alignment(GTK_MISC(mpeg_flags_val), 0, 0); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
381 gtk_label_set_justify(GTK_LABEL(mpeg_flags_val), GTK_JUSTIFY_LEFT); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
382 gtk_table_attach(GTK_TABLE(test_table), mpeg_flags_val, 1, 2, 5, |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
383 6, GTK_FILL, GTK_FILL, 10, 2); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
384 |
61 | 385 urk = gtk_label_new(""); |
386 blark = gtk_label_new(""); | |
387 gtk_misc_set_alignment(GTK_MISC(urk), 1, 0.5); | |
388 gtk_misc_set_alignment(GTK_MISC(blark), 0, 0); | |
389 | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
390 gtk_table_attach(GTK_TABLE(test_table), urk, 0, 1, 6, 7, GTK_FILL, |
61 | 391 GTK_FILL, 5, 5); |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
392 gtk_table_attach(GTK_TABLE(test_table), blark, 1, 2, 6, 7, |
61 | 393 GTK_FILL, GTK_FILL, 10, 5); |
394 | |
395 mpeg_error = gtk_label_new(_("Error Protection:")); | |
396 gtk_misc_set_alignment(GTK_MISC(mpeg_error), 1, 0.5); | |
397 gtk_label_set_justify(GTK_LABEL(mpeg_error), GTK_JUSTIFY_RIGHT); | |
398 gtk_label_set_attributes(GTK_LABEL(mpeg_error), attrs); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
399 gtk_table_attach(GTK_TABLE(test_table), mpeg_error, 0, 1, 7, 8, |
61 | 400 GTK_FILL, GTK_FILL, 5, 0); |
401 | |
402 mpeg_error_val = gtk_label_new(""); | |
403 gtk_misc_set_alignment(GTK_MISC(mpeg_error_val), 0, 0); | |
404 gtk_label_set_justify(GTK_LABEL(mpeg_error_val), GTK_JUSTIFY_LEFT); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
405 gtk_table_attach(GTK_TABLE(test_table), mpeg_error_val, 1, 2, 7, 8, |
61 | 406 GTK_FILL, GTK_FILL, 10, 2); |
407 | |
408 mpeg_copy = gtk_label_new(_("Copyright:")); | |
409 gtk_misc_set_alignment(GTK_MISC(mpeg_copy), 1, 0.5); | |
410 gtk_label_set_justify(GTK_LABEL(mpeg_copy), GTK_JUSTIFY_RIGHT); | |
411 gtk_label_set_attributes(GTK_LABEL(mpeg_copy), attrs); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
412 gtk_table_attach(GTK_TABLE(test_table), mpeg_copy, 0, 1, 8, 9, |
61 | 413 GTK_FILL, GTK_FILL, 5, 2); |
414 | |
415 mpeg_copy_val = gtk_label_new(""); | |
416 gtk_misc_set_alignment(GTK_MISC(mpeg_copy_val), 0, 0); | |
417 gtk_label_set_justify(GTK_LABEL(mpeg_copy_val), GTK_JUSTIFY_LEFT); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
418 gtk_table_attach(GTK_TABLE(test_table), mpeg_copy_val, 1, 2, 8, 9, |
61 | 419 GTK_FILL, GTK_FILL, 10, 2); |
420 | |
421 mpeg_orig = gtk_label_new(_("Original:")); | |
422 gtk_misc_set_alignment(GTK_MISC(mpeg_orig), 1, 0.5); | |
423 gtk_label_set_justify(GTK_LABEL(mpeg_orig), GTK_JUSTIFY_RIGHT); | |
424 gtk_label_set_attributes(GTK_LABEL(mpeg_orig), attrs); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
425 gtk_table_attach(GTK_TABLE(test_table), mpeg_orig, 0, 1, 9, 10, |
61 | 426 GTK_FILL, GTK_FILL, 5, 2); |
427 | |
428 mpeg_orig_val = gtk_label_new(""); | |
429 gtk_misc_set_alignment(GTK_MISC(mpeg_orig_val), 0, 0); | |
430 gtk_label_set_justify(GTK_LABEL(mpeg_orig_val), GTK_JUSTIFY_LEFT); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
431 gtk_table_attach(GTK_TABLE(test_table), mpeg_orig_val, 1, 2, 9, 10, |
61 | 432 GTK_FILL, GTK_FILL, 10, 2); |
433 | |
434 mpeg_emph = gtk_label_new(_("Emphasis:")); | |
435 gtk_misc_set_alignment(GTK_MISC(mpeg_emph), 1, 0.5); | |
436 gtk_label_set_justify(GTK_LABEL(mpeg_emph), GTK_JUSTIFY_RIGHT); | |
437 gtk_label_set_attributes(GTK_LABEL(mpeg_emph), attrs); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
438 gtk_table_attach(GTK_TABLE(test_table), mpeg_emph, 0, 1, 10, 11, |
61 | 439 GTK_FILL, GTK_FILL, 5, 2); |
440 | |
441 mpeg_emph_val = gtk_label_new(""); | |
442 gtk_misc_set_alignment(GTK_MISC(mpeg_emph_val), 0, 0); | |
443 gtk_label_set_justify(GTK_LABEL(mpeg_emph_val), GTK_JUSTIFY_LEFT); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
444 gtk_table_attach(GTK_TABLE(test_table), mpeg_emph_val, 1, 2, 10, 11, |
61 | 445 GTK_FILL, GTK_FILL, 10, 2); |
446 | |
447 | |
448 id3_frame = gtk_frame_new(_(" ID3 Tag ")); | |
449 gtk_table_attach(GTK_TABLE(left_vbox), id3_frame, 2, 4, 0, 1, | |
450 GTK_FILL, GTK_FILL, 0, 4); | |
451 | |
452 table = gtk_table_new(7, 5, FALSE); | |
453 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
454 gtk_container_add(GTK_CONTAINER(id3_frame), table); | |
455 | |
456 label = gtk_label_new(_("Title:")); | |
457 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
458 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
459 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, | |
460 GTK_FILL, 5, 5); | |
461 | |
462 title_entry = gtk_entry_new(); | |
463 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 6, 0, 1, | |
464 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
465 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
466 | |
467 label = gtk_label_new(_("Artist:")); | |
468 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
469 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
470 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, | |
471 GTK_FILL, 5, 5); | |
472 | |
473 artist_entry = gtk_entry_new(); | |
474 gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 6, 1, 2, | |
475 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
476 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
477 | |
478 label = gtk_label_new(_("Album:")); | |
479 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
480 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
481 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, | |
482 GTK_FILL, 5, 5); | |
483 | |
484 album_entry = gtk_entry_new(); | |
485 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 6, 2, 3, | |
486 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
487 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
488 | |
489 label = gtk_label_new(_("Comment:")); | |
490 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
491 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
492 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, | |
493 GTK_FILL, 5, 5); | |
494 | |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
495 comment_entry = gtk_entry_new(); |
983 | 496 gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 6, 3, 4, |
61 | 497 GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
498 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
499 | |
500 label = gtk_label_new(_("Year:")); | |
501 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
502 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
503 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, | |
504 GTK_FILL, 5, 5); | |
505 | |
506 year_entry = gtk_entry_new_with_max_length(4); | |
507 gtk_entry_set_width_chars(GTK_ENTRY(year_entry),4); | |
508 gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5, | |
509 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
510 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
511 | |
512 label = gtk_label_new(_("Track number:")); | |
513 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
514 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
515 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL, | |
516 GTK_FILL, 5, 5); | |
517 | |
518 tracknum_entry = gtk_entry_new_with_max_length(3); | |
519 gtk_widget_set_usize(tracknum_entry, 40, -1); | |
520 gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, | |
521 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
522 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
523 | |
524 label = gtk_label_new(_("Genre:")); | |
525 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
526 gtk_label_set_attributes(GTK_LABEL(label), attrs); | |
527 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, | |
528 GTK_FILL, 5, 5); | |
529 | |
530 pango_attr_list_unref(attrs); | |
531 | |
532 genre_combo = gtk_combo_new(); | |
533 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), | |
534 FALSE); | |
535 if (!genre_list) { | |
536 for (i = 0; i < GENRE_MAX; i++) | |
537 genre_list = | |
538 g_list_prepend(genre_list, | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
539 (gchar *) mpgdec_id3_genres[i]); |
61 | 540 genre_list = g_list_prepend(genre_list, ""); |
541 genre_list = g_list_sort(genre_list, genre_comp_func); | |
542 } | |
543 gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list); | |
544 | |
545 gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 6, 5, 6, | |
546 GTK_FILL | GTK_EXPAND | GTK_SHRINK, | |
547 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); | |
548 | |
549 boxx = gtk_hbutton_box_new(); | |
550 gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD); | |
551 | |
552 remove_id3 = gtk_button_new_from_stock(GTK_STOCK_DELETE); | |
553 gtk_container_add(GTK_CONTAINER(boxx), remove_id3); | |
554 | |
555 save = gtk_button_new_from_stock(GTK_STOCK_SAVE); | |
556 gtk_container_add(GTK_CONTAINER(boxx), save); | |
557 | |
558 g_signal_connect(G_OBJECT(remove_id3), "clicked", | |
559 G_CALLBACK(remove_id3_cb), save); | |
560 g_signal_connect(G_OBJECT(save), "clicked", G_CALLBACK(save_cb), | |
561 remove_id3); | |
562 | |
563 gtk_table_attach(GTK_TABLE(table), boxx, 0, 5, 6, 7, GTK_FILL, 0, | |
564 0, 8); | |
565 | |
566 bbox = gtk_hbutton_box_new(); | |
567 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); | |
568 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); | |
569 gtk_table_attach(GTK_TABLE(left_vbox), bbox, 0, 4, 1, 2, GTK_FILL, | |
570 0, 0, 8); | |
571 | |
572 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
573 g_signal_connect_swapped(G_OBJECT(cancel), "clicked", | |
574 G_CALLBACK(gtk_widget_destroy), | |
575 G_OBJECT(window)); | |
576 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); | |
577 gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0); | |
578 gtk_widget_grab_default(cancel); | |
579 | |
580 | |
581 gtk_table_set_col_spacing(GTK_TABLE(left_vbox), 1, 10); | |
582 | |
583 | |
584 g_signal_connect_swapped(G_OBJECT(title_entry), "changed", | |
585 G_CALLBACK(change_buttons), save); | |
586 g_signal_connect_swapped(G_OBJECT(artist_entry), "changed", | |
587 G_CALLBACK(change_buttons), save); | |
588 g_signal_connect_swapped(G_OBJECT(album_entry), "changed", | |
589 G_CALLBACK(change_buttons), save); | |
590 g_signal_connect_swapped(G_OBJECT(year_entry), "changed", | |
591 G_CALLBACK(change_buttons), save); | |
592 g_signal_connect_swapped(G_OBJECT(comment_entry), "changed", | |
593 G_CALLBACK(change_buttons), save); | |
594 g_signal_connect_swapped(G_OBJECT(tracknum_entry), "changed", | |
595 G_CALLBACK(change_buttons), save); | |
596 g_signal_connect_swapped(G_OBJECT(GTK_COMBO(genre_combo)->entry), "changed", | |
597 G_CALLBACK(change_buttons), save); | |
598 | |
599 /* Nonsence, should i remove this altogether? | |
600 causes changes to be saved as you type - | |
601 makes save /revert buttons pointless | |
602 g_signal_connect(G_OBJECT(title_entry), "activate", | |
603 G_CALLBACK(press_save), NULL); | |
604 g_signal_connect(G_OBJECT(artist_entry), "activate", | |
605 G_CALLBACK(press_save), NULL); | |
606 g_signal_connect(G_OBJECT(album_entry), "activate", | |
607 G_CALLBACK(press_save), NULL); | |
608 g_signal_connect(G_OBJECT(year_entry), "activate", | |
609 G_CALLBACK(press_save), NULL); | |
610 g_signal_connect(G_OBJECT(comment_entry), "activate", | |
611 G_CALLBACK(press_save), NULL); | |
612 g_signal_connect(G_OBJECT(tracknum_entry), "activate", | |
613 G_CALLBACK(press_save), NULL); | |
614 */ | |
615 g_signal_connect(G_OBJECT(window), "key_press_event", | |
616 G_CALLBACK(fileinfo_keypress_cb), NULL); | |
617 } | |
618 | |
619 g_free(current_filename); | |
620 current_filename = g_strdup(filename); | |
621 | |
622 filename_utf8 = filename_to_utf8(filename); | |
623 | |
186 | 624 title = g_strdup_printf(_("%s - Audacious"), g_basename(filename_utf8)); |
61 | 625 gtk_window_set_title(GTK_WINDOW(window), title); |
626 g_free(title); | |
627 | |
628 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8); | |
629 g_free(filename_utf8); | |
630 | |
631 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); | |
632 | |
633 gtk_entry_set_text(GTK_ENTRY(artist_entry), ""); | |
634 gtk_entry_set_text(GTK_ENTRY(album_entry), ""); | |
635 gtk_entry_set_text(GTK_ENTRY(year_entry), ""); | |
636 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); | |
637 gtk_entry_set_text(GTK_ENTRY(comment_entry), ""); | |
638 gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), | |
639 g_list_index(genre_list, "")); | |
640 | |
641 gtk_label_set_text(GTK_LABEL(mpeg_level), _("MPEG Level:")); | |
642 gtk_label_set_text(GTK_LABEL(mpeg_level_val), _("N/A")); | |
643 | |
644 gtk_label_set_text(GTK_LABEL(mpeg_bitrate), _("Bit rate:")); | |
645 gtk_label_set_text(GTK_LABEL(mpeg_bitrate_val), _("N/A")); | |
646 | |
647 gtk_label_set_text(GTK_LABEL(mpeg_samplerate), _("Sample rate:")); | |
648 gtk_label_set_text(GTK_LABEL(mpeg_samplerate_val), _("N/A")); | |
649 | |
650 gtk_label_set_text(GTK_LABEL(mpeg_error), _("Error Protection:")); | |
651 gtk_label_set_text(GTK_LABEL(mpeg_error_val), _("N/A")); | |
652 | |
653 gtk_label_set_text(GTK_LABEL(mpeg_copy), _("Copyright:")); | |
654 gtk_label_set_text(GTK_LABEL(mpeg_copy_val), _("N/A")); | |
655 | |
656 gtk_label_set_text(GTK_LABEL(mpeg_orig), _("Original:")); | |
657 gtk_label_set_text(GTK_LABEL(mpeg_orig_val), _("N/A")); | |
658 | |
659 gtk_label_set_text(GTK_LABEL(mpeg_emph), _("Emphasis:")); | |
660 gtk_label_set_text(GTK_LABEL(mpeg_emph_val), _("N/A")); | |
661 | |
662 gtk_label_set_text(GTK_LABEL(mpeg_filesize), _("File size:")); | |
663 gtk_label_set_text(GTK_LABEL(mpeg_filesize_val), _("N/A")); | |
664 | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
665 gtk_label_set_text(GTK_LABEL(mpeg_flags), _("Mode:")); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
666 gtk_label_set_text(GTK_LABEL(mpeg_flags_val), _("N/A")); |
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
667 |
61 | 668 if (str_has_prefix_nocase(filename, "http://")) { |
669 file_info_http(filename); | |
670 return; | |
671 } | |
672 | |
673 gtk_widget_set_sensitive(id3_frame, | |
674 vfs_is_writeable(filename)); | |
675 | |
676 fill_entries(NULL, NULL); | |
677 | |
678 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE); | |
679 gtk_widget_show_all(window); | |
680 } | |
681 | |
682 void | |
683 fill_entries(GtkWidget * w, gpointer data) | |
684 { | |
685 VFSFile *fh; | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
686 gchar *ptr, *ptr2; |
959 | 687 guint32 i; |
61 | 688 |
689 if (str_has_prefix_nocase(current_filename, "http://")) | |
690 return; | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
691 |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
692 #ifdef USE_CHARDET |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
693 taglib_set_strings_unicode(FALSE); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
694 #endif |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
695 taglib_file = taglib_file_new(current_filename); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
696 if(taglib_file) { |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
697 taglib_tag = taglib_file_tag(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
698 taglib_ap = taglib_file_audioproperties(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
699 } else return; |
61 | 700 |
1039
fa999c7066e2
[svn] - if taglib_tag == NULL, then return instead of crash
nenolod
parents:
993
diff
changeset
|
701 if (!taglib_tag) |
fa999c7066e2
[svn] - if taglib_tag == NULL, then return instead of crash
nenolod
parents:
993
diff
changeset
|
702 return; |
fa999c7066e2
[svn] - if taglib_tag == NULL, then return instead of crash
nenolod
parents:
993
diff
changeset
|
703 |
959 | 704 /* be sane here, taglib_tag results may be NULL --nenolod */ |
705 ptr = taglib_tag_title(taglib_tag); | |
706 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
707 if (ptr != NULL) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
708 ptr2 = str_to_utf8(ptr); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
709 gtk_entry_set_text(GTK_ENTRY(title_entry), ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
710 g_free(ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
711 } |
959 | 712 |
713 ptr = taglib_tag_artist(taglib_tag); | |
714 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
715 if (ptr != NULL) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
716 ptr2 = str_to_utf8(ptr); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
717 gtk_entry_set_text(GTK_ENTRY(artist_entry), ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
718 g_free(ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
719 } |
959 | 720 |
721 ptr = taglib_tag_album(taglib_tag); | |
722 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
723 if (ptr != NULL) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
724 ptr2 = str_to_utf8(ptr); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
725 gtk_entry_set_text(GTK_ENTRY(album_entry), ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
726 g_free(ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
727 } |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
728 |
959 | 729 ptr = taglib_tag_comment(taglib_tag); |
730 | |
1105
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
731 if (ptr != NULL) { |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
732 ptr2 = str_to_utf8(ptr); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
733 gtk_entry_set_text(GTK_ENTRY(comment_entry), ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
734 g_free(ptr2); |
4be4d74db123
[svn] automatic character encoding detector for id3 metadata. --enable-chardet enables this feature.
yaz
parents:
1098
diff
changeset
|
735 } |
959 | 736 |
737 i = taglib_tag_year(taglib_tag); | |
738 | |
739 if (i != 0) | |
740 { | |
741 ptr = g_strdup_printf("%d", i); | |
742 gtk_entry_set_text(GTK_ENTRY(year_entry), ptr); | |
743 g_free(ptr); | |
744 } | |
745 | |
746 i = taglib_tag_track(taglib_tag); | |
747 | |
748 if (i != 0) | |
749 { | |
750 ptr = g_strdup_printf("%d", i); | |
751 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ptr); | |
752 g_free(ptr); | |
753 } | |
754 | |
993
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
755 i = taglib_audioproperties_samplerate(taglib_ap); |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
756 |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
757 if (i != 0) |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
758 label_set_text(mpeg_samplerate_val, _("%ld Hz"), i); |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
759 |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
760 i = taglib_audioproperties_bitrate(taglib_ap); |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
761 |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
762 if (i != 0) |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
763 label_set_text(mpeg_bitrate_val, _("%d KBit/s"), i); |
a9ac4beb4e15
[svn] Use taglib for length determination. Simpler code, might also deal better with some VBR MP3s if they have length info in their tags.
chainsaw
parents:
983
diff
changeset
|
764 |
959 | 765 ptr = taglib_tag_genre(taglib_tag); |
766 | |
767 if (ptr != NULL) | |
768 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), ptr); | |
61 | 769 |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
770 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
771 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
61 | 772 |
957
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
773 taglib_file_free(taglib_file); |
12f57026da8f
[svn] First attempt at introducing taglib here. Very rough, needs polishing. Please wear protective goggles before opening the file dialog. It *will* explode.
chainsaw
parents:
948
diff
changeset
|
774 taglib_tag_free_strings(); |
61 | 775 gtk_widget_set_sensitive(GTK_WIDGET(remove_id3), TRUE); |
776 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE); | |
777 | |
778 if ((fh = vfs_fopen(current_filename, "rb")) != NULL) { | |
779 guint32 head; | |
780 guchar tmp[4]; | |
781 struct frame frm; | |
782 | |
783 if (vfs_fread(tmp, 1, 4, fh) != 4) { | |
784 vfs_fclose(fh); | |
785 return; | |
786 } | |
787 head = | |
788 ((guint32) tmp[0] << 24) | ((guint32) tmp[1] << 16) | | |
789 ((guint32) tmp[2] << 8) | (guint32) tmp[3]; | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
790 while (!mpgdec_head_check(head)) { |
61 | 791 head <<= 8; |
792 if (vfs_fread(tmp, 1, 1, fh) != 1) { | |
793 vfs_fclose(fh); | |
794 return; | |
795 } | |
796 head |= tmp[0]; | |
797 } | |
1098
b5ae09a6c2f1
[svn] - prepare to split audacious code away from the actual decoder and use a highlevel API
nenolod
parents:
1039
diff
changeset
|
798 if (mpgdec_decode_header(&frm, head)) { |
61 | 799 guchar *buf; |
800 gint pos; | |
801 | |
802 buf = g_malloc(frm.framesize + 4); | |
803 vfs_fseek(fh, -4, SEEK_CUR); | |
804 vfs_fread(buf, 1, frm.framesize + 4, fh); | |
805 set_mpeg_level_label(frm.mpeg25, frm.lsf, frm.lay); | |
806 pos = vfs_ftell(fh); | |
807 vfs_fseek(fh, 0, SEEK_END); | |
808 label_set_text(mpeg_error_val, _("%s"), | |
809 bool_label[frm.error_protection]); | |
810 label_set_text(mpeg_copy_val, _("%s"), bool_label[frm.copyright]); | |
811 label_set_text(mpeg_orig_val, _("%s"), bool_label[frm.original]); | |
812 label_set_text(mpeg_emph_val, _("%s"), emphasis[frm.emphasis]); | |
813 label_set_text(mpeg_filesize_val, _("%lu Bytes"), vfs_ftell(fh)); | |
908
9bc585cc3c65
[svn] Report mode from mpg123. Patch by spike, closes bug #457.
chainsaw
parents:
186
diff
changeset
|
814 label_set_text(mpeg_flags_val, _("%s"), channel_mode_name(frm.mode)); |
61 | 815 g_free(buf); |
816 } | |
817 vfs_fclose(fh); | |
818 } | |
819 | |
820 } |