Lines 25-52
Link Here
|
25 |
#include <errno.h> |
25 |
#include <errno.h> |
26 |
#include <libxmms/xentry.h> |
26 |
#include <libxmms/xentry.h> |
27 |
#include "mpg123.h" |
27 |
#include "mpg123.h" |
|
|
28 |
#include "lib_id3v2.h" |
29 |
|
30 |
#define MAX_STR_LEN 100 |
31 |
#define MAX_ENTRY_LEN2 1023 |
28 |
|
32 |
|
29 |
static GtkWidget *window = NULL; |
33 |
static GtkWidget *window = NULL; |
30 |
static GtkWidget *filename_entry, *id3_frame; |
34 |
static GtkWidget *notebook = NULL; |
31 |
static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry; |
35 |
static GtkWidget *filename_entry, *id3v1_frame, *id3v2_frame; |
32 |
static GtkWidget *tracknum_entry, *comment_entry, *genre_combo; |
36 |
static GtkWidget *v1_checkbox, *v2_checkbox; |
|
|
37 |
static GtkWidget *v1_title_entry, *v1_artist_entry, *v1_album_entry, *v1_year_entry, *v1_tracknum_entry, *v1_comment_entry; |
38 |
static GtkWidget *v2_title_entry, *v2_artist_entry, *v2_album_entry, *v2_year_entry, *v2_tracknum_entry, *v2_comment_entry, |
39 |
*v2_composer_entry, *v2_orig_artist_entry, *v2_url_entry, *v2_encoded_by_entry; |
40 |
static GtkWidget *v1_genre_combo, *v2_genre_combo; |
33 |
static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags; |
41 |
static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags; |
34 |
static GtkWidget *mpeg_fileinfo; |
42 |
static GtkWidget *mpeg_fileinfo; |
35 |
|
43 |
|
|
|
44 |
static GPtrArray *v1_labels_list = NULL, *v2_labels_list = NULL; // TODO: Where will these be freed? |
36 |
static GList *genre_list; |
45 |
static GList *genre_list; |
37 |
struct genre_item { |
46 |
struct genre_item { |
38 |
const char *name; |
47 |
const char *name; |
39 |
int id; |
48 |
int id; |
40 |
}; |
49 |
}; |
41 |
static int current_genre; |
50 |
static int v1_current_genre; |
|
|
51 |
static int v2_current_genre; |
42 |
static char *current_filename; |
52 |
static char *current_filename; |
43 |
|
53 |
|
44 |
extern char *mpg123_filename; |
54 |
extern char *mpg123_filename; |
45 |
extern int mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf, mpg123_mode; |
55 |
extern int mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf, mpg123_mode; |
46 |
extern gboolean mpg123_stereo, mpg123_mpeg25; |
56 |
extern gboolean mpg123_stereo, mpg123_mpeg25; |
47 |
|
57 |
|
48 |
#define MAX_STR_LEN 100 |
|
|
49 |
|
50 |
static void label_set_text(GtkWidget * label, char *str, ...) |
58 |
static void label_set_text(GtkWidget * label, char *str, ...) |
51 |
G_GNUC_PRINTF(2, 3); |
59 |
G_GNUC_PRINTF(2, 3); |
52 |
|
60 |
|
Lines 66-71
Link Here
|
66 |
strncpy(tag, gtk_entry_get_text(entry), length); |
74 |
strncpy(tag, gtk_entry_get_text(entry), length); |
67 |
} |
75 |
} |
68 |
|
76 |
|
|
|
77 |
void copy_entry_tag(GtkEntry * src, GtkEntry * dest, int length) |
78 |
{ |
79 |
set_entry_tag(dest, gtk_entry_get_text(src), length); |
80 |
return; |
81 |
} |
82 |
|
69 |
static int genre_find_index(GList *genre_list, int id) |
83 |
static int genre_find_index(GList *genre_list, int id) |
70 |
{ |
84 |
{ |
71 |
int idx = 0; |
85 |
int idx = 0; |
Lines 80-94
Link Here
|
80 |
return idx; |
94 |
return idx; |
81 |
} |
95 |
} |
82 |
|
96 |
|
|
|
97 |
static int genre_find_index_str(GList *genre_list, const char* str) |
98 |
{ |
99 |
int idx = 0; |
100 |
while (genre_list) |
101 |
{ |
102 |
struct genre_item *item = genre_list->data; |
103 |
if (strcmp(item->name, str) == 0) |
104 |
break; |
105 |
idx++; |
106 |
genre_list = genre_list->next; |
107 |
} |
108 |
return idx; |
109 |
} |
110 |
|
83 |
static int genre_comp_func(gconstpointer a, gconstpointer b) |
111 |
static int genre_comp_func(gconstpointer a, gconstpointer b) |
84 |
{ |
112 |
{ |
85 |
const struct genre_item *ga = a, *gb = b; |
113 |
const struct genre_item *ga = a, *gb = b; |
86 |
return strcasecmp(ga->name, gb->name); |
114 |
return strcasecmp(ga->name, gb->name); |
87 |
} |
115 |
} |
88 |
|
116 |
|
89 |
static void save_cb(GtkWidget * w, gpointer data) |
117 |
static void remove_id3v1(void) |
90 |
{ |
118 |
{ |
91 |
int fd; |
119 |
int fd, len; |
92 |
struct id3v1tag_t tag; |
120 |
struct id3v1tag_t tag; |
93 |
char *msg = NULL; |
121 |
char *msg = NULL; |
94 |
|
122 |
|
Lines 97-167
Link Here
|
97 |
|
125 |
|
98 |
if ((fd = open(current_filename, O_RDWR)) != -1) |
126 |
if ((fd = open(current_filename, O_RDWR)) != -1) |
99 |
{ |
127 |
{ |
100 |
int tracknum; |
128 |
len = lseek(fd, -128, SEEK_END); |
101 |
|
|
|
102 |
lseek(fd, -128, SEEK_END); |
103 |
read(fd, &tag, sizeof (struct id3v1tag_t)); |
129 |
read(fd, &tag, sizeof (struct id3v1tag_t)); |
104 |
|
130 |
|
105 |
if (!strncmp(tag.tag, "TAG", 3)) |
131 |
if (!strncmp(tag.tag, "TAG", 3)) |
106 |
lseek(fd, -128, SEEK_END); |
|
|
107 |
else |
108 |
lseek(fd, 0, SEEK_END); |
109 |
tag.tag[0] = 'T'; |
110 |
tag.tag[1] = 'A'; |
111 |
tag.tag[2] = 'G'; |
112 |
get_entry_tag(GTK_ENTRY(title_entry), tag.title, 30); |
113 |
get_entry_tag(GTK_ENTRY(artist_entry), tag.artist, 30); |
114 |
get_entry_tag(GTK_ENTRY(album_entry), tag.album, 30); |
115 |
get_entry_tag(GTK_ENTRY(year_entry), tag.year, 4); |
116 |
tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(tracknum_entry))); |
117 |
if (tracknum > 0) |
118 |
{ |
132 |
{ |
119 |
get_entry_tag(GTK_ENTRY(comment_entry), |
133 |
if (ftruncate(fd, len)) |
120 |
tag.u.v1_1.comment, 28); |
134 |
msg = g_strdup_printf(_("%s\n" |
121 |
tag.u.v1_1.__zero = 0; |
135 |
"Unable to truncate file: %s"), |
122 |
tag.u.v1_1.track_number = MIN(tracknum, 255); |
136 |
_("Couldn't remove tag!"), |
|
|
137 |
strerror(errno)); |
123 |
} |
138 |
} |
124 |
else |
|
|
125 |
get_entry_tag(GTK_ENTRY(comment_entry), |
126 |
tag.u.v1_0.comment, 30); |
127 |
tag.genre = current_genre; |
128 |
if (write(fd, &tag, sizeof (tag)) != sizeof (tag)) |
129 |
msg = g_strdup_printf(_("%s\nUnable to write to file: %s"), |
130 |
_("Couldn't write tag!"), |
131 |
strerror(errno)); |
132 |
close(fd); |
139 |
close(fd); |
133 |
} |
140 |
} |
134 |
else |
141 |
else |
135 |
msg = g_strdup_printf(_("%s\nUnable to open file: %s"), |
142 |
msg = g_strdup_printf(_("%s\nUnable to open file: %s"), |
136 |
_("Couldn't write tag!"), |
143 |
_("Couldn't remove tag!"), |
137 |
strerror(errno)); |
144 |
strerror(errno)); |
138 |
if (msg) |
145 |
if (msg) |
139 |
{ |
146 |
{ |
140 |
GtkWidget *mwin = xmms_show_message(_("File Info"), msg, |
147 |
GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"), |
141 |
_("Ok"), FALSE, NULL, NULL); |
148 |
FALSE, NULL, NULL); |
142 |
gtk_window_set_transient_for(GTK_WINDOW(mwin), |
149 |
gtk_window_set_transient_for(GTK_WINDOW(mwin), |
143 |
GTK_WINDOW(window)); |
150 |
GTK_WINDOW(window)); |
144 |
g_free(msg); |
151 |
g_free(msg); |
145 |
} |
152 |
} |
146 |
else |
|
|
147 |
gtk_widget_destroy(window); |
148 |
} |
149 |
|
150 |
static void label_set_text(GtkWidget * label, char *str, ...) |
151 |
{ |
152 |
va_list args; |
153 |
char tempstr[MAX_STR_LEN]; |
154 |
|
155 |
va_start(args, str); |
156 |
g_vsnprintf(tempstr, MAX_STR_LEN, str, args); |
157 |
va_end(args); |
158 |
|
159 |
gtk_label_set_text(GTK_LABEL(label), tempstr); |
160 |
} |
153 |
} |
161 |
|
154 |
|
162 |
static void remove_id3_cb(GtkWidget * w, gpointer data) |
155 |
static void save_cb(GtkWidget * w, gpointer data) |
163 |
{ |
156 |
{ |
164 |
int fd, len; |
157 |
int fd; |
165 |
struct id3v1tag_t tag; |
158 |
struct id3v1tag_t tag; |
166 |
char *msg = NULL; |
159 |
char *msg = NULL; |
167 |
|
160 |
|
Lines 170-205
Link Here
|
170 |
|
163 |
|
171 |
if ((fd = open(current_filename, O_RDWR)) != -1) |
164 |
if ((fd = open(current_filename, O_RDWR)) != -1) |
172 |
{ |
165 |
{ |
173 |
len = lseek(fd, -128, SEEK_END); |
166 |
if (!GTK_TOGGLE_BUTTON(v1_checkbox)->active) { |
174 |
read(fd, &tag, sizeof (struct id3v1tag_t)); |
167 |
// Try to save id3v1 tag |
|
|
168 |
int tracknum; |
175 |
|
169 |
|
176 |
if (!strncmp(tag.tag, "TAG", 3)) |
170 |
lseek(fd, -128, SEEK_END); |
177 |
{ |
171 |
read(fd, &tag, sizeof (struct id3v1tag_t)); |
178 |
if (ftruncate(fd, len)) |
172 |
|
179 |
msg = g_strdup_printf( |
173 |
if (!strncmp(tag.tag, "TAG", 3)) |
180 |
_("%s\n" |
174 |
lseek(fd, -128, SEEK_END); |
181 |
"Unable to truncate file: %s"), |
175 |
else |
182 |
_("Couldn't remove tag!"), |
176 |
lseek(fd, 0, SEEK_END); |
183 |
strerror(errno)); |
177 |
tag.tag[0] = 'T'; |
|
|
178 |
tag.tag[1] = 'A'; |
179 |
tag.tag[2] = 'G'; |
180 |
get_entry_tag(GTK_ENTRY(v1_title_entry), tag.title, 30); |
181 |
get_entry_tag(GTK_ENTRY(v1_artist_entry), tag.artist, 30); |
182 |
get_entry_tag(GTK_ENTRY(v1_album_entry), tag.album, 30); |
183 |
get_entry_tag(GTK_ENTRY(v1_year_entry), tag.year, 4); |
184 |
tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(v1_tracknum_entry))); |
185 |
if (tracknum > 0) |
186 |
{ |
187 |
get_entry_tag(GTK_ENTRY(v1_comment_entry), |
188 |
tag.u.v1_1.comment, 28); |
189 |
tag.u.v1_1.__zero = 0; |
190 |
tag.u.v1_1.track_number = MIN(tracknum, 255); |
191 |
} |
192 |
else |
193 |
get_entry_tag(GTK_ENTRY(v1_comment_entry), |
194 |
tag.u.v1_0.comment, 30); |
195 |
tag.genre = v1_current_genre; |
196 |
if (write(fd, &tag, sizeof (tag)) != sizeof (tag)) |
197 |
msg = g_strdup_printf(_("%s\nUnable to write to file: %s"), |
198 |
_("Couldn't write tag!"), |
199 |
strerror(errno)); |
200 |
} else { |
201 |
// Remove the id3v1 tag from the file |
202 |
remove_id3v1(); |
184 |
} |
203 |
} |
185 |
else |
204 |
|
186 |
msg = strdup(_("No tag to remove!")); |
205 |
if (!GTK_TOGGLE_BUTTON(v2_checkbox)->active) { |
187 |
close(fd); |
206 |
|
|
|
207 |
id3Tag v2_tag; |
208 |
memset(&v2_tag, 0, sizeof (v2_tag)); |
209 |
strncpy(v2_tag.title, gtk_entry_get_text(GTK_ENTRY(v2_title_entry)), MAX_ENTRY_LEN2); |
210 |
strncpy(v2_tag.artist, gtk_entry_get_text(GTK_ENTRY(v2_artist_entry)), MAX_ENTRY_LEN2); |
211 |
strncpy(v2_tag.album, gtk_entry_get_text(GTK_ENTRY(v2_album_entry)), MAX_ENTRY_LEN2); |
212 |
strncpy(v2_tag.year, gtk_entry_get_text(GTK_ENTRY(v2_year_entry)), 4); |
213 |
strncpy(v2_tag.comment, gtk_entry_get_text(GTK_ENTRY(v2_comment_entry)), MAX_ENTRY_LEN2); |
214 |
strncpy(v2_tag.track, gtk_entry_get_text(GTK_ENTRY(v2_tracknum_entry)), 3); |
215 |
snprintf(v2_tag.genre, 6, "(%d)", v2_current_genre); |
216 |
|
217 |
strncpy(v2_tag.composer, gtk_entry_get_text(GTK_ENTRY(v2_composer_entry)), MAX_ENTRY_LEN2); |
218 |
strncpy(v2_tag.url, gtk_entry_get_text(GTK_ENTRY(v2_url_entry)), MAX_ENTRY_LEN2); |
219 |
strncpy(v2_tag.orig_artist, gtk_entry_get_text(GTK_ENTRY(v2_orig_artist_entry)), MAX_ENTRY_LEN2); |
220 |
strncpy(v2_tag.enc_by, gtk_entry_get_text(GTK_ENTRY(v2_encoded_by_entry)), MAX_ENTRY_LEN2); |
221 |
|
222 |
set_id3v2_tag(&v2_tag, current_filename); |
223 |
|
224 |
} else { |
225 |
// remove the id3v2 tag from the file |
226 |
del_id3v2_tag(current_filename); |
227 |
} |
228 |
|
229 |
if (fd) |
230 |
close(fd); |
188 |
} |
231 |
} |
189 |
else |
232 |
else |
190 |
msg = g_strdup_printf(_("%s\nUnable to open file: %s"), |
233 |
msg = g_strdup_printf(_("%s\nUnable to open file: %s"), |
191 |
_("Couldn't remove tag!"), |
234 |
_("Couldn't write tag!"), |
192 |
strerror(errno)); |
235 |
strerror(errno)); |
193 |
if (msg) |
236 |
if (msg) |
194 |
{ |
237 |
{ |
195 |
GtkWidget *mwin = xmms_show_message(_("File Info"), msg, |
238 |
GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"), |
196 |
_("Ok"), FALSE, NULL, NULL); |
239 |
FALSE, NULL, NULL); |
197 |
gtk_window_set_transient_for(GTK_WINDOW(mwin), |
240 |
gtk_window_set_transient_for(GTK_WINDOW(mwin), |
198 |
GTK_WINDOW(window)); |
241 |
GTK_WINDOW(window)); |
199 |
g_free(msg); |
242 |
g_free(msg); |
200 |
} |
243 |
} |
201 |
else |
244 |
} |
202 |
gtk_widget_destroy(window); |
245 |
|
|
|
246 |
static void label_set_text(GtkWidget * label, char *str, ...) |
247 |
{ |
248 |
va_list args; |
249 |
char tempstr[MAX_STR_LEN]; |
250 |
|
251 |
va_start(args, str); |
252 |
g_vsnprintf(tempstr, MAX_STR_LEN, str, args); |
253 |
va_end(args); |
254 |
|
255 |
gtk_label_set_text(GTK_LABEL(label), tempstr); |
203 |
} |
256 |
} |
204 |
|
257 |
|
205 |
static void set_mpeg_level_label(gboolean mpeg25, int lsf, int layer) |
258 |
static void set_mpeg_level_label(gboolean mpeg25, int lsf, int layer) |
Lines 222-249
Link Here
|
222 |
|
275 |
|
223 |
static void file_info_http(char *filename) |
276 |
static void file_info_http(char *filename) |
224 |
{ |
277 |
{ |
225 |
gtk_widget_set_sensitive(id3_frame, FALSE); |
278 |
gtk_widget_set_sensitive(id3v1_frame, FALSE); |
|
|
279 |
gtk_widget_set_sensitive(id3v2_frame, FALSE); |
226 |
if (mpg123_filename && !strcmp(filename, mpg123_filename) && |
280 |
if (mpg123_filename && !strcmp(filename, mpg123_filename) && |
227 |
mpg123_bitrate != 0) |
281 |
mpg123_bitrate != 0) |
228 |
{ |
282 |
{ |
229 |
set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer); |
283 |
set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, |
|
|
284 |
mpg123_layer); |
230 |
label_set_text(mpeg_bitrate, _("Bitrate: %d kb/s"), |
285 |
label_set_text(mpeg_bitrate, _("Bitrate: %d kb/s"), |
231 |
mpg123_bitrate); |
286 |
mpg123_bitrate); |
232 |
label_set_text(mpeg_samplerate, _("Samplerate: %d Hz"), |
287 |
label_set_text(mpeg_samplerate, _("Samplerate: %d Hz"), |
233 |
mpg123_frequency); |
288 |
mpg123_frequency); |
234 |
label_set_text(mpeg_flags, "%s", |
289 |
label_set_text(mpeg_flags, "%s", |
235 |
channel_mode_name(mpg123_mode)); |
290 |
channel_mode_name(mpg123_mode)); |
236 |
} |
291 |
} |
237 |
} |
292 |
} |
238 |
|
293 |
|
239 |
static void genre_selected(GtkList *list, GtkWidget *w, gpointer data) |
294 |
void copy_v2_to_v1_cb(GtkButton *button, gpointer user_data) |
|
|
295 |
{ |
296 |
copy_entry_tag(GTK_ENTRY(v2_title_entry), GTK_ENTRY(v1_title_entry), 30); |
297 |
copy_entry_tag(GTK_ENTRY(v2_artist_entry), GTK_ENTRY(v1_artist_entry), 30); |
298 |
copy_entry_tag(GTK_ENTRY(v2_album_entry), GTK_ENTRY(v1_album_entry), 30); |
299 |
copy_entry_tag(GTK_ENTRY(v2_year_entry), GTK_ENTRY(v1_year_entry), 4); |
300 |
copy_entry_tag(GTK_ENTRY(v2_comment_entry), GTK_ENTRY(v1_comment_entry), 30); |
301 |
copy_entry_tag(GTK_ENTRY(v2_tracknum_entry), GTK_ENTRY(v1_tracknum_entry), 3); |
302 |
|
303 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, v2_current_genre)); |
304 |
return; |
305 |
} |
306 |
|
307 |
void copy_v1_to_v2_cb(GtkButton *button, gpointer user_data) |
308 |
{ |
309 |
copy_entry_tag(GTK_ENTRY(v1_title_entry), GTK_ENTRY(v2_title_entry), MAX_ENTRY_LEN2); |
310 |
copy_entry_tag(GTK_ENTRY(v1_artist_entry), GTK_ENTRY(v2_artist_entry), MAX_ENTRY_LEN2); |
311 |
copy_entry_tag(GTK_ENTRY(v1_album_entry), GTK_ENTRY(v2_album_entry), MAX_ENTRY_LEN2); |
312 |
copy_entry_tag(GTK_ENTRY(v1_year_entry), GTK_ENTRY(v2_year_entry), 4); |
313 |
copy_entry_tag(GTK_ENTRY(v1_comment_entry), GTK_ENTRY(v2_comment_entry), MAX_ENTRY_LEN2); |
314 |
copy_entry_tag(GTK_ENTRY(v1_tracknum_entry), GTK_ENTRY(v2_tracknum_entry), 3); |
315 |
|
316 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index(genre_list, v1_current_genre)); |
317 |
//int genreID = find_genre_id(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry))); |
318 |
//gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), |
319 |
// g_list_index(genre_list, (char *) mpg123_id3_genres[genreID])); |
320 |
return; |
321 |
} |
322 |
|
323 |
void v1_toggle_cb (GtkWidget *widget, gpointer data) |
324 |
{ |
325 |
int i = 0; |
326 |
if (GTK_TOGGLE_BUTTON (widget)->active) |
327 |
{ |
328 |
// If control reaches here, the toggle button is down |
329 |
// Gray out labels |
330 |
for (i = 0; i < v1_labels_list->len; i++) { |
331 |
gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), FALSE); |
332 |
} |
333 |
gtk_widget_set_sensitive(v1_title_entry, FALSE); |
334 |
gtk_widget_set_sensitive(v1_artist_entry, FALSE); |
335 |
gtk_widget_set_sensitive(v1_album_entry, FALSE); |
336 |
gtk_widget_set_sensitive(v1_year_entry, FALSE); |
337 |
gtk_widget_set_sensitive(v1_tracknum_entry, FALSE); |
338 |
gtk_widget_set_sensitive(v1_comment_entry, FALSE); |
339 |
gtk_widget_set_sensitive(v1_genre_combo, FALSE); |
340 |
} else { |
341 |
|
342 |
// If control reaches here, the toggle button is up |
343 |
// Enable labels |
344 |
for (i = 0; i < v1_labels_list->len; i++) { |
345 |
gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v1_labels_list, i) ), TRUE); |
346 |
} |
347 |
gtk_widget_set_sensitive(v1_title_entry, TRUE); |
348 |
gtk_widget_set_sensitive(v1_artist_entry, TRUE); |
349 |
gtk_widget_set_sensitive(v1_album_entry, TRUE); |
350 |
gtk_widget_set_sensitive(v1_year_entry, TRUE); |
351 |
gtk_widget_set_sensitive(v1_tracknum_entry, TRUE); |
352 |
gtk_widget_set_sensitive(v1_comment_entry, TRUE); |
353 |
gtk_widget_set_sensitive(v1_genre_combo, TRUE); |
354 |
} |
355 |
} |
356 |
|
357 |
void v2_toggle_cb (GtkWidget *widget, gpointer data) |
358 |
{ |
359 |
int i = 0; |
360 |
if (GTK_TOGGLE_BUTTON (widget)->active) |
361 |
{ |
362 |
// If control reaches here, the toggle button is down |
363 |
// Gray out labels |
364 |
for (i = 0; i < v2_labels_list->len; i++) { |
365 |
gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), FALSE); |
366 |
} |
367 |
gtk_widget_set_sensitive(v2_title_entry, FALSE); |
368 |
gtk_widget_set_sensitive(v2_artist_entry, FALSE); |
369 |
gtk_widget_set_sensitive(v2_album_entry, FALSE); |
370 |
gtk_widget_set_sensitive(v2_year_entry, FALSE); |
371 |
gtk_widget_set_sensitive(v2_tracknum_entry, FALSE); |
372 |
gtk_widget_set_sensitive(v2_comment_entry, FALSE); |
373 |
gtk_widget_set_sensitive(v2_composer_entry, FALSE); |
374 |
gtk_widget_set_sensitive(v2_orig_artist_entry, FALSE); |
375 |
gtk_widget_set_sensitive(v2_url_entry, FALSE); |
376 |
gtk_widget_set_sensitive(v2_encoded_by_entry, FALSE); |
377 |
gtk_widget_set_sensitive(v2_genre_combo, FALSE); |
378 |
} else { |
379 |
|
380 |
// If control reaches here, the toggle button is up |
381 |
// Enable labels |
382 |
for (i = 0; i < v2_labels_list->len; i++) { |
383 |
gtk_widget_set_sensitive(GTK_WIDGET( g_ptr_array_index(v2_labels_list, i) ), TRUE); |
384 |
} |
385 |
gtk_widget_set_sensitive(v2_title_entry, TRUE); |
386 |
gtk_widget_set_sensitive(v2_artist_entry, TRUE); |
387 |
gtk_widget_set_sensitive(v2_album_entry, TRUE); |
388 |
gtk_widget_set_sensitive(v2_year_entry, TRUE); |
389 |
gtk_widget_set_sensitive(v2_tracknum_entry, TRUE); |
390 |
gtk_widget_set_sensitive(v2_comment_entry, TRUE); |
391 |
gtk_widget_set_sensitive(v2_composer_entry, TRUE); |
392 |
gtk_widget_set_sensitive(v2_orig_artist_entry, TRUE); |
393 |
gtk_widget_set_sensitive(v2_url_entry, TRUE); |
394 |
gtk_widget_set_sensitive(v2_encoded_by_entry, TRUE); |
395 |
gtk_widget_set_sensitive(v2_genre_combo, TRUE); |
396 |
} |
397 |
} |
398 |
static void v1_genre_selected(GtkList *list, GtkWidget *w, gpointer data) |
399 |
{ |
400 |
void * p; |
401 |
p = gtk_object_get_data(GTK_OBJECT(w), "genre_id"); |
402 |
if (p != NULL) |
403 |
v1_current_genre = GPOINTER_TO_INT(p); |
404 |
else |
405 |
v1_current_genre = 0; |
406 |
} |
407 |
|
408 |
static void v2_genre_selected(GtkList *list, GtkWidget *w, gpointer data) |
240 |
{ |
409 |
{ |
241 |
void * p; |
410 |
void * p; |
242 |
p = gtk_object_get_data(GTK_OBJECT(w), "genre_id"); |
411 |
p = gtk_object_get_data(GTK_OBJECT(w), "genre_id"); |
243 |
if (p != NULL) |
412 |
if (p != NULL) |
244 |
current_genre = GPOINTER_TO_INT(p); |
413 |
v2_current_genre = GPOINTER_TO_INT(p); |
245 |
else |
414 |
else |
246 |
current_genre = 0; |
415 |
v2_current_genre = 0; |
247 |
} |
416 |
} |
248 |
|
417 |
|
249 |
static void genre_set_popdown(GtkWidget *combo, GList *genres) |
418 |
static void genre_set_popdown(GtkWidget *combo, GList *genres) |
Lines 266-276
Link Here
|
266 |
void mpg123_file_info_box(char *filename) |
435 |
void mpg123_file_info_box(char *filename) |
267 |
{ |
436 |
{ |
268 |
int i; |
437 |
int i; |
269 |
struct id3v1tag_t tag; |
438 |
struct id3v1tag_t id3v1tag; |
270 |
FILE *fh; |
439 |
FILE *fh; |
271 |
char *tmp, *title; |
440 |
char *tmp, *title; |
272 |
const char *emphasis[4]; |
441 |
const char *emphasis[4]; |
273 |
const char *bool_label[2]; |
442 |
const char *bool_label[2]; |
|
|
443 |
struct id3tag_t id3v2tag; |
274 |
|
444 |
|
275 |
emphasis[0] = _("None"); |
445 |
emphasis[0] = _("None"); |
276 |
emphasis[1] = _("50/15 ms"); |
446 |
emphasis[1] = _("50/15 ms"); |
Lines 281-396
Link Here
|
281 |
|
451 |
|
282 |
if (!window) |
452 |
if (!window) |
283 |
{ |
453 |
{ |
284 |
GtkWidget *vbox, *hbox, *left_vbox, *table; |
454 |
GtkWidget *window_vbox, |
285 |
GtkWidget *mpeg_frame, *mpeg_box; |
455 |
*id3v1_vbox, *id3v2_vbox, *id3v1_frame_vbox, *id3v2_frame_vbox, |
286 |
GtkWidget *label, *filename_hbox; |
456 |
*mpeg_lvbox, *mpeg_rvbox, *mpeg_hbox, *mpeg_box, *mpeg_frame, |
287 |
GtkWidget *bbox, *save, *remove_id3, *cancel; |
457 |
*bbox, *save, *close, *copy_to, *copy_from, |
288 |
|
458 |
*table, *label, *filename_hbox; |
289 |
window = gtk_window_new(GTK_WINDOW_DIALOG); |
459 |
|
290 |
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
460 |
v1_labels_list = g_ptr_array_new(); |
291 |
gtk_signal_connect(GTK_OBJECT(window), "destroy", |
461 |
v2_labels_list = g_ptr_array_new(); |
292 |
gtk_widget_destroyed, &window); |
462 |
|
293 |
gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
463 |
window = gtk_window_new(GTK_WINDOW_DIALOG); |
294 |
|
464 |
//gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); |
295 |
vbox = gtk_vbox_new(FALSE, 10); |
465 |
gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); |
296 |
gtk_container_add(GTK_CONTAINER(window), vbox); |
466 |
gtk_container_set_border_width(GTK_CONTAINER(window), 10); |
297 |
|
467 |
|
|
|
468 |
window_vbox = gtk_vbox_new(FALSE,10); |
298 |
filename_hbox = gtk_hbox_new(FALSE, 5); |
469 |
filename_hbox = gtk_hbox_new(FALSE, 5); |
299 |
gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, |
470 |
gtk_box_pack_start(GTK_BOX(window_vbox), filename_hbox, FALSE, TRUE, 0); |
300 |
FALSE, TRUE, 0); |
|
|
301 |
|
471 |
|
302 |
label = gtk_label_new(_("Filename:")); |
472 |
label = gtk_label_new(_("Filename:")); |
303 |
gtk_box_pack_start(GTK_BOX(filename_hbox), label, |
473 |
gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); |
304 |
FALSE, TRUE, 0); |
|
|
305 |
filename_entry = xmms_entry_new(); |
474 |
filename_entry = xmms_entry_new(); |
306 |
gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); |
475 |
gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); |
307 |
gtk_box_pack_start(GTK_BOX(filename_hbox), |
476 |
gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); |
308 |
filename_entry, TRUE, TRUE, 0); |
477 |
|
309 |
|
478 |
id3v1_vbox = gtk_vbox_new(FALSE, 10); |
310 |
hbox = gtk_hbox_new(FALSE, 10); |
479 |
id3v1_frame = gtk_frame_new("ID3v1 Information"); |
311 |
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); |
480 |
gtk_box_pack_start(GTK_BOX(id3v1_vbox), id3v1_frame, TRUE, TRUE, 0); |
312 |
|
481 |
|
313 |
left_vbox = gtk_vbox_new(FALSE, 10); |
482 |
id3v1_frame_vbox = gtk_vbox_new(FALSE,10); |
314 |
gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); |
483 |
gtk_container_add(GTK_CONTAINER(id3v1_frame), id3v1_frame_vbox); |
315 |
|
484 |
|
316 |
id3_frame = gtk_frame_new(_("ID3 Tag:")); |
485 |
table = gtk_table_new(6, 6, FALSE); |
317 |
gtk_box_pack_start(GTK_BOX(left_vbox), id3_frame, |
486 |
gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
318 |
FALSE, FALSE, 0); |
487 |
//gtk_widget_set_usize(GTK_WIDGET(table), 325, -1); |
319 |
|
488 |
//gtk_container_add(GTK_CONTAINER(id3v1_frame), table); |
320 |
table = gtk_table_new(5, 5, FALSE); |
489 |
gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), table, FALSE, FALSE, 0); |
321 |
gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
490 |
|
322 |
gtk_container_add(GTK_CONTAINER(id3_frame), table); |
491 |
v1_checkbox = gtk_check_button_new_with_label ("Disable ID3v1 Tag"); |
323 |
|
492 |
gtk_signal_connect(GTK_OBJECT(v1_checkbox), "toggled", GTK_SIGNAL_FUNC(v1_toggle_cb), NULL); |
324 |
label = gtk_label_new(_("Title:")); |
493 |
gtk_table_attach(GTK_TABLE(table), v1_checkbox, 1, 3, 0, 1, |
325 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
494 |
GTK_FILL, GTK_FILL, 0, 2); |
326 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, |
495 |
|
327 |
GTK_FILL, GTK_FILL, 5, 5); |
496 |
label = gtk_label_new("Track number:"); |
328 |
|
497 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
329 |
title_entry = gtk_entry_new_with_max_length(30); |
498 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
330 |
gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, |
499 |
gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, |
331 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
500 |
GTK_FILL, GTK_FILL, 5,5); |
332 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
501 |
|
333 |
|
502 |
v1_tracknum_entry = gtk_entry_new_with_max_length(3); |
334 |
label = gtk_label_new(_("Artist:")); |
503 |
gtk_widget_set_usize(v1_tracknum_entry, 20, -1); |
335 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
504 |
gtk_table_attach(GTK_TABLE(table), v1_tracknum_entry, 4, 5, 0, 1, |
336 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, |
505 |
GTK_FILL, GTK_FILL, 0, 2); |
337 |
GTK_FILL, GTK_FILL, 5, 5); |
506 |
|
338 |
|
507 |
label = gtk_label_new("Title:"); |
339 |
artist_entry = gtk_entry_new_with_max_length(30); |
508 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
340 |
gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, |
509 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
341 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
510 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, |
342 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
511 |
GTK_FILL, GTK_FILL, 5, 5); |
343 |
|
512 |
|
344 |
label = gtk_label_new(_("Album:")); |
513 |
v1_title_entry = gtk_entry_new_with_max_length(30); |
345 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
514 |
gtk_table_attach(GTK_TABLE(table), v1_title_entry, 1, 5, 1, 2, |
346 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, |
515 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
347 |
GTK_FILL, GTK_FILL, 5, 5); |
516 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
348 |
|
517 |
|
349 |
album_entry = gtk_entry_new_with_max_length(30); |
518 |
label = gtk_label_new("Artist:"); |
350 |
gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, |
519 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
351 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
520 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
352 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
521 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, |
353 |
|
522 |
GTK_FILL, GTK_FILL, 5, 5); |
354 |
label = gtk_label_new(_("Comment:")); |
523 |
|
355 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
524 |
v1_artist_entry = gtk_entry_new_with_max_length(30); |
356 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, |
525 |
gtk_table_attach(GTK_TABLE(table), v1_artist_entry, 1, 5, 2, 3, |
357 |
GTK_FILL, GTK_FILL, 5, 5); |
526 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
358 |
|
527 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
359 |
comment_entry = gtk_entry_new_with_max_length(30); |
528 |
|
360 |
gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, |
529 |
label = gtk_label_new("Album:"); |
361 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
530 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
362 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
531 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
363 |
|
532 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, |
364 |
label = gtk_label_new(_("Year:")); |
533 |
GTK_FILL, GTK_FILL, 5, 5); |
365 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
534 |
|
366 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, |
535 |
v1_album_entry = gtk_entry_new_with_max_length(30); |
367 |
GTK_FILL, GTK_FILL, 5, 5); |
536 |
gtk_table_attach(GTK_TABLE(table), v1_album_entry, 1, 5, 3, 4, |
368 |
|
537 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
369 |
year_entry = gtk_entry_new_with_max_length(4); |
538 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
370 |
gtk_widget_set_usize(year_entry, 40, -1); |
539 |
|
371 |
gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5, |
540 |
label = gtk_label_new("Comment:"); |
372 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
541 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
373 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
542 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
374 |
|
543 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, |
375 |
label = gtk_label_new(_("Track number:")); |
544 |
GTK_FILL, GTK_FILL, 5, 5); |
376 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
545 |
|
377 |
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, |
546 |
v1_comment_entry = gtk_entry_new_with_max_length(30); |
378 |
GTK_FILL, GTK_FILL, 5, 5); |
547 |
gtk_table_attach(GTK_TABLE(table), v1_comment_entry, 1, 5, 4, 5, |
379 |
|
548 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
380 |
tracknum_entry = gtk_entry_new_with_max_length(3); |
549 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
381 |
gtk_widget_set_usize(tracknum_entry, 40, -1); |
550 |
|
382 |
gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, |
551 |
label = gtk_label_new("Year:"); |
383 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
552 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
384 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
553 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
385 |
|
554 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, |
386 |
label = gtk_label_new(_("Genre:")); |
555 |
GTK_FILL, GTK_FILL, 5, 5); |
387 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
556 |
|
388 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, |
557 |
v1_year_entry = gtk_entry_new_with_max_length(4); |
389 |
GTK_FILL, GTK_FILL, 5, 5); |
558 |
gtk_widget_set_usize(v1_year_entry, 45, -1); |
390 |
|
559 |
gtk_table_attach(GTK_TABLE(table), v1_year_entry, 1, 2, 5, 6, |
391 |
genre_combo = gtk_combo_new(); |
560 |
GTK_FILL, GTK_FILL, 0, 2); |
392 |
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), |
561 |
|
393 |
FALSE); |
562 |
label = gtk_label_new("Genre:"); |
|
|
563 |
g_ptr_array_add(v1_labels_list, (gpointer)label); |
564 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
565 |
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6, |
566 |
GTK_FILL, GTK_FILL, 5, 5); |
567 |
|
568 |
v1_genre_combo = gtk_combo_new(); |
569 |
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v1_genre_combo)->entry), |
570 |
FALSE); |
394 |
if (!genre_list) |
571 |
if (!genre_list) |
395 |
{ |
572 |
{ |
396 |
struct genre_item *item; |
573 |
struct genre_item *item; |
Lines 408-484
Link Here
|
408 |
genre_list = g_list_prepend(genre_list, item); |
585 |
genre_list = g_list_prepend(genre_list, item); |
409 |
genre_list = g_list_sort(genre_list, genre_comp_func); |
586 |
genre_list = g_list_sort(genre_list, genre_comp_func); |
410 |
} |
587 |
} |
411 |
genre_set_popdown(genre_combo, genre_list); |
588 |
genre_set_popdown(v1_genre_combo, genre_list); |
412 |
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(genre_combo)->list), |
589 |
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v1_genre_combo)->list), |
413 |
"select-child", genre_selected, NULL); |
590 |
"select-child", v1_genre_selected, NULL); |
414 |
|
591 |
|
415 |
gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, |
592 |
gtk_table_attach(GTK_TABLE(table), v1_genre_combo, 3, 5, 5, 6, |
416 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
593 |
GTK_FILL | GTK_SHRINK, GTK_FILL | |
417 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); |
594 |
GTK_SHRINK, 0, 2); |
418 |
|
595 |
|
419 |
bbox = gtk_hbutton_box_new(); |
596 |
bbox = gtk_hbutton_box_new(); |
420 |
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), |
597 |
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); |
421 |
GTK_BUTTONBOX_END); |
598 |
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0); |
422 |
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); |
599 |
gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); |
423 |
gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0); |
600 |
gtk_box_pack_start(GTK_BOX(id3v1_frame_vbox), bbox, FALSE, FALSE, 0); |
424 |
|
601 |
|
425 |
save = gtk_button_new_with_label(_("Save")); |
602 |
copy_from = gtk_button_new_with_label("ID3v1 to ID3v2"); |
426 |
gtk_signal_connect(GTK_OBJECT(save), "clicked", save_cb, NULL); |
603 |
gtk_signal_connect(GTK_OBJECT(copy_from), "clicked", GTK_SIGNAL_FUNC(copy_v1_to_v2_cb), NULL); |
427 |
GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT); |
604 |
// remove the next line to thicken the button width |
428 |
gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0); |
605 |
GTK_WIDGET_SET_FLAGS(copy_from, GTK_CAN_DEFAULT); |
429 |
gtk_widget_grab_default(save); |
606 |
gtk_box_pack_start(GTK_BOX(bbox), copy_from, FALSE, TRUE, 0); |
430 |
|
607 |
|
431 |
remove_id3 = gtk_button_new_with_label(_("Remove ID3")); |
608 |
|
432 |
gtk_signal_connect(GTK_OBJECT(remove_id3), "clicked", |
609 |
notebook = gtk_notebook_new (); |
433 |
remove_id3_cb, NULL); |
610 |
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP); |
434 |
GTK_WIDGET_SET_FLAGS(remove_id3, GTK_CAN_DEFAULT); |
611 |
|
435 |
gtk_box_pack_start(GTK_BOX(bbox), remove_id3, TRUE, TRUE, 0); |
612 |
label = gtk_label_new ("ID3v1"); |
436 |
|
613 |
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v1_vbox, label); |
437 |
cancel = gtk_button_new_with_label(_("Cancel")); |
614 |
|
438 |
gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", |
615 |
|
439 |
gtk_widget_destroy, GTK_OBJECT(window)); |
616 |
//////////////////////////////////////////////////////////////////////////////////////////////////// |
440 |
GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); |
617 |
//////////////////////////////////////////////////////////////////////////////////////////////////// |
441 |
gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); |
618 |
|
442 |
|
619 |
id3v2_vbox = gtk_vbox_new(FALSE, 0); |
443 |
mpeg_frame = gtk_frame_new(_("MPEG Info:")); |
620 |
|
444 |
gtk_box_pack_start(GTK_BOX(hbox), mpeg_frame, FALSE, FALSE, 0); |
621 |
id3v2_frame = gtk_frame_new("ID3v2 Information"); |
445 |
|
622 |
gtk_box_pack_start(GTK_BOX(id3v2_vbox), id3v2_frame, FALSE, FALSE, 0); |
446 |
mpeg_box = gtk_vbox_new(FALSE, 5); |
623 |
|
447 |
gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_box); |
624 |
id3v2_frame_vbox = gtk_vbox_new(FALSE, 0); |
448 |
gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); |
625 |
gtk_container_add(GTK_CONTAINER(id3v2_frame), id3v2_frame_vbox); |
449 |
gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); |
626 |
|
450 |
|
627 |
table = gtk_table_new(6, 6, FALSE); |
451 |
mpeg_level = gtk_label_new(""); |
628 |
gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
452 |
gtk_widget_set_usize(mpeg_level, 120, -2); |
629 |
gtk_widget_set_usize(GTK_WIDGET(table), 400, -1); |
453 |
gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0); |
630 |
//gtk_container_add(GTK_CONTAINER(id3v2_frame), table); |
454 |
gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_level, FALSE, FALSE, 0); |
631 |
gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), table, FALSE, FALSE, 0); |
455 |
|
632 |
|
456 |
mpeg_bitrate = gtk_label_new(""); |
633 |
v2_checkbox = gtk_check_button_new_with_label ("Disable ID3v2 Tag"); |
457 |
gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0); |
634 |
gtk_signal_connect(GTK_OBJECT(v2_checkbox), "toggled", GTK_SIGNAL_FUNC(v2_toggle_cb), NULL); |
458 |
gtk_label_set_justify(GTK_LABEL(mpeg_bitrate), |
635 |
gtk_table_attach(GTK_TABLE(table), v2_checkbox, 1, 3, 0, 1, |
459 |
GTK_JUSTIFY_LEFT); |
636 |
GTK_FILL, GTK_FILL, 0, 2); |
460 |
gtk_box_pack_start(GTK_BOX(mpeg_box), |
637 |
|
461 |
mpeg_bitrate, FALSE, FALSE, 0); |
638 |
label = gtk_label_new("Track number:"); |
462 |
|
639 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
463 |
mpeg_samplerate = gtk_label_new(""); |
640 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
464 |
gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0); |
641 |
gtk_table_attach(GTK_TABLE(table), label, 3, 4, 0, 1, |
465 |
gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_samplerate, |
642 |
GTK_FILL, GTK_FILL, 5,5); |
466 |
FALSE, FALSE, 0); |
643 |
|
467 |
|
644 |
v2_tracknum_entry = gtk_entry_new_with_max_length(3); |
468 |
mpeg_flags = gtk_label_new(""); |
645 |
gtk_widget_set_usize(v2_tracknum_entry, 20, -1); |
469 |
gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0); |
646 |
gtk_table_attach(GTK_TABLE(table), v2_tracknum_entry, 4, 5, 0, 1, |
470 |
gtk_label_set_justify(GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT); |
647 |
GTK_FILL, GTK_FILL, 0, 2); |
471 |
gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_flags, |
648 |
|
472 |
FALSE, FALSE, 0); |
649 |
label = gtk_label_new("Title:"); |
473 |
|
650 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
474 |
mpeg_fileinfo = gtk_label_new(""); |
651 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
475 |
gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0); |
652 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, |
476 |
gtk_label_set_justify(GTK_LABEL(mpeg_fileinfo), |
653 |
GTK_FILL, GTK_FILL, 5, 5); |
477 |
GTK_JUSTIFY_LEFT); |
654 |
|
478 |
gtk_box_pack_start(GTK_BOX(mpeg_box), mpeg_fileinfo, |
655 |
v2_title_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
479 |
FALSE, FALSE, 0); |
656 |
gtk_table_attach(GTK_TABLE(table), v2_title_entry, 1, 5, 1, 2, |
|
|
657 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
658 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
659 |
|
660 |
label = gtk_label_new("Artist:"); |
661 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
662 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
663 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, |
664 |
GTK_FILL, GTK_FILL, 5, 5); |
665 |
|
666 |
v2_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
667 |
gtk_table_attach(GTK_TABLE(table), v2_artist_entry, 1, 5, 2, 3, |
668 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
669 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
670 |
|
671 |
label = gtk_label_new("Album:"); |
672 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
673 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
674 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, |
675 |
GTK_FILL, GTK_FILL, 5, 5); |
676 |
|
677 |
v2_album_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
678 |
gtk_table_attach(GTK_TABLE(table), v2_album_entry, 1, 5, 3, 4, |
679 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
680 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
681 |
|
682 |
label = gtk_label_new("Comment:"); |
683 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
684 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
685 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, |
686 |
GTK_FILL, GTK_FILL, 5, 5); |
687 |
|
688 |
v2_comment_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
689 |
gtk_table_attach(GTK_TABLE(table), v2_comment_entry, 1, 5, 4, 5, |
690 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
691 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
692 |
|
693 |
label = gtk_label_new("Year:"); |
694 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
695 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
696 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, |
697 |
GTK_FILL, GTK_FILL, 5, 5); |
698 |
|
699 |
v2_year_entry = gtk_entry_new_with_max_length(4); |
700 |
gtk_widget_set_usize(v2_year_entry, 45, -1); |
701 |
gtk_table_attach(GTK_TABLE(table), v2_year_entry, 1, 2, 5, 6, |
702 |
GTK_FILL, GTK_FILL, 0, 2); |
703 |
|
704 |
label = gtk_label_new("Genre:"); |
705 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
706 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
707 |
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 5, 6, |
708 |
GTK_FILL, GTK_FILL, 5, 5); |
709 |
|
710 |
v2_genre_combo = gtk_combo_new(); |
711 |
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(v2_genre_combo)->entry), FALSE); |
712 |
genre_set_popdown(v2_genre_combo, genre_list); |
713 |
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(v2_genre_combo)->list), |
714 |
"select-child", v2_genre_selected, NULL); |
715 |
|
716 |
gtk_table_attach(GTK_TABLE(table), v2_genre_combo, 3, 5, 5, 6, |
717 |
GTK_FILL | GTK_SHRINK, GTK_FILL | |
718 |
GTK_SHRINK, 0, 2); |
719 |
|
720 |
label = gtk_label_new("Composer:"); |
721 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
722 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
723 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 6, 7, |
724 |
GTK_FILL, GTK_FILL, 5, 5); |
725 |
|
726 |
v2_composer_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
727 |
gtk_table_attach(GTK_TABLE(table), v2_composer_entry, 1, 5, 6, 7, |
728 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
729 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
730 |
|
731 |
label = gtk_label_new("Orig. Artist:"); |
732 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
733 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
734 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 7, 8, |
735 |
GTK_FILL, GTK_FILL, 5, 5); |
736 |
|
737 |
v2_orig_artist_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
738 |
gtk_table_attach(GTK_TABLE(table), v2_orig_artist_entry, 1, 5, 7, 8, |
739 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
740 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
741 |
|
742 |
label = gtk_label_new("URL:"); |
743 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
744 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
745 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 8, 9, |
746 |
GTK_FILL, GTK_FILL, 5, 5); |
747 |
|
748 |
v2_url_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
749 |
gtk_table_attach(GTK_TABLE(table), v2_url_entry, 1, 5, 8, 9, |
750 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
751 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
752 |
label = gtk_label_new("Encoded By:"); |
753 |
g_ptr_array_add(v2_labels_list, (gpointer)label); |
754 |
gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); |
755 |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 9, 10, |
756 |
GTK_FILL, GTK_FILL, 5, 5); |
757 |
|
758 |
v2_encoded_by_entry = gtk_entry_new_with_max_length(MAX_ENTRY_LEN2); |
759 |
gtk_table_attach(GTK_TABLE(table), v2_encoded_by_entry, 1, 5, 9, 10, |
760 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, |
761 |
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 2); |
762 |
|
763 |
bbox = gtk_hbutton_box_new(); |
764 |
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_START); |
765 |
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0); |
766 |
gtk_container_set_border_width(GTK_CONTAINER(bbox), 5); |
767 |
gtk_box_pack_start(GTK_BOX(id3v2_frame_vbox), bbox, FALSE, FALSE, 0); |
768 |
|
769 |
copy_to = gtk_button_new_with_label("ID3v2 to ID3v1"); |
770 |
gtk_signal_connect(GTK_OBJECT(copy_to), "clicked", GTK_SIGNAL_FUNC(copy_v2_to_v1_cb), NULL); |
771 |
// remove the next line to thicken the button width |
772 |
GTK_WIDGET_SET_FLAGS(copy_to, GTK_CAN_DEFAULT); |
773 |
gtk_box_pack_start(GTK_BOX(bbox), copy_to, FALSE, TRUE, 0); |
774 |
|
775 |
label = gtk_label_new ("ID3v2"); |
776 |
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), id3v2_vbox, label); |
777 |
|
778 |
|
779 |
//////////////////////////////////////////////////////////////////////////////////////////////////// |
780 |
//////////////////////////////////////////////////////////////////////////////////////////////////// |
781 |
|
782 |
mpeg_frame = gtk_frame_new("MPEG Information"); |
783 |
mpeg_hbox = gtk_hbox_new(FALSE,50); |
784 |
gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_hbox); |
785 |
|
786 |
mpeg_lvbox = gtk_vbox_new(FALSE, 5); |
787 |
gtk_container_set_border_width(GTK_CONTAINER(mpeg_lvbox), 10); |
788 |
gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_lvbox, FALSE, FALSE, 0); |
789 |
|
790 |
//gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
791 |
//gtk_widget_set_usize(GTK_WIDGET(table), 325, -1); |
792 |
//gtk_container_add(GTK_CONTAINER(mpeg_frame), table); |
793 |
|
794 |
mpeg_box = gtk_vbox_new(FALSE, 5); |
795 |
gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_box, FALSE, FALSE, 0); |
796 |
gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10); |
797 |
gtk_box_set_spacing(GTK_BOX(mpeg_box), 0); |
798 |
|
799 |
mpeg_level = gtk_label_new(""); |
800 |
//gtk_widget_set_usize(mpeg_level, 120, -2); |
801 |
gtk_label_set_justify (GTK_LABEL(mpeg_level), GTK_JUSTIFY_LEFT); |
802 |
gtk_misc_set_alignment(GTK_MISC(mpeg_level), 0, 0.5); |
803 |
gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_level, FALSE, FALSE, 0); |
804 |
|
805 |
mpeg_samplerate = gtk_label_new(""); |
806 |
gtk_label_set_justify (GTK_LABEL(mpeg_samplerate), GTK_JUSTIFY_LEFT); |
807 |
gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 0, 0.5); |
808 |
gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_samplerate, FALSE, FALSE, 0); |
809 |
|
810 |
mpeg_fileinfo = gtk_label_new(""); |
811 |
gtk_label_set_justify (GTK_LABEL(mpeg_fileinfo), GTK_JUSTIFY_LEFT); |
812 |
gtk_misc_set_alignment(GTK_MISC(mpeg_fileinfo), 0, 0.5); |
813 |
gtk_box_pack_start(GTK_BOX(mpeg_lvbox), mpeg_fileinfo, FALSE, FALSE, 0); |
814 |
|
815 |
mpeg_rvbox = gtk_vbox_new(FALSE, 5); |
816 |
gtk_box_pack_start(GTK_BOX(mpeg_hbox), mpeg_rvbox, FALSE, FALSE, 0); |
817 |
gtk_container_set_border_width(GTK_CONTAINER(mpeg_rvbox), 10); |
818 |
|
819 |
mpeg_bitrate = gtk_label_new(""); |
820 |
gtk_label_set_justify (GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_LEFT); |
821 |
gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 0, 0.5); |
822 |
gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_bitrate, FALSE, FALSE, 0); |
823 |
|
824 |
mpeg_flags = gtk_label_new(""); |
825 |
gtk_label_set_justify (GTK_LABEL(mpeg_flags), GTK_JUSTIFY_LEFT); |
826 |
gtk_misc_set_alignment(GTK_MISC(mpeg_flags), 0, 0.5); |
827 |
gtk_box_pack_start(GTK_BOX(mpeg_rvbox), mpeg_flags, FALSE, FALSE, 0); |
828 |
|
829 |
label = gtk_label_new ("MPEG"); |
830 |
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), mpeg_frame, label); |
831 |
|
832 |
////////////////////////////////////////////////////////////////// |
833 |
////////////////////////////////////////////////////////////////// |
834 |
|
835 |
// add notebook to window vbox |
836 |
gtk_box_pack_start(GTK_BOX(window_vbox), notebook, FALSE, FALSE, 0); |
837 |
|
838 |
// add button box to window vbox |
839 |
bbox = gtk_hbutton_box_new(); |
840 |
gtk_box_pack_start(GTK_BOX(window_vbox), bbox, FALSE, FALSE, 0); |
841 |
|
842 |
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END); |
843 |
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5); |
844 |
//gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h); |
845 |
|
846 |
save = gtk_button_new_with_label("Save"); |
847 |
gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_cb), NULL); |
848 |
//GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT); |
849 |
gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 5); |
850 |
//gtk_widget_grab_default(save); |
851 |
|
852 |
close = gtk_button_new_with_label("Close"); |
853 |
gtk_signal_connect_object(GTK_OBJECT(close), "clicked", |
854 |
GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); |
855 |
//GTK_WIDGET_SET_FLAGS(close, GTK_CAN_DEFAULT); |
856 |
gtk_box_pack_start(GTK_BOX(bbox), close, TRUE, TRUE, 5); |
480 |
|
857 |
|
481 |
gtk_widget_show_all(window); |
858 |
gtk_container_add(GTK_CONTAINER(window), window_vbox); |
|
|
859 |
gtk_widget_show_all(window); |
482 |
} |
860 |
} |
483 |
|
861 |
|
484 |
if (current_filename) |
862 |
if (current_filename) |
Lines 495-523
Link Here
|
495 |
title = g_strdup(g_basename(filename)); |
873 |
title = g_strdup(g_basename(filename)); |
496 |
if ((tmp = strrchr(title, '.')) != NULL) |
874 |
if ((tmp = strrchr(title, '.')) != NULL) |
497 |
*tmp = '\0'; |
875 |
*tmp = '\0'; |
498 |
gtk_entry_set_text(GTK_ENTRY(title_entry), title); |
876 |
gtk_entry_set_text(GTK_ENTRY(v1_title_entry), title); |
|
|
877 |
gtk_entry_set_text(GTK_ENTRY(v2_title_entry), title); |
499 |
g_free(title); |
878 |
g_free(title); |
500 |
|
879 |
|
501 |
gtk_entry_set_text(GTK_ENTRY(artist_entry), ""); |
880 |
gtk_entry_set_text(GTK_ENTRY(v1_artist_entry), ""); |
502 |
gtk_entry_set_text(GTK_ENTRY(album_entry), ""); |
881 |
gtk_entry_set_text(GTK_ENTRY(v1_album_entry), ""); |
503 |
gtk_entry_set_text(GTK_ENTRY(year_entry), ""); |
882 |
gtk_entry_set_text(GTK_ENTRY(v1_year_entry), ""); |
504 |
gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); |
883 |
gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), ""); |
505 |
gtk_entry_set_text(GTK_ENTRY(comment_entry), ""); |
884 |
gtk_entry_set_text(GTK_ENTRY(v1_comment_entry), ""); |
506 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), |
885 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), |
|
|
886 |
genre_find_index(genre_list, 0xff)); |
887 |
|
888 |
gtk_entry_set_text(GTK_ENTRY(v2_artist_entry), ""); |
889 |
gtk_entry_set_text(GTK_ENTRY(v2_album_entry), ""); |
890 |
gtk_entry_set_text(GTK_ENTRY(v2_year_entry), ""); |
891 |
gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), ""); |
892 |
gtk_entry_set_text(GTK_ENTRY(v2_comment_entry), ""); |
893 |
gtk_entry_set_text(GTK_ENTRY(v2_composer_entry), ""); |
894 |
gtk_entry_set_text(GTK_ENTRY(v2_orig_artist_entry), ""); |
895 |
gtk_entry_set_text(GTK_ENTRY(v2_url_entry), ""); |
896 |
gtk_entry_set_text(GTK_ENTRY(v2_encoded_by_entry), ""); |
897 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), |
507 |
genre_find_index(genre_list, 0xff)); |
898 |
genre_find_index(genre_list, 0xff)); |
|
|
899 |
|
508 |
gtk_label_set_text(GTK_LABEL(mpeg_level), "MPEG ?, layer ?"); |
900 |
gtk_label_set_text(GTK_LABEL(mpeg_level), "MPEG ?, layer ?"); |
509 |
gtk_label_set_text(GTK_LABEL(mpeg_bitrate), ""); |
901 |
gtk_label_set_text(GTK_LABEL(mpeg_bitrate), ""); |
510 |
gtk_label_set_text(GTK_LABEL(mpeg_samplerate), ""); |
902 |
gtk_label_set_text(GTK_LABEL(mpeg_samplerate), ""); |
511 |
gtk_label_set_text(GTK_LABEL(mpeg_flags), ""); |
903 |
gtk_label_set_text(GTK_LABEL(mpeg_flags), ""); |
512 |
gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), ""); |
904 |
gtk_label_set_text(GTK_LABEL(mpeg_fileinfo), ""); |
513 |
|
|
|
514 |
if (!strncasecmp(filename, "http://", 7)) |
905 |
if (!strncasecmp(filename, "http://", 7)) |
515 |
{ |
906 |
{ |
516 |
file_info_http(filename); |
907 |
file_info_http(filename); |
517 |
return; |
908 |
return; |
518 |
} |
909 |
} |
519 |
|
910 |
|
520 |
gtk_widget_set_sensitive(id3_frame, TRUE); |
911 |
gtk_widget_set_sensitive(id3v1_frame, TRUE); |
|
|
912 |
gtk_widget_set_sensitive(id3v2_frame, TRUE); |
521 |
|
913 |
|
522 |
if ((fh = fopen(current_filename, "rb")) != NULL) |
914 |
if ((fh = fopen(current_filename, "rb")) != NULL) |
523 |
{ |
915 |
{ |
Lines 525-564
Link Here
|
525 |
unsigned char tmp[4]; |
917 |
unsigned char tmp[4]; |
526 |
struct frame frm; |
918 |
struct frame frm; |
527 |
gboolean id3_found = FALSE; |
919 |
gboolean id3_found = FALSE; |
|
|
920 |
char *temp = NULL; |
921 |
struct id3_tag *id3 = NULL; |
528 |
|
922 |
|
529 |
fseek(fh, -sizeof (tag), SEEK_END); |
923 |
/* |
530 |
if (fread(&tag, 1, sizeof (tag), fh) == sizeof (tag)) |
924 |
* Try reading ID3v2 tag. |
|
|
925 |
*/ |
926 |
if (!mpg123_cfg.disable_id3v2) |
531 |
{ |
927 |
{ |
532 |
if (!strncmp(tag.tag, "TAG", 3)) |
928 |
fseek(fh, 0, SEEK_SET); |
|
|
929 |
id3 = id3_open_fp(fh, 0); |
930 |
if (id3) |
533 |
{ |
931 |
{ |
534 |
id3_found = TRUE; |
932 |
mpg123_get_id3v2(id3, &id3v2tag); |
535 |
set_entry_tag(GTK_ENTRY(title_entry), |
933 |
set_entry_tag(GTK_ENTRY(v2_title_entry), |
536 |
tag.title, 30); |
934 |
id3v2tag.title, 128); |
537 |
set_entry_tag(GTK_ENTRY(artist_entry), |
935 |
set_entry_tag(GTK_ENTRY(v2_artist_entry), |
538 |
tag.artist, 30); |
936 |
id3v2tag.artist, 128); |
539 |
set_entry_tag(GTK_ENTRY(album_entry), |
937 |
set_entry_tag(GTK_ENTRY(v2_album_entry), |
540 |
tag.album, 30); |
938 |
id3v2tag.album, 128); |
541 |
set_entry_tag(GTK_ENTRY(year_entry), |
939 |
set_entry_tag(GTK_ENTRY(v2_comment_entry), |
542 |
tag.year, 4); |
940 |
id3v2tag.comment, 256); |
543 |
/* Check for v1.1 tags */ |
941 |
set_entry_tag(GTK_ENTRY(v2_composer_entry), |
544 |
if (tag.u.v1_1.__zero == 0) |
942 |
id3v2tag.composer, MAX_ENTRY_LEN2); |
545 |
{ |
943 |
set_entry_tag(GTK_ENTRY(v2_orig_artist_entry), |
546 |
char *temp = g_strdup_printf("%d", tag.u.v1_1.track_number); |
944 |
id3v2tag.orig_artist, MAX_ENTRY_LEN2); |
547 |
set_entry_tag(GTK_ENTRY(comment_entry), |
945 |
set_entry_tag(GTK_ENTRY(v2_url_entry), |
548 |
tag.u.v1_1.comment, 28); |
946 |
id3v2tag.url, MAX_ENTRY_LEN2); |
549 |
gtk_entry_set_text(GTK_ENTRY(tracknum_entry), temp); |
947 |
set_entry_tag(GTK_ENTRY(v2_encoded_by_entry), |
550 |
g_free(temp); |
948 |
id3v2tag.encoded_by, MAX_ENTRY_LEN2); |
551 |
} |
|
|
552 |
else |
553 |
{ |
554 |
set_entry_tag(GTK_ENTRY(comment_entry), |
555 |
tag.u.v1_0.comment, 30); |
556 |
gtk_entry_set_text(GTK_ENTRY(tracknum_entry), ""); |
557 |
} |
558 |
|
949 |
|
559 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list), genre_find_index(genre_list, tag.genre)); |
950 |
temp = g_strdup_printf("%d", id3v2tag.track_number); |
|
|
951 |
gtk_entry_set_text(GTK_ENTRY(v2_tracknum_entry), temp); |
952 |
g_free(temp); |
953 |
|
954 |
temp = g_strdup_printf("%d", id3v2tag.year); |
955 |
gtk_entry_set_text(GTK_ENTRY(v2_year_entry), temp); |
956 |
g_free(temp); |
957 |
|
958 |
printf("Loading genre: %s", id3v2tag.genre); |
959 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v2_genre_combo)->list), genre_find_index_str(genre_list, id3v2tag.genre)); |
960 |
id3_close(id3); |
560 |
} |
961 |
} |
|
|
962 |
else |
963 |
{ |
964 |
// Grey out the id3v2 tab |
965 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v2_checkbox), TRUE); |
966 |
} |
967 |
} |
968 |
|
969 |
/* |
970 |
* Try reading ID3v1 tag. |
971 |
*/ |
972 |
fseek(fh, -sizeof (id3v1tag), SEEK_END); |
973 |
if ( (fread(&id3v1tag, 1, sizeof (id3v1tag), fh) == sizeof (id3v1tag)) && |
974 |
!strncmp(id3v1tag.tag, "TAG", 3)) |
975 |
{ |
976 |
id3_found = TRUE; |
977 |
set_entry_tag(GTK_ENTRY(v1_title_entry), |
978 |
id3v1tag.title, 30); |
979 |
set_entry_tag(GTK_ENTRY(v1_artist_entry), |
980 |
id3v1tag.artist, 30); |
981 |
set_entry_tag(GTK_ENTRY(v1_album_entry), |
982 |
id3v1tag.album, 30); |
983 |
set_entry_tag(GTK_ENTRY(v1_year_entry), |
984 |
id3v1tag.year, 4); |
985 |
/* Check for v1.1 tags */ |
986 |
if (id3v1tag.u.v1_1.__zero == 0) |
987 |
{ |
988 |
char *temp = g_strdup_printf("%d", id3v1tag.u.v1_1.track_number); |
989 |
set_entry_tag(GTK_ENTRY(v1_comment_entry), |
990 |
id3v1tag.u.v1_1.comment, 28); |
991 |
gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), temp); |
992 |
g_free(temp); |
993 |
} |
994 |
else |
995 |
{ |
996 |
set_entry_tag(GTK_ENTRY(v1_comment_entry), |
997 |
id3v1tag.u.v1_0.comment, 30); |
998 |
gtk_entry_set_text(GTK_ENTRY(v1_tracknum_entry), ""); |
999 |
} |
1000 |
|
1001 |
gtk_list_select_item(GTK_LIST(GTK_COMBO(v1_genre_combo)->list), genre_find_index(genre_list, id3v1tag.genre)); |
561 |
} |
1002 |
} |
|
|
1003 |
else |
1004 |
{ |
1005 |
// Grey out id3v1 tab |
1006 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(v1_checkbox), TRUE); |
1007 |
} |
1008 |
|
562 |
rewind(fh); |
1009 |
rewind(fh); |
563 |
if (fread(tmp, 1, 4, fh) != 4) |
1010 |
if (fread(tmp, 1, 4, fh) != 4) |
564 |
{ |
1011 |
{ |