annotate Plugins/Input/mpg123/fileinfo.c @ 186:01babf2781bb trunk

[svn] Fileinfo dialog adjustment.
author nenolod
date Sun, 13 Nov 2005 18:14:56 -0800
parents fa848bd484d8
children 9bc585cc3c65
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * Based on XMMS:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * (at your option) any later version.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 #include "mpg123.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 # include <id3.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 #include <glib.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 #include <glib/gi18n.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 #include <gtk/gtk.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 #include <gdk/gdkkeysyms.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32 #include <stdio.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 #include <stdlib.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34 #include <string.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 #include <stdarg.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 #include <unistd.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 #include <fcntl.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 #include <errno.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41 #include "audacious/util.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 #include <libaudacious/util.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43 #include <libaudacious/vfs.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44 #include <libaudacious/xentry.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 #include "mp3.xpm"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48 static GtkWidget *window = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49 static GtkWidget *filename_entry, *id3_frame;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 static GtkWidget *title_entry, *artist_entry, *album_entry, *year_entry,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 *tracknum_entry, *comment_entry;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52 static GtkWidget *genre_combo;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 static GtkWidget * totaltracks_entry;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 static GtkWidget *mpeg_level, *mpeg_bitrate, *mpeg_samplerate, *mpeg_flags,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 *mpeg_error, *mpeg_copy, *mpeg_orig, *mpeg_emph, *mpeg_frames,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 *mpeg_filesize;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 static GtkWidget *mpeg_level_val, *mpeg_bitrate_val, *mpeg_samplerate_val,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 *mpeg_error_val, *mpeg_copy_val, *mpeg_orig_val, *mpeg_emph_val,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 *mpeg_frames_val, *mpeg_filesize_val;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63 GtkWidget *vbox, *hbox, *left_vbox, *table;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 GtkWidget *mpeg_frame, *mpeg_box;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 GtkWidget *label, *filename_vbox;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 GtkWidget *bbox;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 GtkWidget *remove_id3, *cancel, *save;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 GtkWidget *boxx;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 GtkWidget *revert;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 VFSFile *fh;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 struct id3v1tag_t tag;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 const gchar *emphasis[4];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 const gchar *bool_label[2];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79 static GList *genre_list = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 static gchar *current_filename = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82 extern gchar *mpg123_filename;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 extern gint mpg123_bitrate, mpg123_frequency, mpg123_layer, mpg123_lsf,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 mpg123_mode;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 extern gboolean mpg123_stereo, mpg123_mpeg25;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87 glong info_rate;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 void fill_entries(GtkWidget * w, gpointer data);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91 #define MAX_STR_LEN 100
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 #ifndef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 set_entry_tag(GtkEntry * entry, gchar * tag, gint length)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 gint stripped_len;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 gchar *text, *text_utf8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 stripped_len = mpg123_strip_spaces(tag, length);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102 text = g_strdup_printf("%-*.*s", stripped_len, stripped_len, tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 if ((text_utf8 = str_to_utf8(text))) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 gtk_entry_set_text(entry, text_utf8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106 g_free(text_utf8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 gtk_entry_set_text(entry, "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112 g_free(text);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116 get_entry_tag(GtkEntry * entry, gchar * tag, gint length)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 gchar *text = str_to_utf8(gtk_entry_get_text(entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119 memset(tag, ' ', length);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120 memcpy(tag, text, strlen(text) > length ? length : strlen(text));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 static gint
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 find_genre_id(const gchar * text)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 gint i;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128 for (i = 0; i < GENRE_MAX; i++) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129 if (!strcmp(mpg123_id3_genres[i], text))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 return i;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 if (text[0] == '\0')
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 return 0xff;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 return 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 press_save(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 gtk_button_clicked(GTK_BUTTON(save));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 GtkWidget * copy_album_tags_but, * paste_album_tags_but;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147 struct album_tags_t {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 char * performer;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149 char * album;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 char * year;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 char * total_tracks;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 struct album_tags_t album_tags = { NULL, NULL, NULL, NULL };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 #define FREE_AND_ZERO(x) do { g_free(x); x = NULL; } while (0)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158 static void free_album_tags()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
160 FREE_AND_ZERO(album_tags.performer);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
161 FREE_AND_ZERO(album_tags.album);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
162 FREE_AND_ZERO(album_tags.year);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
163 FREE_AND_ZERO(album_tags.total_tracks);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
164 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
165
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
166 static inline char * entry_text_dup_or_null(GtkWidget * e)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
167 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
168 const char * text = gtk_entry_get_text(GTK_ENTRY(e));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
169 if (strlen(text) > 0)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
170 return g_strdup(text);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
171 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
172 return NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
173 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
174
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
175 static inline void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
176 update_paste_sensitive()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
177 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
178 gtk_widget_set_sensitive(GTK_WIDGET(paste_album_tags_but),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
179 album_tags.performer ||
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
180 album_tags.album ||
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
181 album_tags.year ||
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
182 album_tags.total_tracks);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
183
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
184 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
185
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
186 static void validate_zeropad_tracknums()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
187 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
188 const char * tn_str, * tt_str, * end;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
189 char buf[5];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
190 int tn, tt;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
191
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
192 tn_str = gtk_entry_get_text(GTK_ENTRY(tracknum_entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
193 tt_str = gtk_entry_get_text(GTK_ENTRY(totaltracks_entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
194
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
195 end = tt_str;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
196 tt = strtol(tt_str,(char**)&end,10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
197 if (end != tt_str) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
198 sprintf(buf,"%02d",tt);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
199 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
200 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
201 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
202 tt = 1000; /* any tracknum is valid */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
203 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
204
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
205 end = tn_str;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
206 tn = strtol(tn_str,(char**)&end,10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
207 if (end != tn_str && tn <= tt) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
208 sprintf(buf,"%02d",tn);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
209 gtk_entry_set_text(GTK_ENTRY(tracknum_entry),buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
210 } else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
211 gtk_entry_set_text(GTK_ENTRY(tracknum_entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
212
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
213 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
214
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
215 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
216 copy_album_tags()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
217 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
218 validate_zeropad_tracknums();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
219 free_album_tags();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
220 album_tags.performer = entry_text_dup_or_null(artist_entry);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
221 album_tags.album = entry_text_dup_or_null(album_entry);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
222 album_tags.year = entry_text_dup_or_null(year_entry);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
223 album_tags.total_tracks = entry_text_dup_or_null(totaltracks_entry);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
224 update_paste_sensitive();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
225 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
226
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
227 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
228 paste_album_tags()
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
229 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
230 if (album_tags.performer)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
231 gtk_entry_set_text(GTK_ENTRY(artist_entry),album_tags.performer);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
232 if (album_tags.album)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
233 gtk_entry_set_text(GTK_ENTRY(album_entry),album_tags.album);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
234 if (album_tags.year)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
235 gtk_entry_set_text(GTK_ENTRY(year_entry),album_tags.year);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
236 if (album_tags.total_tracks)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
237 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),album_tags.total_tracks);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
238 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
239
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
240 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
241
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
242 static gint
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
243 genre_comp_func(gconstpointer a, gconstpointer b)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
244 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
245 return strcasecmp(a, b);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
246 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
247
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
248 static gboolean
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
249 fileinfo_keypress_cb(GtkWidget * widget,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
250 GdkEventKey * event,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
251 gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
252 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
253 if (!event)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
254 return FALSE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
255
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
256 switch (event->keyval) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
257 case GDK_Escape:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
258 gtk_widget_destroy(window);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
259 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
260 default:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
261 return FALSE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
262 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
263
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
264 return TRUE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
265 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
266
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
267 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
268 /* some helper id3(v2) functions */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
269
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
270 static void str_to_id3v2_frame(const char * str, ID3Tag * tag, ID3_FrameID frame_id)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
271 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
272 ID3Frame * frame = ID3Tag_FindFrameWithID(tag,frame_id);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
273 ID3Field * text_field;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
274 gboolean new_frame = frame?FALSE:TRUE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
275
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
276 if (new_frame) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
277 frame = ID3Frame_NewID(frame_id);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
278 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
279
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
280 text_field = ID3Frame_GetField(frame,ID3FN_TEXT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
281 ID3Field_SetASCII(text_field, str);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
282
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
283 if (new_frame)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
284 ID3Tag_AddFrame(tag,frame);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
285 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
286
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
287 static void genre_combo_to_tag(GtkWidget * combo, ID3Tag * tag)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
288 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
289 int idx = -1, i;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
290 const char * genre = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
291 for(i=0;i<ID3_NR_OF_V1_GENRES;i++)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
292 if (!strcmp(genre,ID3_v1_genre_description[i])) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
293 idx = i; break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
294 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
295 if (idx>-1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
296 char code[7];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
297 snprintf(code,7,"(%d)",idx);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
298 str_to_id3v2_frame(code,tag,ID3FID_CONTENTTYPE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
299 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
300 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
301
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
302 static void id3v2_frame_to_entry(GtkWidget * entry,ID3Tag * tag, ID3_FrameID frame_id)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
303 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
304 ID3Frame * frame = ID3Tag_FindFrameWithID(tag,frame_id);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
305 ID3Field * text_field;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
306 if (frame) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
307 char buf[4096];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
308 text_field = ID3Frame_GetField(frame,ID3FN_TEXT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
309 ID3Field_GetASCII(text_field,buf,4096);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
310 gtk_entry_set_text(GTK_ENTRY(entry),buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
311 } else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
312 gtk_entry_set_text(GTK_ENTRY(entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
313 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
314
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
315 static void id3v2_frame_to_text_view(GtkWidget * entry,ID3Tag * tag, ID3_FrameID frame_id)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
316 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
317 ID3Frame * frame = ID3Tag_FindFrameWithID(tag,frame_id);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
318 ID3Field * text_field;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
319 if (frame) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
320 char buf[4096];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
321 text_field = ID3Frame_GetField(frame,ID3FN_TEXT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
322 ID3Field_GetASCII(text_field,buf,4096);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
323 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)),buf,-1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
324 } else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
325 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)),"",-1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
326 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
327
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
328 static void id3v2_tracknum_to_entries(GtkWidget * tracknum_entry,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
329 GtkWidget * totaltracks_entry,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
330 ID3Tag * tag)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
331 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
332 ID3Frame * frame = ID3Tag_FindFrameWithID(tag,ID3FID_TRACKNUM);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
333 ID3Field * text_field;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
334 if (frame) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
335 char buf[4096];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
336 char * slash;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
337 text_field = ID3Frame_GetField(frame,ID3FN_TEXT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
338 ID3Field_GetASCII(text_field,buf,4096);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
339 slash = strchr(buf,'/');
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
340 if (slash) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
341 slash[0] = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
342 gtk_entry_set_text(GTK_ENTRY(tracknum_entry),buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
343 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),slash+1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
344 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
345 gtk_entry_set_text(GTK_ENTRY(tracknum_entry),buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
346 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
347 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
348 } else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
349 gtk_entry_set_text(GTK_ENTRY(tracknum_entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
350 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry),"");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
351 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
352 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
353
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
354 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
355 if has v2 - link with v2, if not - attempt to link with v1
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
356 use this only for reading - always save v2
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
357 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
358 size_t ID3Tag_LinkPreferV2(ID3Tag *tag, const char *fileName)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
359 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
360 size_t r;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
361
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
362 r = ID3Tag_Link(tag,fileName);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
363 if (ID3Tag_HasTagType(tag,ID3TT_ID3V2)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
364 ID3Tag_Clear(tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
365 r = ID3Tag_LinkWithFlags(tag,fileName,ID3TT_ID3V2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
366 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
367 return r;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
368 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
369
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
370 #endif /* HAVE_ID3LIB */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
371
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
372 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
373
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
374 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
375 save_cb(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
376 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
377 ID3Tag * id3tag;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
378 const char * tracks_str, * trackno_str, * endptr;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
379 int trackno, tracks;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
380
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
381 if (str_has_prefix_nocase(current_filename, "http://"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
382 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
383
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
384 validate_zeropad_tracknums();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
385
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
386 id3tag = ID3Tag_New();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
387 ID3Tag_LinkWithFlags(id3tag, current_filename, ID3TT_ID3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
388
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
389 str_to_id3v2_frame(gtk_entry_get_text(GTK_ENTRY(title_entry)),id3tag,ID3FID_TITLE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
390 str_to_id3v2_frame(gtk_entry_get_text(GTK_ENTRY(artist_entry)),id3tag,ID3FID_LEADARTIST);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
391 str_to_id3v2_frame(gtk_entry_get_text(GTK_ENTRY(album_entry)),id3tag,ID3FID_ALBUM);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
392 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
393 GtkTextIter start, end;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
394 GtkTextBuffer * buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(comment_entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
395 gtk_text_buffer_get_start_iter(buffer,&start);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
396 gtk_text_buffer_get_end_iter(buffer,&end);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
397 str_to_id3v2_frame(gtk_text_buffer_get_text(buffer,&start,&end,FALSE),id3tag,ID3FID_COMMENT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
398 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
399 str_to_id3v2_frame(gtk_entry_get_text(GTK_ENTRY(year_entry)),id3tag,ID3FID_YEAR);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
400
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
401 /* saving trackno -> may be with album tracks number */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
402 trackno_str = gtk_entry_get_text(GTK_ENTRY(tracknum_entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
403 endptr = trackno_str;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
404 trackno = strtol(trackno_str,(char**)&endptr,10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
405 if (endptr != trackno_str) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
406 char buf[10];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
407 tracks_str = gtk_entry_get_text(GTK_ENTRY(totaltracks_entry));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
408 endptr = tracks_str;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
409 tracks = strtol(tracks_str,(char**)&endptr,10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
410 if (endptr != tracks_str)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
411 snprintf(buf,10,"%02d/%02d",trackno,tracks);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
412 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
413 snprintf(buf,10,"%02d",trackno);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
414 str_to_id3v2_frame(buf,id3tag,ID3FID_TRACKNUM);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
415 } else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
416 str_to_id3v2_frame("",id3tag,ID3FID_TRACKNUM);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
417
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
418
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
419 genre_combo_to_tag(genre_combo,id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
420 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
421
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
422 ID3Tag_Update(id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
423
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
424 ID3Tag_Delete(id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
425 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
426
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
427 #else /* ! HAVE_ID3LIB */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
428
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
429 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
430 save_cb(GtkWidget * widget,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
431 gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
432 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
433 VFSFile *file;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
434 gchar *msg = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
435
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
436 if (str_has_prefix_nocase(current_filename, "http://"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
437 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
438
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
439 if ((file = vfs_fopen(current_filename, "r+b")) != NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
440 gint tracknum;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
441
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
442 vfs_fseek(file, -128, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
443 vfs_fread(&tag, 1, sizeof(struct id3v1tag_t), file);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
444
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
445 if (g_str_has_prefix(tag.tag, "TAG"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
446 vfs_fseek(file, -128L, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
447 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
448 vfs_fseek(file, 0L, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
449
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
450 tag.tag[0] = 'T';
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
451 tag.tag[1] = 'A';
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
452 tag.tag[2] = 'G';
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
453
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
454 get_entry_tag(GTK_ENTRY(title_entry), tag.title, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
455 get_entry_tag(GTK_ENTRY(artist_entry), tag.artist, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
456 get_entry_tag(GTK_ENTRY(album_entry), tag.album, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
457 get_entry_tag(GTK_ENTRY(year_entry), tag.year, 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
458
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
459 tracknum = atoi(gtk_entry_get_text(GTK_ENTRY(tracknum_entry)));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
460 if (tracknum > 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
461 get_entry_tag(GTK_ENTRY(comment_entry), tag.u.v1_1.comment, 28);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
462 tag.u.v1_1.__zero = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
463 tag.u.v1_1.track_number = MIN(tracknum, 255);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
464 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
465 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
466 get_entry_tag(GTK_ENTRY(comment_entry), tag.u.v1_0.comment, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
467
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
468 tag.genre = find_genre_id(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
469 (genre_combo)->entry)));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
470 if (vfs_fwrite(&tag, 1, sizeof(tag), file) != sizeof(tag))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
471 msg = g_strdup_printf(_("%s\nUnable to write to file: %s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
472 _("Couldn't write tag!"), strerror(errno));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
473 vfs_fclose(file);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
474 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
475 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
476 msg = g_strdup_printf(_("%s\nUnable to open file: %s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
477 _("Couldn't write tag!"), strerror(errno));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
478 if (msg) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
479 GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
480 FALSE, NULL, NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
481 gtk_window_set_transient_for(GTK_WINDOW(mwin), GTK_WINDOW(window));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
482 g_free(msg);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
483 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
484 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
485 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
486 gtk_widget_set_sensitive(GTK_WIDGET(widget), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
487 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
488 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
489
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
490 #endif /* HAVE_ID3LIB */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
491
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
492 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
493 label_set_text(GtkWidget * label, gchar * str, ...)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
494 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
495 va_list args;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
496 gchar tempstr[MAX_STR_LEN];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
497
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
498 va_start(args, str);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
499 g_vsnprintf(tempstr, MAX_STR_LEN, str, args);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
500 va_end(args);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
501
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
502 gtk_label_set_text(GTK_LABEL(label), tempstr);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
503 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
504
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
505 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
506
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
507 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
508 remove_id3_cb(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
509 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
510 ID3Tag * id3tag;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
511
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
512 if (str_has_prefix_nocase(current_filename, "http://"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
513 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
514
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
515 id3tag = ID3Tag_New();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
516 ID3Tag_LinkWithFlags(id3tag, current_filename, ID3TT_ID3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
517
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
518 ID3Tag_Strip(id3tag,ID3TT_ALL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
519 ID3Tag_Update(id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
520
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
521 ID3Tag_Delete(id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
522 gtk_entry_set_text(GTK_ENTRY(title_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
523 gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
524 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
525 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(comment_entry)), "",-1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
526 gtk_entry_set_text(GTK_ENTRY(year_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
527 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
528 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
529 gtk_entry_set_text(GTK_ENTRY(totaltracks_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
530 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
531 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
532 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
533 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
534
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
535 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
536
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
537 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
538 remove_id3_cb(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
539 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
540 VFSFile *file;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
541 gint len;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
542 struct id3v1tag_t tag;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
543 gchar *msg = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
544
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
545 if (str_has_prefix_nocase(current_filename, "http://"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
546 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
547
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
548 if ((file = vfs_fopen(current_filename, "rb+")) != NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
549 vfs_fseek(file, -128, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
550 len = vfs_ftell(file);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
551
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
552 vfs_fread(&tag, 1, sizeof(struct id3v1tag_t), file);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
553
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
554 if (g_str_has_prefix(tag.tag, "TAG")) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
555 if (vfs_truncate(file, len))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
556 msg = g_strdup_printf(_("%s\n"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
557 "Unable to truncate file: %s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
558 _("Couldn't remove tag!"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
559 strerror(errno));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
560 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
561 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
562 msg = strdup(_("No tag to remove!"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
563
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
564 vfs_fclose(file);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
565 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
566 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
567 msg = g_strdup_printf(_("%s\nUnable to open file: %s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
568 _("Couldn't remove tag!"), strerror(errno));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
569 if (msg) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
570 GtkWidget *mwin = xmms_show_message(_("File Info"), msg, _("Ok"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
571 FALSE, NULL, NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
572 gtk_window_set_transient_for(GTK_WINDOW(mwin), GTK_WINDOW(window));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
573 g_free(msg);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
574 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
575 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
576 gtk_entry_set_text(GTK_ENTRY(title_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
577 gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
578 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
579 gtk_entry_set_text(GTK_ENTRY(comment_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
580 gtk_entry_set_text(GTK_ENTRY(year_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
581 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
582 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
583 gtk_widget_set_sensitive(GTK_WIDGET(w), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
584 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
585 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
586 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
587
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
588 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
589
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
590 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
591 set_mpeg_level_label(gboolean mpeg25, gint lsf, gint layer)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
592 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
593 if (mpeg25)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
594 label_set_text(mpeg_level_val, "MPEG-2.5 Layer %d", layer);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
595 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
596 label_set_text(mpeg_level_val, "MPEG-%d Layer %d", lsf + 1, layer);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
597 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
598
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
599 static const gchar *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
600 channel_mode_name(gint mode)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
601 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
602 static const gchar *channel_mode[] = { N_("Stereo"), N_("Joint stereo"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
603 N_("Dual channel"), N_("Single channel")
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
604 };
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
605 if (mode < 0 || mode > 3)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
606 return "";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
607
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
608 return gettext(channel_mode[mode]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
609 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
610
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
611 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
612 file_info_http(gchar * filename)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
613 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
614 gtk_widget_set_sensitive(id3_frame, FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
615 if (mpg123_filename && !strcmp(filename, mpg123_filename) &&
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
616 mpg123_bitrate != 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
617 set_mpeg_level_label(mpg123_mpeg25, mpg123_lsf, mpg123_layer);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
618 label_set_text(mpeg_bitrate_val, _("%d KBit/s"), mpg123_bitrate);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
619 label_set_text(mpeg_samplerate_val, _("%ld Hz"), mpg123_frequency);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
620 label_set_text(mpeg_flags, "%s", channel_mode_name(mpg123_mode));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
621 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
622 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
623
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
624 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
625 change_buttons(GtkObject * object)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
626 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
627 gtk_widget_set_sensitive(GTK_WIDGET(object), TRUE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
628 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
629 gtk_widget_set_sensitive(GTK_WIDGET(revert),TRUE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
630 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
631 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
632
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
633 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
634 mpg123_file_info_box(gchar * filename)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
635 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
636 gint i;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
637 gchar *title, *filename_utf8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
638
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
639 emphasis[0] = _("None");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
640 emphasis[1] = _("50/15 ms");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
641 emphasis[2] = "";
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
642 emphasis[3] = _("CCIT J.17");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
643 bool_label[0] = _("No");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
644 bool_label[1] = _("Yes");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
645
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
646 if (!window) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
647 GtkWidget *pixmapwid;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
648 GdkPixbuf *pixbuf;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
649 PangoAttrList *attrs;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
650 PangoAttribute *attr;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
651 GtkWidget *test_table = gtk_table_new(2, 10, FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
652 GtkWidget *urk, *blark;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
653 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
654 GtkWidget * tracknum_box, * comment_frame;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
655 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
656
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
657 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
658 gtk_window_set_type_hint(GTK_WINDOW(window),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
659 GDK_WINDOW_TYPE_HINT_DIALOG);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
660 gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
661 gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
662 g_signal_connect(G_OBJECT(window), "destroy",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
663 G_CALLBACK(gtk_widget_destroyed), &window);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
664 gtk_container_set_border_width(GTK_CONTAINER(window), 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
665
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
666 vbox = gtk_vbox_new(FALSE, 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
667 gtk_container_add(GTK_CONTAINER(window), vbox);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
668
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
669
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
670 filename_vbox = gtk_hbox_new(FALSE, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
671 gtk_box_pack_start(GTK_BOX(vbox), filename_vbox, FALSE, TRUE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
672
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
673 pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
674 gnome_mime_audio_xpm);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
675 pixmapwid = gtk_image_new_from_pixbuf(pixbuf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
676 g_object_unref(pixbuf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
677 gtk_misc_set_alignment(GTK_MISC(pixmapwid), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
678 gtk_box_pack_start(GTK_BOX(filename_vbox), pixmapwid, FALSE, FALSE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
679 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
680
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
681 label = gtk_label_new(NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
682
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
683 attrs = pango_attr_list_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
684
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
685 attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
686 attr->start_index = 0;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
687 attr->end_index = -1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
688 pango_attr_list_insert(attrs, attr);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
689
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
690 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
691 gtk_label_set_text(GTK_LABEL(label), _("Name:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
692 gtk_box_pack_start(GTK_BOX(filename_vbox), label, FALSE, FALSE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
693
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
694 filename_entry = gtk_entry_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
695 gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
696 gtk_box_pack_start(GTK_BOX(filename_vbox), filename_entry, TRUE,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
697 TRUE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
698
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
699 hbox = gtk_hbox_new(FALSE, 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
700 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
701
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
702 left_vbox = gtk_table_new(2, 4, FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
703 gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
704
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
705 /* MPEG-Info window */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
706
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
707 mpeg_frame = gtk_frame_new(_(" MPEG Info "));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
708 gtk_table_attach(GTK_TABLE(left_vbox), mpeg_frame, 0, 2, 0, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
709 GTK_FILL, GTK_FILL, 0, 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
710
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
711 mpeg_box = gtk_vbox_new(FALSE, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
712 gtk_container_add(GTK_CONTAINER(mpeg_frame), mpeg_box);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
713 gtk_container_set_border_width(GTK_CONTAINER(mpeg_box), 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
714 gtk_box_set_spacing(GTK_BOX(mpeg_box), 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
715
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
716 /* MPEG Layer Info */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
717
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
718 /* FIXME: Obvious... */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
719 gtk_container_set_border_width(GTK_CONTAINER(test_table), 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
720 gtk_container_add(GTK_CONTAINER(mpeg_box), test_table);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
721
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
722 mpeg_level = gtk_label_new(_("MPEG Level:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
723 gtk_misc_set_alignment(GTK_MISC(mpeg_level), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
724 gtk_label_set_justify(GTK_LABEL(mpeg_level), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
725 gtk_label_set_attributes(GTK_LABEL(mpeg_level), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
726 gtk_table_attach(GTK_TABLE(test_table), mpeg_level, 0, 1, 0, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
727 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
728
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
729 mpeg_level_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
730 gtk_misc_set_alignment(GTK_MISC(mpeg_level_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
731 gtk_label_set_justify(GTK_LABEL(mpeg_level_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
732 gtk_table_attach(GTK_TABLE(test_table), mpeg_level_val, 1, 2, 0, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
733 GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
734
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
735 mpeg_bitrate = gtk_label_new(_("Bit rate:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
736 gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
737 gtk_label_set_justify(GTK_LABEL(mpeg_bitrate), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
738 gtk_label_set_attributes(GTK_LABEL(mpeg_bitrate), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
739 gtk_table_attach(GTK_TABLE(test_table), mpeg_bitrate, 0, 1, 1, 2,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
740 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
741
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
742 mpeg_bitrate_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
743 gtk_misc_set_alignment(GTK_MISC(mpeg_bitrate_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
744 gtk_label_set_justify(GTK_LABEL(mpeg_bitrate_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
745 gtk_table_attach(GTK_TABLE(test_table), mpeg_bitrate_val, 1, 2, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
746 2, GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
747
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
748 mpeg_samplerate = gtk_label_new(_("Sample rate:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
749 gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
750 gtk_label_set_justify(GTK_LABEL(mpeg_samplerate), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
751 gtk_label_set_attributes(GTK_LABEL(mpeg_samplerate), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
752 gtk_table_attach(GTK_TABLE(test_table), mpeg_samplerate, 0, 1, 2,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
753 3, GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
754
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
755 mpeg_samplerate_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
756 gtk_misc_set_alignment(GTK_MISC(mpeg_samplerate_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
757 gtk_label_set_justify(GTK_LABEL(mpeg_samplerate_val),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
758 GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
759 gtk_table_attach(GTK_TABLE(test_table), mpeg_samplerate_val, 1, 2,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
760 2, 3, GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
761
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
762 mpeg_frames = gtk_label_new(_("Frames:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
763 gtk_misc_set_alignment(GTK_MISC(mpeg_frames), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
764 gtk_label_set_justify(GTK_LABEL(mpeg_frames), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
765 gtk_label_set_attributes(GTK_LABEL(mpeg_frames), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
766 gtk_table_attach(GTK_TABLE(test_table), mpeg_frames, 0, 1, 3, 4,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
767 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
768
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
769 mpeg_frames_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
770 gtk_misc_set_alignment(GTK_MISC(mpeg_frames_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
771 gtk_label_set_justify(GTK_LABEL(mpeg_frames_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
772 gtk_table_attach(GTK_TABLE(test_table), mpeg_frames_val, 1, 2, 3,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
773 4, GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
774
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
775 mpeg_filesize = gtk_label_new(_("File size:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
776 gtk_misc_set_alignment(GTK_MISC(mpeg_filesize), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
777 gtk_label_set_justify(GTK_LABEL(mpeg_filesize), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
778 gtk_label_set_attributes(GTK_LABEL(mpeg_filesize), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
779 gtk_table_attach(GTK_TABLE(test_table), mpeg_filesize, 0, 1, 4, 5,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
780 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
781
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
782 mpeg_filesize_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
783 gtk_misc_set_alignment(GTK_MISC(mpeg_filesize_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
784 gtk_label_set_justify(GTK_LABEL(mpeg_filesize_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
785 gtk_table_attach(GTK_TABLE(test_table), mpeg_filesize_val, 1, 2, 4,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
786 5, GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
787
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
788 urk = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
789 blark = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
790 gtk_misc_set_alignment(GTK_MISC(urk), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
791 gtk_misc_set_alignment(GTK_MISC(blark), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
792
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
793 gtk_table_attach(GTK_TABLE(test_table), urk, 0, 1, 5, 6, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
794 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
795 gtk_table_attach(GTK_TABLE(test_table), blark, 1, 2, 5, 6,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
796 GTK_FILL, GTK_FILL, 10, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
797
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
798 mpeg_error = gtk_label_new(_("Error Protection:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
799 gtk_misc_set_alignment(GTK_MISC(mpeg_error), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
800 gtk_label_set_justify(GTK_LABEL(mpeg_error), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
801 gtk_label_set_attributes(GTK_LABEL(mpeg_error), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
802 gtk_table_attach(GTK_TABLE(test_table), mpeg_error, 0, 1, 6, 7,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
803 GTK_FILL, GTK_FILL, 5, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
804
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
805 mpeg_error_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
806 gtk_misc_set_alignment(GTK_MISC(mpeg_error_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
807 gtk_label_set_justify(GTK_LABEL(mpeg_error_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
808 gtk_table_attach(GTK_TABLE(test_table), mpeg_error_val, 1, 2, 6, 7,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
809 GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
810
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
811 mpeg_copy = gtk_label_new(_("Copyright:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
812 gtk_misc_set_alignment(GTK_MISC(mpeg_copy), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
813 gtk_label_set_justify(GTK_LABEL(mpeg_copy), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
814 gtk_label_set_attributes(GTK_LABEL(mpeg_copy), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
815 gtk_table_attach(GTK_TABLE(test_table), mpeg_copy, 0, 1, 7, 8,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
816 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
817
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
818 mpeg_copy_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
819 gtk_misc_set_alignment(GTK_MISC(mpeg_copy_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
820 gtk_label_set_justify(GTK_LABEL(mpeg_copy_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
821 gtk_table_attach(GTK_TABLE(test_table), mpeg_copy_val, 1, 2, 7, 8,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
822 GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
823
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
824 mpeg_orig = gtk_label_new(_("Original:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
825 gtk_misc_set_alignment(GTK_MISC(mpeg_orig), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
826 gtk_label_set_justify(GTK_LABEL(mpeg_orig), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
827 gtk_label_set_attributes(GTK_LABEL(mpeg_orig), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
828 gtk_table_attach(GTK_TABLE(test_table), mpeg_orig, 0, 1, 8, 9,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
829 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
830
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
831 mpeg_orig_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
832 gtk_misc_set_alignment(GTK_MISC(mpeg_orig_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
833 gtk_label_set_justify(GTK_LABEL(mpeg_orig_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
834 gtk_table_attach(GTK_TABLE(test_table), mpeg_orig_val, 1, 2, 8, 9,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
835 GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
836
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
837 mpeg_emph = gtk_label_new(_("Emphasis:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
838 gtk_misc_set_alignment(GTK_MISC(mpeg_emph), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
839 gtk_label_set_justify(GTK_LABEL(mpeg_emph), GTK_JUSTIFY_RIGHT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
840 gtk_label_set_attributes(GTK_LABEL(mpeg_emph), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
841 gtk_table_attach(GTK_TABLE(test_table), mpeg_emph, 0, 1, 9, 10,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
842 GTK_FILL, GTK_FILL, 5, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
843
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
844 mpeg_emph_val = gtk_label_new("");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
845 gtk_misc_set_alignment(GTK_MISC(mpeg_emph_val), 0, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
846 gtk_label_set_justify(GTK_LABEL(mpeg_emph_val), GTK_JUSTIFY_LEFT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
847 gtk_table_attach(GTK_TABLE(test_table), mpeg_emph_val, 1, 2, 9, 10,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
848 GTK_FILL, GTK_FILL, 10, 2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
849
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
850
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
851 id3_frame = gtk_frame_new(_(" ID3 Tag "));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
852 gtk_table_attach(GTK_TABLE(left_vbox), id3_frame, 2, 4, 0, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
853 GTK_FILL, GTK_FILL, 0, 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
854
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
855 table = gtk_table_new(7, 5, FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
856 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
857 gtk_container_add(GTK_CONTAINER(id3_frame), table);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
858
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
859 label = gtk_label_new(_("Title:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
860 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
861 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
862 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
863 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
864
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
865 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
866 title_entry = gtk_entry_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
867 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
868 title_entry = gtk_entry_new_with_max_length(30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
869 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
870 gtk_table_attach(GTK_TABLE(table), title_entry, 1, 6, 0, 1,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
871 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
872 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
873
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
874 label = gtk_label_new(_("Artist:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
875 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
876 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
877 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
878 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
879
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
880 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
881 artist_entry = gtk_entry_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
882 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
883 artist_entry = gtk_entry_new_with_max_length(30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
884 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
885 gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 6, 1, 2,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
886 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
887 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
888
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
889 label = gtk_label_new(_("Album:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
890 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
891 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
892 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
893 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
894
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
895 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
896 album_entry = gtk_entry_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
897 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
898 album_entry = gtk_entry_new_with_max_length(30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
899 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
900 gtk_table_attach(GTK_TABLE(table), album_entry, 1, 6, 2, 3,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
901 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
902 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
903
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
904 label = gtk_label_new(_("Comment:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
905 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
906 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
907 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
908 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
909
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
910 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
911 comment_frame = gtk_frame_new(NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
912 gtk_frame_set_shadow_type(GTK_FRAME(comment_frame),GTK_SHADOW_IN);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
913 comment_entry = gtk_text_view_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
914 gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(comment_entry),FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
915 gtk_container_add(GTK_CONTAINER(comment_frame),comment_entry);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
916 gtk_table_attach(GTK_TABLE(table), comment_frame, 1, 6, 3, 4,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
917 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
918 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
919 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
920 comment_entry = gtk_entry_new_with_max_length(30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
921 gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 6, 3, 4,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
922 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
923 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
924 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
925
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
926 label = gtk_label_new(_("Year:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
927 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
928 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
929 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
930 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
931
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
932 year_entry = gtk_entry_new_with_max_length(4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
933 gtk_entry_set_width_chars(GTK_ENTRY(year_entry),4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
934 gtk_table_attach(GTK_TABLE(table), year_entry, 1, 2, 4, 5,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
935 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
936 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
937
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
938 label = gtk_label_new(_("Track number:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
939 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
940 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
941 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
942 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
943
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
944 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
945 tracknum_box = gtk_hbox_new(FALSE,0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
946 tracknum_entry = gtk_entry_new_with_max_length(2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
947 gtk_entry_set_width_chars(GTK_ENTRY(tracknum_entry),2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
948 totaltracks_entry = gtk_entry_new_with_max_length(2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
949 gtk_entry_set_width_chars(GTK_ENTRY(totaltracks_entry),2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
950 gtk_box_pack_start(GTK_BOX(tracknum_box),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
951 tracknum_entry, TRUE, TRUE, 1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
952 gtk_box_pack_start(GTK_BOX(tracknum_box),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
953 gtk_label_new(" / "), FALSE, FALSE, 1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
954 gtk_box_pack_start(GTK_BOX(tracknum_box),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
955 totaltracks_entry, TRUE, TRUE, 1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
956 gtk_table_attach(GTK_TABLE(table),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
957 tracknum_box,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
958 3, 4, 4, 5,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
959 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
960 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
961
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
962 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
963 tracknum_entry = gtk_entry_new_with_max_length(3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
964 gtk_widget_set_usize(tracknum_entry, 40, -1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
965 gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
966 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
967 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
968 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
969
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
970 label = gtk_label_new(_("Genre:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
971 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
972 gtk_label_set_attributes(GTK_LABEL(label), attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
973 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
974 GTK_FILL, 5, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
975
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
976 pango_attr_list_unref(attrs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
977
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
978 genre_combo = gtk_combo_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
979 gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
980 FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
981 if (!genre_list) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
982 for (i = 0; i < GENRE_MAX; i++)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
983 genre_list =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
984 g_list_prepend(genre_list,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
985 (gchar *) mpg123_id3_genres[i]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
986 genre_list = g_list_prepend(genre_list, "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
987 genre_list = g_list_sort(genre_list, genre_comp_func);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
988 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
989 gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
990
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
991 gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 6, 5, 6,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
992 GTK_FILL | GTK_EXPAND | GTK_SHRINK,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
993 GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
994
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
995 boxx = gtk_hbutton_box_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
996 gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
997
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
998 remove_id3 = gtk_button_new_from_stock(GTK_STOCK_DELETE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
999 gtk_container_add(GTK_CONTAINER(boxx), remove_id3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1000
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1001 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1002 revert = gtk_button_new_from_stock(GTK_STOCK_REVERT_TO_SAVED);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1003 gtk_container_add(GTK_CONTAINER(boxx), revert);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1004 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1005
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1006 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1007 copy_album_tags_but = gtk_button_new_with_label(_("Copy album tags"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1008 paste_album_tags_but = gtk_button_new_with_label(_("Paste album tags"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1009
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1010 gtk_container_add(GTK_CONTAINER(boxx), copy_album_tags_but);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1011 gtk_container_add(GTK_CONTAINER(boxx), paste_album_tags_but);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1012
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1013 g_signal_connect(G_OBJECT(copy_album_tags_but), "clicked",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1014 G_CALLBACK(copy_album_tags), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1015 g_signal_connect(G_OBJECT(paste_album_tags_but), "clicked",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1016 G_CALLBACK(paste_album_tags), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1017
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1018 gtk_widget_set_sensitive(GTK_WIDGET(paste_album_tags_but), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1019 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1020 save = gtk_button_new_from_stock(GTK_STOCK_SAVE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1021 gtk_container_add(GTK_CONTAINER(boxx), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1022
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1023 g_signal_connect(G_OBJECT(remove_id3), "clicked",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1024 G_CALLBACK(remove_id3_cb), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1025 g_signal_connect(G_OBJECT(save), "clicked", G_CALLBACK(save_cb),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1026 remove_id3);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1027 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1028 g_signal_connect(G_OBJECT(revert), "clicked", G_CALLBACK(fill_entries),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1029 NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1030 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1031
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1032
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1033 gtk_table_attach(GTK_TABLE(table), boxx, 0, 5, 6, 7, GTK_FILL, 0,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1034 0, 8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1035
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1036 bbox = gtk_hbutton_box_new();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1037 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1038 gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1039 gtk_table_attach(GTK_TABLE(left_vbox), bbox, 0, 4, 1, 2, GTK_FILL,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1040 0, 0, 8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1041
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1042 cancel = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1043 g_signal_connect_swapped(G_OBJECT(cancel), "clicked",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1044 G_CALLBACK(gtk_widget_destroy),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1045 G_OBJECT(window));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1046 GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1047 gtk_box_pack_start(GTK_BOX(bbox), cancel, FALSE, FALSE, 0);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1048 gtk_widget_grab_default(cancel);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1049
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1050
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1051 gtk_table_set_col_spacing(GTK_TABLE(left_vbox), 1, 10);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1052
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1053
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1054 g_signal_connect_swapped(G_OBJECT(title_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1055 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1056 g_signal_connect_swapped(G_OBJECT(artist_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1057 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1058 g_signal_connect_swapped(G_OBJECT(album_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1059 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1060 g_signal_connect_swapped(G_OBJECT(year_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1061 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1062 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1063 g_signal_connect_swapped(G_OBJECT(gtk_text_view_get_buffer(GTK_TEXT_VIEW(comment_entry))), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1064 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1065 g_signal_connect_swapped(G_OBJECT(totaltracks_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1066 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1067 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1068 g_signal_connect_swapped(G_OBJECT(comment_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1069 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1070 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1071 g_signal_connect_swapped(G_OBJECT(tracknum_entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1072 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1073 g_signal_connect_swapped(G_OBJECT(GTK_COMBO(genre_combo)->entry), "changed",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1074 G_CALLBACK(change_buttons), save);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1075
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1076 /* Nonsence, should i remove this altogether?
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1077 causes changes to be saved as you type -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1078 makes save /revert buttons pointless
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1079 g_signal_connect(G_OBJECT(title_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1080 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1081 g_signal_connect(G_OBJECT(artist_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1082 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1083 g_signal_connect(G_OBJECT(album_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1084 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1085 g_signal_connect(G_OBJECT(year_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1086 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1087 g_signal_connect(G_OBJECT(comment_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1088 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1089 g_signal_connect(G_OBJECT(tracknum_entry), "activate",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1090 G_CALLBACK(press_save), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1091 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1092 g_signal_connect(G_OBJECT(window), "key_press_event",
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1093 G_CALLBACK(fileinfo_keypress_cb), NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1094 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1095
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1096 g_free(current_filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1097 current_filename = g_strdup(filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1098
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1099 filename_utf8 = filename_to_utf8(filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1100
186
01babf2781bb [svn] Fileinfo dialog adjustment.
nenolod
parents: 61
diff changeset
1101 title = g_strdup_printf(_("%s - Audacious"), g_basename(filename_utf8));
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1102 gtk_window_set_title(GTK_WINDOW(window), title);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1103 g_free(title);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1104
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1105 gtk_entry_set_text(GTK_ENTRY(filename_entry), filename_utf8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1106 g_free(filename_utf8);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1107
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1108 gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1109
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1110 gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1111 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1112 gtk_entry_set_text(GTK_ENTRY(year_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1113 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1114 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1115 gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(comment_entry)),"",-1);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1116 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1117 gtk_entry_set_text(GTK_ENTRY(comment_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1118 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1119 gtk_list_select_item(GTK_LIST(GTK_COMBO(genre_combo)->list),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1120 g_list_index(genre_list, ""));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1121
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1122 gtk_label_set_text(GTK_LABEL(mpeg_level), _("MPEG Level:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1123 gtk_label_set_text(GTK_LABEL(mpeg_level_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1124
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1125 gtk_label_set_text(GTK_LABEL(mpeg_bitrate), _("Bit rate:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1126 gtk_label_set_text(GTK_LABEL(mpeg_bitrate_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1127
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1128 gtk_label_set_text(GTK_LABEL(mpeg_samplerate), _("Sample rate:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1129 gtk_label_set_text(GTK_LABEL(mpeg_samplerate_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1130
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1131 gtk_label_set_text(GTK_LABEL(mpeg_error), _("Error Protection:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1132 gtk_label_set_text(GTK_LABEL(mpeg_error_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1133
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1134 gtk_label_set_text(GTK_LABEL(mpeg_copy), _("Copyright:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1135 gtk_label_set_text(GTK_LABEL(mpeg_copy_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1136
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1137 gtk_label_set_text(GTK_LABEL(mpeg_orig), _("Original:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1138 gtk_label_set_text(GTK_LABEL(mpeg_orig_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1139
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1140 gtk_label_set_text(GTK_LABEL(mpeg_emph), _("Emphasis:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1141 gtk_label_set_text(GTK_LABEL(mpeg_emph_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1142
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1143 gtk_label_set_text(GTK_LABEL(mpeg_frames), _("Frames:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1144 gtk_label_set_text(GTK_LABEL(mpeg_frames_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1145
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1146 gtk_label_set_text(GTK_LABEL(mpeg_filesize), _("File size:"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1147 gtk_label_set_text(GTK_LABEL(mpeg_filesize_val), _("N/A"));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1148
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1149 if (str_has_prefix_nocase(filename, "http://")) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1150 file_info_http(filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1151 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1152 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1153
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1154 gtk_widget_set_sensitive(id3_frame,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1155 vfs_is_writeable(filename));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1156
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1157 fill_entries(NULL, NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1158
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1159 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1160 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1161 gtk_widget_set_sensitive(GTK_WIDGET(revert), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1162 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1163 gtk_widget_show_all(window);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1164 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1165
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1166 #ifdef HAVE_ID3LIB
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1167
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1168 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1169 fill_entries(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1170 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1171 VFSFile *fh;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1172 ID3Tag * id3tag;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1173
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1174 if (str_has_prefix_nocase(current_filename, "http://"))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1175 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1176
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1177 id3tag = ID3Tag_New();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1178 ID3Tag_LinkPreferV2(id3tag, current_filename);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1179
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1180 id3v2_frame_to_entry(title_entry, id3tag, ID3FID_TITLE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1181 id3v2_frame_to_entry(artist_entry, id3tag, ID3FID_LEADARTIST);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1182 id3v2_frame_to_entry(album_entry, id3tag, ID3FID_ALBUM);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1183 id3v2_frame_to_text_view(comment_entry, id3tag, ID3FID_COMMENT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1184 id3v2_frame_to_entry(year_entry, id3tag, ID3FID_YEAR);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1185 id3v2_tracknum_to_entries(tracknum_entry, totaltracks_entry, id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1186 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1187 ID3Frame * frame = ID3Tag_FindFrameWithID(id3tag, ID3FID_CONTENTTYPE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1188
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1189 if (frame) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1190 int genre_idx = -1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1191 char genre[64];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1192 const char * genre2;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1193 ID3Field * text_field = ID3Frame_GetField(frame,ID3FN_TEXT);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1194 ID3Field_GetASCII(text_field,genre,64);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1195
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1196 /* attempt to find corresponding genre */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1197 g_strstrip(genre);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1198 sscanf(genre,"(%d)",&genre_idx);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1199 if ((genre2 = ID3_V1GENRE2DESCRIPTION(genre_idx)))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1200 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(genre_combo)->entry),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1201 genre2);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1202 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1203 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1204
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1205 gtk_widget_set_sensitive(GTK_WIDGET(remove_id3), TRUE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1206 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1207
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1208 update_paste_sensitive();
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1209
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1210 ID3Tag_Delete(id3tag);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1211
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1212 if ((fh = vfs_fopen(current_filename, "rb")) != NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1213 guint32 head;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1214 guchar tmp[4];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1215 struct frame frm;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1216 gboolean id3_found = FALSE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1217
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1218 if (vfs_fread(tmp, 1, 4, fh) != 4) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1219 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1220 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1221 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1222 head =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1223 ((guint32) tmp[0] << 24) | ((guint32) tmp[1] << 16) |
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1224 ((guint32) tmp[2] << 8) | (guint32) tmp[3];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1225 while (!mpg123_head_check(head)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1226 head <<= 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1227 if (vfs_fread(tmp, 1, 1, fh) != 1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1228 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1229 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1230 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1231 head |= tmp[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1232 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1233 if (mpg123_decode_header(&frm, head)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1234 guchar *buf;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1235 gdouble tpf;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1236 gint pos;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1237 xing_header_t xing_header;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1238 guint32 num_frames;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1239
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1240 buf = g_malloc(frm.framesize + 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1241 vfs_fseek(fh, -4, SEEK_CUR);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1242 vfs_fread(buf, 1, frm.framesize + 4, fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1243 tpf = mpg123_compute_tpf(&frm);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1244 set_mpeg_level_label(frm.mpeg25, frm.lsf, frm.lay);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1245 pos = vfs_ftell(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1246 vfs_fseek(fh, 0, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1247 if (mpg123_get_xing_header(&xing_header, buf)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1248 num_frames = xing_header.frames;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1249 label_set_text(mpeg_bitrate_val,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1250 _("Variable,\navg. bitrate: %d KBit/s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1251 (gint) ((xing_header.bytes * 8) /
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1252 (tpf * xing_header.frames * 1000)));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1253 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1254 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1255 num_frames =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1256 ((vfs_ftell(fh) - pos -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1257 (id3_found ? 128 : 0)) / mpg123_compute_bpf(&frm)) + 1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1258 label_set_text(mpeg_bitrate_val, _("%d KBit/s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1259 tabsel_123[frm.lsf][frm.lay -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1260 1][frm.bitrate_index]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1261 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1262 label_set_text(mpeg_samplerate_val, _("%ld Hz"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1263 mpg123_freqs[frm.sampling_frequency]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1264 label_set_text(mpeg_error_val, _("%s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1265 bool_label[frm.error_protection]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1266 label_set_text(mpeg_copy_val, _("%s"), bool_label[frm.copyright]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1267 label_set_text(mpeg_orig_val, _("%s"), bool_label[frm.original]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1268 label_set_text(mpeg_emph_val, _("%s"), emphasis[frm.emphasis]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1269 label_set_text(mpeg_frames_val, _("%d"), num_frames);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1270 label_set_text(mpeg_filesize_val, _("%lu Bytes"), vfs_ftell(fh));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1271 g_free(buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1272 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1273 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1274 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1275
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1276 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1277
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1278 #else /* ! HAVE_ID3LIB */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1279
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1280 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1281 fill_entries(GtkWidget * w, gpointer data)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1282 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1283 if ((fh = vfs_fopen(current_filename, "rb")) != NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1284 guint32 head;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1285 guchar tmp[4];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1286 struct frame frm;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1287 gboolean id3_found = FALSE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1288
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1289 vfs_fseek(fh, -sizeof(tag), SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1290 if (vfs_fread(&tag, 1, sizeof(tag), fh) == sizeof(tag)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1291 if (!strncmp(tag.tag, "TAG", 3)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1292 id3_found = TRUE;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1293 set_entry_tag(GTK_ENTRY(title_entry), tag.title, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1294 set_entry_tag(GTK_ENTRY(artist_entry), tag.artist, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1295 set_entry_tag(GTK_ENTRY(album_entry), tag.album, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1296 set_entry_tag(GTK_ENTRY(year_entry), tag.year, 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1297 /* Check for v1.1 tags */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1298 if (tag.u.v1_1.__zero == 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1299 gchar *temp =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1300 g_strdup_printf("%d", tag.u.v1_1.track_number);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1301 set_entry_tag(GTK_ENTRY(comment_entry),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1302 tag.u.v1_1.comment, 28);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1303 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), temp);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1304 g_free(temp);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1305 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1306 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1307 set_entry_tag(GTK_ENTRY(comment_entry),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1308 tag.u.v1_0.comment, 30);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1309 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1310 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1311
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1312 gtk_list_select_item(GTK_LIST
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1313 (GTK_COMBO(genre_combo)->list),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1314 g_list_index(genre_list, (gchar *)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1315 mpg123_id3_genres[tag.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1316 genre]));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1317 gtk_widget_set_sensitive(GTK_WIDGET(remove_id3), TRUE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1318 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1319 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1320 gtk_widget_set_sensitive(GTK_WIDGET(revert), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1321 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1322 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1323 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1324 gtk_entry_set_text(GTK_ENTRY(title_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1325 gtk_entry_set_text(GTK_ENTRY(artist_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1326 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1327 gtk_entry_set_text(GTK_ENTRY(comment_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1328 gtk_entry_set_text(GTK_ENTRY(year_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1329 gtk_entry_set_text(GTK_ENTRY(album_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1330 gtk_entry_set_text(GTK_ENTRY(tracknum_entry), "");
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1331 gtk_widget_set_sensitive(GTK_WIDGET(remove_id3), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1332 gtk_widget_set_sensitive(GTK_WIDGET(save), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1333 #if 0
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1334 gtk_widget_set_sensitive(GTK_WIDGET(revert), FALSE);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1335 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1336 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1337 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1338 vfs_rewind(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1339 if (vfs_fread(tmp, 1, 4, fh) != 4) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1340 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1341 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1342 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1343 head =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1344 ((guint32) tmp[0] << 24) | ((guint32) tmp[1] << 16) |
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1345 ((guint32) tmp[2] << 8) | (guint32) tmp[3];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1346 while (!mpg123_head_check(head)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1347 head <<= 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1348 if (vfs_fread(tmp, 1, 1, fh) != 1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1349 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1350 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1351 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1352 head |= tmp[0];
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1353 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1354 if (mpg123_decode_header(&frm, head)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1355 guchar *buf;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1356 gdouble tpf;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1357 gint pos;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1358 xing_header_t xing_header;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1359 guint32 num_frames;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1360
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1361 buf = g_malloc(frm.framesize + 4);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1362 vfs_fseek(fh, -4, SEEK_CUR);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1363 vfs_fread(buf, 1, frm.framesize + 4, fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1364 tpf = mpg123_compute_tpf(&frm);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1365 set_mpeg_level_label(frm.mpeg25, frm.lsf, frm.lay);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1366 pos = vfs_ftell(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1367 vfs_fseek(fh, 0, SEEK_END);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1368 if (mpg123_get_xing_header(&xing_header, buf)) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1369 num_frames = xing_header.frames;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1370 label_set_text(mpeg_bitrate_val,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1371 _("Variable,\navg. bitrate: %d KBit/s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1372 (gint) ((xing_header.bytes * 8) /
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1373 (tpf * xing_header.frames * 1000)));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1374 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1375 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1376 num_frames =
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1377 ((vfs_ftell(fh) - pos -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1378 (id3_found ? 128 : 0)) / mpg123_compute_bpf(&frm)) + 1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1379 label_set_text(mpeg_bitrate_val, _("%d KBit/s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1380 tabsel_123[frm.lsf][frm.lay -
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1381 1][frm.bitrate_index]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1382 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1383 label_set_text(mpeg_samplerate_val, _("%ld Hz"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1384 mpg123_freqs[frm.sampling_frequency]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1385 label_set_text(mpeg_error_val, _("%s"),
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1386 bool_label[frm.error_protection]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1387 label_set_text(mpeg_copy_val, _("%s"), bool_label[frm.copyright]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1388 label_set_text(mpeg_orig_val, _("%s"), bool_label[frm.original]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1389 label_set_text(mpeg_emph_val, _("%s"), emphasis[frm.emphasis]);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1390 label_set_text(mpeg_frames_val, _("%d"), num_frames);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1391 label_set_text(mpeg_filesize_val, _("%lu Bytes"), vfs_ftell(fh));
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1392 g_free(buf);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1393 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1394 vfs_fclose(fh);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1395 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1396 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1397
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1398 #endif