annotate Plugins/Input/flac/fileinfo.c @ 816:8073d8300502 trunk

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